Hi,
> 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.

I am bit confused here.  If I wanted a free register in prologue only, I
would probably look at the caller saved ones.  But I gues it is just
typo.

I don't see much value in making the register callee-saved especially if
you say that virtual reg (pseudo?) is used afterward.
> 
> 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.

When you just need a temporary in prologue, I think you can go with RAX
in most cases getting shortest code. It is used by x86-64 stdargs
prologue and by i386 regparm. You can improve bit broken
ix86_eax_live_at_start_p to test this. Using alternative choice if RAX
is taken.
> 
> 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?

See ix86_select_alt_pic_regnum it is done in prologue too.

There are few cases 64bit prologues needs temporary already.  (when
stack frame is gigantic).  I never attempted to optimize those at all,
but if you will have more cureful way of chosing temporary around, you
might consider looking for cases R11_REG is used and update them.

Honza
> 
> Thanks - Joey

Reply via email to