xtensa.h (FUNCTION_PROFILER): Respect flag_pic when generating the call to _mcount.

* config/xtensa/xtensa.h (FUNCTION_PROFILER): Respect flag_pic
        when generating the call to _mcount.
        (NO_PROFILE_COUNTERS): Define.

From-SVN: r54765
This commit is contained in:
Bob Wilson 2002-06-18 21:18:46 +00:00 committed by Bob Wilson
parent 26e4af5477
commit 5ee924c2fb
2 changed files with 30 additions and 20 deletions

View File

@ -1,3 +1,9 @@
2002-06-18 Bob Wilson <bob.wilson@acm.org>
* config/xtensa/xtensa.h (FUNCTION_PROFILER): Respect flag_pic
when generating the call to _mcount.
(NO_PROFILE_COUNTERS): Define.
2002-06-18 Richard Henderson <rth@redhat.com>
* print-rtl.c (print_rtx): Adjust NOTE argument numbers for

View File

@ -921,29 +921,33 @@ typedef struct xtensa_args {
&& (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
|| TREE_ADDRESSABLE (TYPE)))
/* Output assembler code to FILE to increment profiler label LABELNO
for profiling a function entry.
The mcount code in glibc doesn't seem to use this LABELNO stuff.
Some ports (e.g., MIPS) don't even bother to pass the label
address, and even those that do (e.g., i386) don't seem to use it.
The information needed by mcount() is the current PC and the
current return address, so that mcount can identify an arc in the
call graph. For Xtensa, we pass the current return address as
the first argument to mcount, and the current PC is available as
a0 in mcount's register window. Both of these values contain
window size information in the two most significant bits; we assume
that the mcount code will mask off those bits. The call to mcount
uses a window size of 8 to make sure that mcount doesn't clobber
/* Profiling Xtensa code is typically done with the built-in profiling
feature of Tensilica's instruction set simulator, which does not
require any compiler support. Profiling code on a real (i.e.,
non-simulated) Xtensa processor is currently only supported by
GNU/Linux with glibc. The glibc version of _mcount doesn't require
counter variables. The _mcount function needs the current PC and
the current return address to identify an arc in the call graph.
Pass the current return address as the first argument; the current
PC is available as a0 in _mcount's register window. Both of these
values contain window size information in the two most significant
bits; we assume that _mcount will mask off those bits. The call to
_mcount uses a window size of 8 to make sure that it doesn't clobber
any incoming argument values. */
#define FUNCTION_PROFILER(FILE, LABELNO) \
#define NO_PROFILE_COUNTERS
#define FUNCTION_PROFILER(FILE, LABELNO) \
do { \
fprintf (FILE, "\taddi\t%s, %s, 0\t# save current return address\n", \
reg_names[GP_REG_FIRST+10], \
reg_names[GP_REG_FIRST+0]); \
fprintf (FILE, "\tcall8\t_mcount\n"); \
} while (0);
fprintf (FILE, "\t%s\ta10, a0\n", TARGET_DENSITY ? "mov.n" : "mov"); \
if (flag_pic) \
{ \
fprintf (FILE, "\tmovi\ta8, _mcount@PLT\n"); \
fprintf (FILE, "\tcallx8\ta8\n"); \
} \
else \
fprintf (FILE, "\tcall8\t_mcount\n"); \
} while (0)
/* Stack pointer value doesn't matter at exit. */
#define EXIT_IGNORE_STACK 1