[LLVMdev] X86 Frame info question

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


The X86 backend has this code:

   X86TargetMachine::X86TargetMachine(const Module &M, IntrinsicLowering *IL)
     :  ....
         FrameInfo(TargetFrameInfo::StackGrowsDown, 8/*16 for SSE*/, 4),

That is, it uses "4" as local area offset. Based on prior discussion this 
should mean that the local area starts and address ESP+4. Is this really 
true? On X86 stack grows down, so I'd expect local area to start below ESP, 
e.g. at ESP - 4, and ESP + 4 would contains function arguments.

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.

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

- Volodya




More information about the llvm-dev mailing list