diff options
author | Martin Liska <mliska@suse.cz> | 2021-11-11 16:42:23 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2021-12-02 14:13:09 +0100 |
commit | cde87638bf5cf6aafffb590986b6a890da0ba06c (patch) | |
tree | 992cb983e1e788230e477b16112c83026c6d57f1 /gcc/file-prefix-map.c | |
parent | 6f43a8a08053a871e785e2ebc80383e0849efb6f (diff) | |
download | gcc-cde87638bf5cf6aafffb590986b6a890da0ba06c.zip gcc-cde87638bf5cf6aafffb590986b6a890da0ba06c.tar.gz gcc-cde87638bf5cf6aafffb590986b6a890da0ba06c.tar.bz2 |
Implement -fprofile-prefix-map.
PR gcov-profile/96092
gcc/ChangeLog:
* common.opt: New option.
* coverage.c (coverage_begin_function): Emit filename with
remap_profile_filename.
* doc/invoke.texi: Document the new option.
* file-prefix-map.c (add_profile_prefix_map): New.
(remap_profile_filename): Likewise.
* file-prefix-map.h (add_profile_prefix_map): Likewise.
(remap_profile_filename): Likewise.
* lto-opts.c (lto_write_options): Handle
OPT_fprofile_prefix_map_.
* opts-global.c (handle_common_deferred_options): Likewise.
* opts.c (common_handle_option): Likewise.
(gen_command_line_string): Likewise.
* profile.c (output_location): Emit filename with
remap_profile_filename.
Diffstat (limited to 'gcc/file-prefix-map.c')
-rw-r--r-- | gcc/file-prefix-map.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/file-prefix-map.c b/gcc/file-prefix-map.c index ad242e5..290b4b2 100644 --- a/gcc/file-prefix-map.c +++ b/gcc/file-prefix-map.c @@ -92,6 +92,7 @@ remap_filename (file_prefix_map *maps, const char *filename) /* Linked lists of file_prefix_map structures. */ static file_prefix_map *macro_prefix_maps; /* -fmacro-prefix-map */ static file_prefix_map *debug_prefix_maps; /* -fdebug-prefix-map */ +static file_prefix_map *profile_prefix_maps; /* -fprofile-prefix-map */ /* Record a file prefix mapping for -fmacro-prefix-map. */ void @@ -113,6 +114,14 @@ add_file_prefix_map (const char *arg) { add_prefix_map (macro_prefix_maps, arg, "-ffile-prefix-map"); add_prefix_map (debug_prefix_maps, arg, "-ffile-prefix-map"); + add_prefix_map (profile_prefix_maps, arg, "-ffile-prefix-map"); +} + +/* Record a file prefix mapping for -fprofile-prefix-map. */ +void +add_profile_prefix_map (const char *arg) +{ + add_prefix_map (profile_prefix_maps, arg, "-fprofile-prefix-map"); } /* Remap using -fmacro-prefix-map. Return the GC-allocated new name @@ -130,3 +139,11 @@ remap_debug_filename (const char *filename) { return remap_filename (debug_prefix_maps, filename); } + +/* Remap using -fprofile-prefix-map. Return the GC-allocated new name + corresponding to FILENAME or FILENAME if no remapping was performed. */ +const char * +remap_profile_filename (const char *filename) +{ + return remap_filename (profile_prefix_maps, filename); +} |