On Wed, 13 Feb 2008, H.J. Lu wrote:
>>  Recent i386 use arbitrary register as GOT pointer only for leaf
>>  function.  When you call something, the GOT entry uses EBX too.
>>  We use RBX for large PIC model.  But I am with Michael here that I
don't
>>  see reason why choice of register needs to be set in stone.
>>  We can probably use RBX for non-large-PIC and R12 elsewhere.

> Joey ran into issues when he didn't use a hard register to realign
stack.
> It has something to do with reload. We really need some help here with
> reload.  Joey can explain it when he comes from vacation next week.

Michael, Jan,

When aligning stack for those functions who have dynamic stack
allocation, we must use an available callee-saved register in prologue.
We named this hard register DRAP. It is worthwhile to emphasize that
*free* here means "free in prologue". After prologue, a virtual register
will be used instead.

Given the definition of free, we can fix the DRAP register to simplify
the implementation. Original GCC only have limited cases that use
callee-saved register in prologue, such as setting GOT pointer as far as
I know. So choosing the DRAP register is easy: just avoid GOT pointer
register, which is EBX in i386 and RBX in x86_64. As HJ said, R12 is a
good candiate.

It will be more complicated if GOT pointer register is not fixed. In
this case, the DRAP candidate must be avoid using GOT register, or vice
versa. When will current GCC decide the register to use as GOT pointer?

Thanks - Joey

Reply via email to