final.c: Move the declaration profile_label_no to ...

* final.c: Move the declaration profile_label_no to ...
        * output.h: ... here.
        * function.c (expand_function_start): Call PROFILE_HOOK.
        * config/rs6000/aix.h: Define PROFILE_HOOK.
        * config/rs6000/rs6000-protos.h: output_profile_hook new.
        * config/rs6000/rs6000.c (output_profile_hook): Define.
        (output_prolog): Do nothing for ABI_AIX as it is taken care by
        output_profile_hook.
        tm.texi : Explain new macro PROFILE_HOOK.

From-SVN: r39473
This commit is contained in:
Chandrakala Chavva 2001-02-05 20:23:13 -05:00 committed by Chandra Chavva
parent 8720914be3
commit 411707f4e4
8 changed files with 56 additions and 57 deletions

View File

@ -1,3 +1,15 @@
2001-02-05 Chandrakala Chavva <cchavva@redhat.com>
* final.c: Move the declaration profile_label_no to ...
* output.h: ... here.
* function.c (expand_function_start): Call PROFILE_HOOK.
* config/rs6000/aix.h: Define PROFILE_HOOK.
* config/rs6000/rs6000-protos.h: output_profile_hook new.
* config/rs6000/rs6000.c (output_profile_hook): Define.
(output_prolog): Do nothing for ABI_AIX as it is taken care by
output_profile_hook.
tm.texi : Explain new macro PROFILE_HOOK.
2001-02-06 Hans-Peter Nilsson <hp@axis.com>
* extend.texi (Extended Asm): Do not say that semicolon is always

View File

@ -635,3 +635,4 @@ toc_section () \
So we have to squirrel it away with this. */
#define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init ()
#define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)

View File

@ -157,6 +157,7 @@ extern void output_ascii PARAMS ((FILE *, const char *, int));
extern void rs6000_gen_section_name PARAMS ((char **, const char *,
const char *));
extern void output_function_profiler PARAMS ((FILE *, int));
extern void output_profile_hook PARAMS ((int));
extern int rs6000_trampoline_size PARAMS ((void));
extern void toc_section PARAMS ((void));
extern void sdata_section PARAMS ((void));

View File

@ -7080,6 +7080,32 @@ rs6000_gen_section_name (buf, filename, section_desc)
*p = '\0';
}
/* Emit profile function. */
void
output_profile_hook (labelno)
int labelno;
{
if (profile_flag && DEFAULT_ABI == ABI_AIX)
{
char *buf;
int length = 0;
rtx fun;
labelno += 1;
buf = permalloc (labelno+6);
ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
fun = gen_rtx_SYMBOL_REF (Pmode, buf+1);
emit_library_call (init_one_libfunc (RS6000_MCOUNT), 0, VOIDmode, 1,
fun, Pmode, Pmode);
}
}
/* Write function profiler code. */
void
@ -7148,60 +7174,9 @@ output_function_profiler (file, labelno)
break;
case ABI_AIX:
/* Set up a TOC entry for the profiler label. */
toc_section ();
ASM_OUTPUT_INTERNAL_LABEL (file, "LPC", labelno);
if (TARGET_MINIMAL_TOC)
{
fputs (TARGET_32BIT ? "\t.long " : "\t.llong ", file);
assemble_name (file, buf);
putc ('\n', file);
}
else
{
fputs ("\t.tc\t", file);
assemble_name (file, buf);
fputs ("[TC],", file);
assemble_name (file, buf);
putc ('\n', file);
}
text_section ();
/* Figure out last used parameter register. The proper thing to do is
to walk incoming args of the function. A function might have live
parameter registers even if it has no incoming args. */
for (last_parm_reg = 10;
last_parm_reg > 2 && ! regs_ever_live [last_parm_reg];
last_parm_reg--)
;
/* Save parameter registers in regs 23-30 and static chain in r22.
Don't overwrite reg 31, since it might be set up as the frame pointer. */
for (i = 3, j = 30; i <= last_parm_reg; i++, j--)
asm_fprintf (file, "\tmr %d,%d\n", j, i);
if (current_function_needs_context)
asm_fprintf (file, "\tmr %d,%d\n", j, STATIC_CHAIN_REGNUM);
/* Load location address into r3, and call mcount. */
ASM_GENERATE_INTERNAL_LABEL (buf, "LPC", labelno);
asm_fprintf (file, TARGET_32BIT ? "\t{l|lwz} %s," : "\tld %s,",
reg_names[3]);
assemble_name (file, buf);
asm_fprintf (file, "(%s)\n\tbl %s\n\t", reg_names[2], RS6000_MCOUNT);
asm_fprintf (file, RS6000_CALL_GLUE);
putc('\n', file);
/* Restore parameter registers and static chain. */
for (i = 3, j = 30; i <= last_parm_reg; i++, j--)
asm_fprintf (file, "\tmr %d,%d\n", i, j);
if (current_function_needs_context)
asm_fprintf (file, "\tmr %d,%d\n", STATIC_CHAIN_REGNUM, j);
/* Don't do anything, done in output_profile_hook (). */
break;
}
}

View File

@ -205,10 +205,6 @@ char regs_ever_live[FIRST_PSEUDO_REGISTER];
int frame_pointer_needed;
/* Assign unique numbers to labels generated for profiling. */
int profile_label_no;
/* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen. */
static int block_depth;

View File

@ -6471,6 +6471,11 @@ expand_function_start (subr, parms_have_cleanups)
Pmode);
}
#ifdef PROFILE_HOOK
if (profile_flag)
PROFILE_HOOK (profile_label_no);
#endif
/* After the display initializations is where the tail-recursion label
should go, if we end up needing one. Ensure we have a NOTE here
since some things (like trampolines) get placed before this. */

View File

@ -457,3 +457,6 @@ extern const char *user_label_prefix;
#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
(VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'))
#endif
/* Assign unique numbers to labels generated for profiling. */
int profile_label_no;

View File

@ -3677,6 +3677,12 @@ variable to be loaded into some register. The name of this variable is
@samp{LP} followed by the number @var{labelno}, so you would generate
the name using @samp{LP%d} in a @code{fprintf}.
@findex PROFILE_HOOK
@item PROFILE_HOOK
A C statement or compound statement to output to @var{file} some assembly
code to call the profiling subroutine @code{mcount} even the target does
not support profiling.
@findex NO_PROFILE_COUNTERS
@item NO_PROFILE_COUNTERS
Define this macro if the @code{mcount} subroutine on your system does