Commit 9de6af45 by Claudiu Zissulescu Committed by Claudiu Zissulescu

[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
parent dddc1815
2018-11-13 Claudiu Zissulescu <claziss@synopsys.com> 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 * config/arc/arc.c (hwloop_optimize): Bailout when detecting a
jump table data in the text section. jump table data in the text section.
...@@ -811,15 +811,9 @@ extern int arc_initial_elimination_offset(int from, int to); ...@@ -811,15 +811,9 @@ extern int arc_initial_elimination_offset(int from, int to);
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
(OFFSET) = arc_initial_elimination_offset ((FROM), (TO)) (OFFSET) = arc_initial_elimination_offset ((FROM), (TO))
/* Output assembler code to FILE to increment profiler label # LABELNO /* All the work done in PROFILE_HOOK, but still required. */
for profiling a function entry. */ #undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \ #define FUNCTION_PROFILER(STREAM, LABELNO) do { } while (0)
do { \
if (flag_pic) \
fprintf (FILE, "\tbl\t__mcount@plt\n"); \
else \
fprintf (FILE, "\tbl\t__mcount\n"); \
} while (0)
#define NO_PROFILE_COUNTERS 1 #define NO_PROFILE_COUNTERS 1
......
...@@ -78,3 +78,12 @@ along with GCC; see the file COPYING3. If not see ...@@ -78,3 +78,12 @@ along with GCC; see the file COPYING3. If not see
#undef LINK_GCC_C_SEQUENCE_SPEC #undef LINK_GCC_C_SEQUENCE_SPEC
#define LINK_GCC_C_SEQUENCE_SPEC \ #define LINK_GCC_C_SEQUENCE_SPEC \
"--start-group %G %{!specs=*:%{!nolibc:-lc -lnosys}} --end-group" "--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); \
}
...@@ -123,3 +123,13 @@ along with GCC; see the file COPYING3. If not see ...@@ -123,3 +123,13 @@ along with GCC; see the file COPYING3. If not see
: "=r" (_beg) \ : "=r" (_beg) \
: "0" (_beg), "r" (_end), "r" (_xtr), "r" (_scno)); \ : "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); \
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment