[PATCH] D52972: [bindings/go] Add Go bindings for CalledValue

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 7 16:41:59 PDT 2018


aykevl created this revision.
aykevl added reviewers: whitequark, pcc.
Herald added a subscriber: llvm-commits.

This is very useful for inspecting generated IR, there appears to be no other way to get the called function from a CallInst.


Repository:
  rL LLVM

https://reviews.llvm.org/D52972

Files:
  bindings/go/llvm/ir.go


Index: bindings/go/llvm/ir.go
===================================================================
--- bindings/go/llvm/ir.go
+++ bindings/go/llvm/ir.go
@@ -1229,6 +1229,10 @@
 func (v Value) SetInstrParamAlignment(i int, align int) {
 	C.LLVMSetInstrParamAlignment(v.C, C.unsigned(i), C.unsigned(align))
 }
+func (v Value) CalledValue() (rv Value) {
+	rv.C = C.LLVMGetCalledValue(v.C)
+	return
+}
 
 // Operations on call instructions (only)
 func (v Value) IsTailCall() bool    { return C.LLVMIsTailCall(v.C) != 0 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52972.168600.patch
Type: text/x-patch
Size: 517 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181007/7d869e0f/attachment.bin>


More information about the llvm-commits mailing list