This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [semi PATCH] ARM/Thumb branches out of range for MI thunks
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: Richard dot Earnshaw at arm dot com, Phil Edwards <phil at codesourcery dot com>,gcc-patches at gcc dot gnu dot org, rearnsha at arm dot com
- Date: Fri, 24 Oct 2003 14:03:13 -0400
- Subject: Re: [semi PATCH] ARM/Thumb branches out of range for MI thunks
- References: <200310240831.h9O8Vs221975@pc960.cambridge.arm.com> <87y8vabmnc.fsf@egil.codesourcery.com>
On Fri, Oct 24, 2003 at 09:55:51AM -0700, Zack Weinberg wrote:
> Richard Earnshaw <rearnsha@arm.com> writes:
>
> > Yes. Output the Thunk in ARM code (seriously, this is one of those cases
> > where you get better code density in ARM state than you can in Thumb).
> > But to do that, the C++ front end needs fixing so that we can get hold of
> > the thunk properly in the back end and control how it outputs the thunk
> > definition.
> >
> > I've posted on this before.
>
> I've read old postings of yours that I can find -
>
> http://gcc.gnu.org/ml/gcc/2002-06/msg01598.html
> http://gcc.gnu.org/ml/gcc-patches/2002-07/msg00769.html
> http://gcc.gnu.org/ml/gcc-patches/2003-07/msg01703.html
>
> It sounds like the problem is that "this is a thunk" is a concept only
> visible within the C++ front end, whereas it needs to be language-
> independent. That ought to be a feasible change to make, if we can
> agree on what "this is a thunk" means.
>
> I am not sure if the present state of thunk generation is better or
> worse than it was at the time you posted these messages.
>
> What is the cost of an arm/thumb mode switch, compared to the extra
> cycles required to execute a purely Thumb thunk?
The cost of a Thumb->arm switch is just the cost of a branch - none of
the ARM cores I'm familiar with take an extra hit on switching. Three
cycles on arm9tdmi which is what I have the manual open for. It's
just a "bx pc; nop" switch although it also means you need to make an
interworking branch to whatever you're thunking.
The same thing applied to PLT entries - you take more delays in trying
to make it work in Thumb than you do in switching.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer