From: Bob Wilson Date: Tue, 18 Jun 2002 21:18:46 +0000 (+0000) Subject: xtensa.h (FUNCTION_PROFILER): Respect flag_pic when generating the call to _mcount. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5ee924c2fb39b7702b9ed586df9b613ca7401ea3;p=gcc.git 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 --- 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 + + * config/xtensa/xtensa.h (FUNCTION_PROFILER): Respect flag_pic + when generating the call to _mcount. + (NO_PROFILE_COUNTERS): Define. + 2002-06-18 Richard Henderson * 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