[llvm] r222790 - Go bindings: add DIBuilder.InsertValueAtEnd
Peter Collingbourne
peter at pcc.me.uk
Tue Nov 25 13:05:04 PST 2014
Author: pcc
Date: Tue Nov 25 15:05:04 2014
New Revision: 222790
URL: http://llvm.org/viewvc/llvm-project?rev=222790&view=rev
Log:
Go bindings: add DIBuilder.InsertValueAtEnd
Expose llvm::DIBuilder::insertDbgValueIntrinsic as
DIBuilder.InsertValueAtEnd in the Go bindings, to support attaching
debug metadata to register values.
Patch by Andrew Wilkins!
Differential Revision: http://reviews.llvm.org/D6374
Modified:
llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp
llvm/trunk/bindings/go/llvm/DIBuilderBindings.h
llvm/trunk/bindings/go/llvm/dibuilder.go
Modified: llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp?rev=222790&r1=222789&r2=222790&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp (original)
+++ llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp Tue Nov 25 15:05:04 2014
@@ -19,8 +19,7 @@
using namespace llvm;
namespace {
-template <typename T>
-T unwrapDI(LLVMValueRef v) {
+template <typename T> T unwrapDI(LLVMValueRef v) {
return v ? T(unwrap<MDNode>(v)) : T();
}
}
@@ -220,3 +219,15 @@ LLVMValueRef LLVMDIBuilderInsertDeclareA
unwrapDI<DIExpression>(Expr), unwrap(Block));
return wrap(Instr);
}
+
+LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef Dref,
+ LLVMValueRef Val, uint64_t Offset,
+ LLVMValueRef VarInfo,
+ LLVMValueRef Expr,
+ LLVMBasicBlockRef Block) {
+ DIBuilder *D = unwrap(Dref);
+ Instruction *Instr = D->insertDbgValueIntrinsic(
+ unwrap(Val), Offset, unwrapDI<DIVariable>(VarInfo),
+ unwrapDI<DIExpression>(Expr), unwrap(Block));
+ return wrap(Instr);
+}
Modified: llvm/trunk/bindings/go/llvm/DIBuilderBindings.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/DIBuilderBindings.h?rev=222790&r1=222789&r2=222790&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/DIBuilderBindings.h (original)
+++ llvm/trunk/bindings/go/llvm/DIBuilderBindings.h Tue Nov 25 15:05:04 2014
@@ -116,6 +116,13 @@ LLVMValueRef LLVMDIBuilderInsertDeclareA
LLVMValueRef Expr,
LLVMBasicBlockRef Block);
+LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef D,
+ LLVMValueRef Val,
+ uint64_t Offset,
+ LLVMValueRef VarInfo,
+ LLVMValueRef Expr,
+ LLVMBasicBlockRef Block);
+
#ifdef __cplusplus
} // extern "C"
#endif
Modified: llvm/trunk/bindings/go/llvm/dibuilder.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/dibuilder.go?rev=222790&r1=222789&r2=222790&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/dibuilder.go (original)
+++ llvm/trunk/bindings/go/llvm/dibuilder.go Tue Nov 25 15:05:04 2014
@@ -484,6 +484,13 @@ func (d *DIBuilder) InsertDeclareAtEnd(v
return Value{C: result}
}
+// InsertValueAtEnd inserts a call to llvm.dbg.value at the end of the
+// specified basic block for the given value and associated debug metadata.
+func (d *DIBuilder) InsertValueAtEnd(v, diVarInfo, expr Value, offset uint64, bb BasicBlock) Value {
+ result := C.LLVMDIBuilderInsertValueAtEnd(d.ref, v.C, C.uint64_t(offset), diVarInfo.C, expr.C, bb.C)
+ return Value{C: result}
+}
+
func boolToCInt(v bool) C.int {
if v {
return 1
More information about the llvm-commits
mailing list