This is the mail archive of the
mailing list for the GCC project.
Re: [RFC Patch, Aarch64] : Macros for profile code generation to enable gprof support
- From: Marcus Shawcroft <marcus dot shawcroft at arm dot com>
- To: Venkataramanan Kumar <venkataramanan dot kumar at linaro dot org>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 09 Aug 2013 18:17:23 +0100
- Subject: Re: [RFC Patch, Aarch64] : Macros for profile code generation to enable gprof support
- References: <CAJK_mQ0JTvCFX+XBKQrWaH_prOkW_zCpG=g5noFvQp2rkFPnFA at mail dot gmail dot com>
On 03/08/13 19:01, Venkataramanan Kumar wrote:
2013-08-02 Venkataramanan Kumar <email@example.com>
* config/aarch64/aarch64.h (MCOUNT_NAME): Define.
* config/aarch64/aarch64.c (aarch64_function_profiler): Remove.
Looking at the various other ports it looks that the majority choose to
use FUNCTION_PROFILER_HOOK rather than PROFILE_HOOK.
Using PROFILE_HOOK to inject a regular call to to _mcount() means that
all arguments passed in registers in every function will be spilled and
reloaded because the _mcount call will kill the caller save registers.
Using the FUNCTION_PROFILER_HOOK and taking care not to kill the caller
save registers would be less invasive. The LR argument to _mcount would
need to be passed in a temporary register, say x9 and _mcount would also
need to ensure caller save registers are saved and restored.
The latter seems to be a better option to me, is there compelling reason
to choose PROFILE_HOOK over FUNCTION_PROFILER_HOOK ??