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? -Dave
On Tuesday 04 March 2008 12:16, Chris Lattner wrote:> > 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?I don't need it in the allocator. I need it in Fernando's spiller that prints the IR used by the debugger. The IR includes references to the stack pointer. I need to add some sMira IR instructions at the top of the function to define the stack pointer (and other things) so it isn't flagged as undefined by the debugger. I suppose we could change Fernando's IR so it works with abstract stack indices but there are other times I've wanted to know the stack pointer as well, especially when dumping debug info. -Dave
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/