This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch for -mcaller-super-interworking & stack arguments


Richard Earnshaw <rearnsha@gcc.gnu.org> writes:
>> The point is that gcc only treats r11 as call-saved in ARM mode because
>> it is the hard frame pointer.  In thumb mode it's just any old register.
>
> No, even in Thumb mode it's call-saved (ie the value on return from a
> call is the same as then value on calling).

Yes I know, and the whole point is how we tell gcc that.  But..

>> Thus if you set:
>> 
>>     fixed_regs[11] = call_used_regs[11] = 1
>> 
>> then gcc will believe what you say about call_used_regs[].
>> 
>
> Gcc will never allocate variables to a register with 
> 	f_r = c_u_r = 1
>
> A register is ONLY call-clobbered if F_R = 0, C_U_R =1.

...my understanding has always been that this is false.  See e.g. how
reg_invalidated_by_call is initialised in regclass.c:init_reg_sets_1().
Certain registers (like the hard frame pointer, as I say) are known not
be invalidated by a call.  But there's no opt-out for all fixed registers.
After all, some targets _do_ have call-clobbered fixed registers.

So what I'm trying to say is that:

      call_used_regs[11] = 1

is OK in ARM mode, because gcc knows that the hard frame pointer is special.
But if we do the same thing in thumb mode, where r11 doesn't correspond to
anything special, then r11 really is treated as call-clobbered.

Traditionally, gcc has required all fixed_regs[] to be call_used_regs[]
as well.  The point of CALL_REALLY_USED_REGISTERS was to say "this
register is fixed but not call clobbered".

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]