summaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-11-25 21:05:04 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-11-25 21:05:04 +0000
commit5a4bf227a915525912f8cfdb28270746678591d9 (patch)
tree206d4768656c4813c3c386543df4d3f2031f1e9f /bindings
parentc9d99b504d9dabab373a6f419b413387f572cd11 (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222790 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r--bindings/go/llvm/DIBuilderBindings.cpp15
-rw-r--r--bindings/go/llvm/DIBuilderBindings.h7
-rw-r--r--bindings/go/llvm/dibuilder.go7
3 files changed, 27 insertions, 2 deletions
diff --git a/bindings/go/llvm/DIBuilderBindings.cpp b/bindings/go/llvm/DIBuilderBindings.cpp
index 94fa96f20e3..cb7ac8ddd9c 100644
--- a/bindings/go/llvm/DIBuilderBindings.cpp
+++ b/bindings/go/llvm/DIBuilderBindings.cpp
@@ -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 LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Dref,
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);
+}
diff --git a/bindings/go/llvm/DIBuilderBindings.h b/bindings/go/llvm/DIBuilderBindings.h
index e6fe02a9387..4df79108c6b 100644
--- a/bindings/go/llvm/DIBuilderBindings.h
+++ b/bindings/go/llvm/DIBuilderBindings.h
@@ -116,6 +116,13 @@ LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef D,
LLVMValueRef Expr,
LLVMBasicBlockRef Block);
+LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef D,
+ LLVMValueRef Val,
+ uint64_t Offset,
+ LLVMValueRef VarInfo,
+ LLVMValueRef Expr,
+ LLVMBasicBlockRef Block);
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/bindings/go/llvm/dibuilder.go b/bindings/go/llvm/dibuilder.go
index 1d07e98c839..bcbea93a44e 100644
--- a/bindings/go/llvm/dibuilder.go
+++ b/bindings/go/llvm/dibuilder.go
@@ -484,6 +484,13 @@ func (d *DIBuilder) InsertDeclareAtEnd(v, diVarInfo, expr Value, bb BasicBlock)
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