[LLVMdev] X86 Frame info question

Vladimir Prus ghost at cs.msu.su
Wed Jun 9 02:56:01 PDT 2004


Chris Lattner wrote:

> > It look like prolog/epilog generator (PEI::calculateFrameObjectOffsets)
> > assumes local area offset is offset in the stack growth direction. For
> > example, if there are 2 4-byte object, it will start with "Offset" of 4
> > and then go to "Offset" of 8... the actuall offsets set to stack objects
> > will be -Offset -- in this case -4 and -8. So, it really looks like local
> > stack offset is specified in the direction of stack grows.
>
> That sounds right.  Immediately on entry to the function, ESP points to
> the return address of the call.  ESP-4 is the start of the first object,
> ESP-8 is the start of the second, etc.  Note that the TargetFrameInfo
> keeps track of stuff *before* the prolog is emitted (as it doesn't know
> what flavor of prolog will be output, that is up to the target and can
> depend on properties of the function being compiled).

Yes, I understand this (more or less ;-) )

> > Is this so? Would you prefer if I change the docs to reflect this, or
> > change the code so that LAO is specified independently of the stack
> > growth direction? I think the latter aproach is more clean...
>
> I think that making LAO -4 on the X86 would be fine, especially if it
> makes the stack growth up/down case more consistent with each other.  :)

Ok, I'm hacking on this right now. Expect a patch in a couple of hours....

Thanks,
Volodya





More information about the llvm-dev mailing list