This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: No tail call optimization in Thumb mode?
- From: Richard Earnshaw <rearnsha at gcc dot gnu dot org>
- To: Kazu Hirata <kazu at codesourcery dot com>
- Cc: gcc at gcc dot gnu dot org, nickc at redhat dot com, Paul Brook <paul at codesourcery dot com>
- Date: Tue, 28 Jun 2005 10:48:19 +0100
- Subject: Re: No tail call optimization in Thumb mode?
- References: <200506240615.j5O6FXvg019646@sethra.codesourcery.com>
On Fri, 2005-06-24 at 07:15, Kazu Hirata wrote:
> Hi,
>
> Why is tail call optimization for Thumb disabled on GCC? I am
> wondering if this is a TODO item or something that we cannot do
> intrinsically.
>
> "The ARM-THUMB Procedure Call Standard" says "No tail continuation in
> Thumb-state" several times in its figures and measurements, but the
> document doesn't explicitly forbid tail call optimization for Thumb.
>
There's no prohibition on it, but the thumb-1 branch instruction has a
range of only +/- 2kB (which is too small to reach an arbitrary target
address in an image) and we currently don't support tail-calls via a
register for either ARM or Thumb state.
If we *knew* that the target address would be reachable, then we could
probably use a tail-call, but in practice I don't think we can.
R.