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