diff options
author | Claudiu Zissulescu <claziss@synopsys.com> | 2018-11-13 13:51:41 +0100 |
---|---|---|
committer | Claudiu Zissulescu <claziss@gcc.gnu.org> | 2018-11-13 13:51:41 +0100 |
commit | 9de6af4572105dbe63074d09b8c322464daec2e7 (patch) | |
tree | 701d22462fb8e2e5f24ac4351555887d2e1be97e | |
parent | dddc18157283e3ab2a3a4c32ededae2386a54bb3 (diff) | |
download | gcc-9de6af4572105dbe63074d09b8c322464daec2e7.zip gcc-9de6af4572105dbe63074d09b8c322464daec2e7.tar.gz gcc-9de6af4572105dbe63074d09b8c322464daec2e7.tar.bz2 |
[ARC] Add support for profiling in glibc.
Use PROFILE_HOOK to add mcount library calls in each toolchain.
gcc/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.h (FUNCTION_PROFILER): Redefine to empty.
* config/arc/elf.h (PROFILE_HOOK): Define.
* config/arc/linux.h (PROFILE_HOOK): Likewise.
From-SVN: r266068
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/arc/arc.h | 12 | ||||
-rw-r--r-- | gcc/config/arc/elf.h | 9 | ||||
-rw-r--r-- | gcc/config/arc/linux.h | 10 |
4 files changed, 28 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7ba3fd3f..3f94aeb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2018-11-13 Claudiu Zissulescu <claziss@synopsys.com> + * config/arc/arc.h (FUNCTION_PROFILER): Redefine to empty. + * config/arc/elf.h (PROFILE_HOOK): Define. + * config/arc/linux.h (PROFILE_HOOK): Likewise. + +2018-11-13 Claudiu Zissulescu <claziss@synopsys.com> + * config/arc/arc.c (hwloop_optimize): Bailout when detecting a jump table data in the text section. diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index 6e9b1e5..b81b0e7 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -811,15 +811,9 @@ extern int arc_initial_elimination_offset(int from, int to); #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ (OFFSET) = arc_initial_elimination_offset ((FROM), (TO)) -/* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. */ -#define FUNCTION_PROFILER(FILE, LABELNO) \ - do { \ - if (flag_pic) \ - fprintf (FILE, "\tbl\t__mcount@plt\n"); \ - else \ - fprintf (FILE, "\tbl\t__mcount\n"); \ - } while (0) +/* All the work done in PROFILE_HOOK, but still required. */ +#undef FUNCTION_PROFILER +#define FUNCTION_PROFILER(STREAM, LABELNO) do { } while (0) #define NO_PROFILE_COUNTERS 1 diff --git a/gcc/config/arc/elf.h b/gcc/config/arc/elf.h index 3472fd2..3aabcf8 100644 --- a/gcc/config/arc/elf.h +++ b/gcc/config/arc/elf.h @@ -78,3 +78,12 @@ along with GCC; see the file COPYING3. If not see #undef LINK_GCC_C_SEQUENCE_SPEC #define LINK_GCC_C_SEQUENCE_SPEC \ "--start-group %G %{!specs=*:%{!nolibc:-lc -lnosys}} --end-group" + +/* Emit rtl for profiling. Output assembler code to FILE + to call "_mcount" for profiling a function entry. */ +#define PROFILE_HOOK(LABEL) \ + { \ + rtx fun; \ + fun = gen_rtx_SYMBOL_REF (Pmode, "__mcount"); \ + emit_library_call (fun, LCT_NORMAL, VOIDmode); \ + } diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h index 62ebe4d..993f445 100644 --- a/gcc/config/arc/linux.h +++ b/gcc/config/arc/linux.h @@ -123,3 +123,13 @@ along with GCC; see the file COPYING3. If not see : "=r" (_beg) \ : "0" (_beg), "r" (_end), "r" (_xtr), "r" (_scno)); \ } + +/* Emit rtl for profiling. Output assembler code to FILE + to call "_mcount" for profiling a function entry. */ +#define PROFILE_HOOK(LABEL) \ + { \ + rtx fun, rt; \ + rt = get_hard_reg_initial_val (Pmode, RETURN_ADDR_REGNUM); \ + fun = gen_rtx_SYMBOL_REF (Pmode, "_mcount"); \ + emit_library_call (fun, LCT_NORMAL, VOIDmode, rt, Pmode); \ + } |