This is the mail archive of the
mailing list for the GCC project.
Re: The default -mpic-register for -mthumb
On Mon, 2006-06-26 at 17:48, Shaun Jackman wrote:
> The default -mpic-register (on ARM/Thumb) is r10. In -mthumb mode, r10
> is not available to the math instructions as a direct argument. On top
> of that, preserving r10 complicates the function prologue. Does it
> make more sense to use a directly accessible register, r7 for example,
> as the default -mpic-register when in -mthumb mode? Can a
> non-preserved register, such as r3, be used instead? (assuming the
> compiler saves the function argument in r3 somewhere)
> Why is the PIC register fixed? Could the compiler register allocation
> logic be allowed to allocate the _GLOBAL_OFFSET_TABLE_ pointer the
> same as any other variable? In which case it would probably realise
> cost(r3) < cost(r7) < cost(r10)
> at least in the case where r3 isn't being used by a function argument.
As of gcc-4.2 it isn't fixed, it's just like any other pseudo generated
by the compiler.