This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RETURN_ADDRESS_POINTER_REGNUM Macro
- From: Jim Wilson <jim dot wilson at linaro dot org>
- To: Ajit Kumar Agarwal <ajit dot kumar dot agarwal at xilinx dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Cc: Vinod Kathail <vinodk at xilinx dot com>, Shail Aditya Gupta <shailadi at xilinx dot com>, Vidhumouli Hunsigida <vidhum at xilinx dot com>, Nagaraju Mekala <nmekala at xilinx dot com>
- Date: Fri, 24 Jul 2015 11:09:45 -0700
- Subject: Re: RETURN_ADDRESS_POINTER_REGNUM Macro
- Authentication-results: sourceware.org; auth=none
- References: <37378DC5BCD0EE48BA4B082E0B55DFAA41F4AD87 at XAP-PVEXMBX02 dot xlnx dot xilinx dot com>
On 07/23/2015 11:09 PM, Ajit Kumar Agarwal wrote:
> From the description of the definition of the macro RETURN_ADDRESS_POINTER_REGNUM ,
> Does this impact the performance or correctness of the compiler? On what cases it is applicable to define for the given architecture?
This is used to help implement the __builtin_return_address builtin
function. There is some default code for this, so it may work OK
without defining RETURN_ADDRESS_POINTER_REGNUM. If the default code
doesn't work, then you may need to define RETURN_ADDRESS_POINTER_REGNUM.
Usually, it is trivial to make __builtin_return_address work for leaf
functions, non-trivial to make it work for non-leaf functions, and
difficult to impossible to make it work for level != 0. You will have
better luck using the unwind info than __builtin_return_address.
This is an optional builtin function, so there is no performance or
correctness issue here.
Jim