This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch ARM] Turn on sibling calls for Thumb2.
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, gcc-patches at gcc dot gnu dot org, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Mark Mitchell <mark at codesourcery dot com>
- Date: Wed, 20 May 2009 08:44:11 -0700
- Subject: Re: [Patch ARM] Turn on sibling calls for Thumb2.
- References: <001401c9d928$fd14ae40$f73e0ac0$@radhakrishnan@arm.com> <20090520143741.GA7619@caradoc.them.org>
Daniel Jacobowitz wrote:
> FYI, Mark Mitchell tested an internal patch to do this last year, and
> discovered it broke early returns from functions that end in a tail
> call. It was something to do with USE_RETURN_INSN, but we didn't
> get to the bottom of it at the time.
My notes say this:
> Unfortunately, the sibcall experiment failed. The problem that occurs
> is that in a function that uses sibcalls, we don't generate proper
> return instructions elsewhere. That's apparently because of:
>
> ;; Often the return insn will be the same as loading from memory, so set
> (define_insn "return"
> [(return)]
> "TARGET_ARM && USE_RETURN_INSN (FALSE)"
> "*
>
> and:
>
> /* Determine if the epilogue should be output as RTL.
>
> You should override this if you define FUNCTION_EXTRA_EPILOGUE. */
> /* This is disabled for Thumb-2 because it will confuse the
>
> conditional insn counter. */
> #define USE_RETURN_INSN(ISCOND) \
> (TARGET_ARM ? use_return_insn (ISCOND, NULL) : 0)
My conclusion was that to fix this, we would need to first fix Thumb-2
to use RTL epilogues. Which would certainly be a good thing.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713