gccint: Profiling
1
1 18.9.12 Generating Code for Profiling
1 -------------------------------------
1
1 These macros will help you generate code for profiling.
1
1 -- Macro: FUNCTION_PROFILER (FILE, LABELNO)
1 A C statement or compound statement to output to FILE some
1 assembler code to call the profiling subroutine 'mcount'.
1
1 The details of how 'mcount' expects to be called are determined by
1 your operating system environment, not by GCC. To figure them out,
1 compile a small program for profiling using the system's installed
1 C compiler and look at the assembler code that results.
1
1 Older implementations of 'mcount' expect the address of a counter
1 variable to be loaded into some register. The name of this
1 variable is 'LP' followed by the number LABELNO, so you would
1 generate the name using 'LP%d' in a 'fprintf'.
1
1 -- Macro: PROFILE_HOOK
1 A C statement or compound statement to output to FILE some assembly
1 code to call the profiling subroutine 'mcount' even the target does
1 not support profiling.
1
1 -- Macro: NO_PROFILE_COUNTERS
1 Define this macro to be an expression with a nonzero value if the
1 'mcount' subroutine on your system does not need a counter variable
1 allocated for each function. This is true for almost all modern
1 implementations. If you define this macro, you must not use the
1 LABELNO argument to 'FUNCTION_PROFILER'.
1
1 -- Macro: PROFILE_BEFORE_PROLOGUE
1 Define this macro if the code for function profiling should come
1 before the function prologue. Normally, the profiling code comes
1 after.
1
1 -- Target Hook: bool TARGET_KEEP_LEAF_WHEN_PROFILED (void)
1 This target hook returns true if the target wants the leaf flag for
1 the current function to stay true even if it calls mcount. This
1 might make sense for targets using the leaf flag only to determine
1 whether a stack frame needs to be generated or not and for which
1 the call to mcount is generated before the function prologue.
1