This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: alpha return address patch


	This properly implements REUTRN_ADDR_RTX.  It does it in a way
	I don't like -- via elimination to the stack -- to coddle to the
	needs of the current -fno-sjlj-exceptions code.

There is a minor problem with this patch.  You are setting a global variable
alpha_function_save_ra during rtl generation, using it after optimization, and
then clearing it at the end of output_epilog.  This assumes that these 3
things always occur in sequence.  This is not true.  Consider the case
of a nested function.  In the middle of rtl generation, we will push the
current function's context, and compile the nested function.  This will
cause output_epilog to be called, clearing alpha_function_save_ra.  Then
we pop to the parent function's context, and now we get incorrect code because
the value of alpha_function_save_ra has been clobbered.  The C++ front end
uses this same function context pushing/poping code in the template
instantiation support, so I suspect that this could cause failures for C++
code even if though the C++ front end doesn't support nested functions.

This can be fixed by creating a new current_function_* variable in function.c
and adding code to save/restore it in push_function_context_{to,from}.

Alternatively, this can be fixed by writing an alpha specific 
{save,restore}_machine_status functions to save/restore this global variable
that you have created.

Alternatively, find someway to do this without using a global variable.
I believe it is safe to assume that builtin_return_address will never be
used in a leaf function, because of the way that the old exception handling
code works.  It always emits at least one call to a libgcc2.c function.
Hence it may be that this code to force $ra to be saved is unnecessary,
because we can define it to only work in non-leaf functions.  The MIPS port
for instance does this.  This isn't very elegant though.

Jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]