This is the mail archive of the 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: [discuss] When is RBX used for base pointer?

> > Hi,
>  >
>  > On Wed, 13 Feb 2008, H.J. Lu wrote:
>  >
>  > > We need a callee-saved register for stack alignment.
>  >
>  > Can you expand on why?
>  >
>  > > In 64bit, our choices are rbx, and r12-r15. r12-r15 need the REX byte
>  > > and r12 also needs the SIB byte. So I'd like to use rbx. x86-64 psABI
>  > > says rbx is callee-saved and optionally used as base pointer. However, I
>  > > couldn't find an example where rbx is used as base pointer. Is this a
>  > > carryover from i386 psABI where ebx is used to hold GOT?
>  >
>  > In the large memory model you need a base pointer for the GOT.  Of course
>  > we could do the same as in recent i386 and chose an arbitrary register as
>  > GOT pointer.
>  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.



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