[LLVMdev] A question about DBG_VALUE and Frame Index

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Mar 8 08:58:10 PST 2012


On Mar 7, 2012, at 5:19 PM, Pranav Bhandarkar <pranavb at codeaurora.org> wrote:

> Hi,
> 
> I have a case that is causing me grief in the form of an assert. The prolog
> Epilog inserter tries to remove Frame Index references. I have a DBG_VALUE
> instruction that looks like this (alongwith the Frame Index). This is for
> the Hexagon backend.
> **************************
> fi#2: size=4, align=4, at location [SP-84]
> DBG_VALUE <fi#2>, 0, !"fooBar"; line no:299
> **************************
> 
> Clearly, the FI in question is at an offset of -84 from the SP at entry to
> the function i.e. FP - 84. So I remove the FI by changing the instruction
> to.
> **************************
> DBG_VALUE %R30, -84, !"fooBar"; line no:299
> **************************
> (R30 is the frame pointer register in Hexagon.)

The offset field on a DBG_VALUE instruction refers to the user variable, not the first register argument.

Your DBG_VALUE above is saying that fooBar[-84] can be found in %R30.

You want something like:

  DBG_VALUE %R30, -84, 0, !"fooBar"

That is a target-dependent DBG_VALUE, you will need to implement the target hooks to create and parse it. Target-dependent DBG_VALUE instrs are recognized by having more than 3 operands.

/jakob




More information about the llvm-dev mailing list