No tail call optimization in Thumb mode?
Richard Earnshaw
rearnsha@gcc.gnu.org
Tue Jun 28 09:48:00 GMT 2005
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.
More information about the Gcc
mailing list