[llvm-commits] [llvm] r90788 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h include/llvm/IntrinsicInst.h include/llvm/Intrinsics.td lib/Analysis/DebugInfo.cpp

Chris Lattner clattner at apple.com
Fri Jan 8 23:25:38 PST 2010


On Dec 7, 2009, at 11:36 AM, Victor Hernandez wrote:
> Date: Mon Dec  7 13:36:34 2009
> New Revision: 90788
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=90788&view=rev
> Log:
> Introduce the "@llvm.dbg.value" debug intrinsic.
> 
> The semantics of llvm.dbg.value are that starting from where it is executed, an offset into the specified user source variable is specified to get a new value.
> 
> An example:
>  call void @llvm.dbg.value(metadata !{ i32 7 }, i64 0, metadata !2)
> Here the user source variable associated with metadata #2 gets the value "i32 7" at offset 0.

Hi Victor,

Sorry just getting to this old patch.  First comment is that you need to document this intrinsic in the debug info doc, presumably right after llvm.declare:
http://llvm.org/docs/SourceLevelDebugging.html#format_common_intrinsics


> +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Dec  7 13:36:34 2009
> @@ -639,6 +640,13 @@
>     Instruction *InsertDeclare(llvm::Value *Storage, DIVariable D,
>                                Instruction *InsertBefore);
> 
> +    /// InsertValue - Insert a new llvm.dbg.value intrinsic call.
> +    Instruction *InsertValue(llvm::Value *V, llvm::Value *Offset,
> +                             DIVariable D, BasicBlock *InsertAtEnd);
> +
> +    /// InsertValue - Insert a new llvm.dbg.value intrinsic call.
> +    Instruction *InsertValue(llvm::Value *V, llvm::Value *Offset,
> +                             DIVariable D, Instruction *InsertBefore);

Thank you for renaming these to InsertDbgValueIntrinsic as Devang suggested.  Also, please change the 'Offset' argument to be a uint64_t instead of Value*.  It is not allowed to be a variable.

> +++ llvm/trunk/include/llvm/IntrinsicInst.h Mon Dec  7 13:36:34 2009
> @@ -171,6 +172,25 @@
>     }
>   };
> 
> +  /// DbgValueInst - This represents the llvm.dbg.value instruction.
> +  ///
> +  struct DbgValueInst : public DbgInfoIntrinsic {
> +    Value *getValue()  const {
> +      return cast<MDNode>(getOperand(1))->getElement(0);
> +    }
> +    Value *getOffset() const { return getOperand(2); }

This should return the offset as a uint64_t instead of a Value*.

> +    MDNode *getVariable() const { return cast<MDNode>(getOperand(3)); }

This should be two methods to get the constness right:
> +    const MDNode *getVariable() const { return cast<MDNode>(getOperand(3)); }
> +    MDNode *getVariable() { return cast<MDNode>(getOperand(3)); }

Likewise for getValue().

-Chris



More information about the llvm-commits mailing list