[LLVMdev] Getting the Stack Pointer

Chris Lattner sabre at nondot.org
Tue Mar 4 10:16:38 PST 2008


On Tue, 4 Mar 2008, David Greene wrote:
> What's the "right" way to find out which machine register acts as the
> stack pointer?  I'm working on enhancing Fernando's register allocator
> debugger and would like to add support for stack pointer semantics.
>
> TargetRegisterInfo has a getFrameRegister method but that returns
> (on x86) either ESP/RSP or EBP/RBP depending on whether frame
> pointer elimination has been done.
>
> Would it be ok to add a getStackPointerRegister method to TargetRegisterInfo?

Why do you need to do this in a register allocator?  Typically you want to 
refer to abstract frame indices.  Wouldn't fernando's debugger use a 
similar representation?

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list