[LLVMdev] Expected behavior of eliminateFrameIndex() on dbg_value machine instructions

Richard Osborne richard at xmos.com
Mon Oct 10 10:26:05 PDT 2011

I'm investigating a bug associated with debug information that manifests 
itself in the XCore backend (PR11105). I'd like to understand what the 
expected behavior of eliminateFrameIndex() is when it is called on a 
dbg_value machine instruction.

Currently the XCore target replaces the frame index with the frame 
register and sets the next operand to the byte offset from the frame 
register. A quick glance at some of the other targets suggests this is 
the right thing to do (for example 
ARMBaseRegisterInfo::eliminateFrameIndex and 
Thumb1RegisterInfo::eliminateFrameIndex appear to handle dbg_value in 
exactly the same way).

Unfortunately this results in an assertion firing in 
MachineFrameInfo::getObjectOffset(). This is due to 
CompileUnit::constructVariableDIE() passing the second operand of the 
dbg_value instruction (set to the byte offset) to 
getFrameIndexReference() which expects a frame index as an argument.

Am I doing something wrong in eliminateFrameIndex()? Is this a bug in 
CompileUnit::constructVariableDIE()? Is there something else I'm missing?



Richard Osborne | XMOS

More information about the llvm-dev mailing list