diff options
author | bwilson <bwilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-18 21:18:46 +0000 |
---|---|---|
committer | bwilson <bwilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-18 21:18:46 +0000 |
commit | f5a4bf2f7bb5b8e66c5aad1c894d8342d762c577 (patch) | |
tree | f7b099d2adadd6e4944993c460f529ef042da6be | |
parent | 324ae56a90715f042f2c4c331fd87e2a6e2428b9 (diff) | |
download | gcc-f5a4bf2f7bb5b8e66c5aad1c894d8342d762c577.tar.gz |
* config/xtensa/xtensa.h (FUNCTION_PROFILER): Respect flag_pic
when generating the call to _mcount.
(NO_PROFILE_COUNTERS): Define.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54765 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/xtensa/xtensa.h | 44 |
2 files changed, 30 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 37bb4873597..db446af5f7e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 3ec7b3f8e66..e98c2c673f8 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -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 |