From ac449df582e991e921ee17643b5904aca34159d2 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sat, 8 Jun 2019 22:08:52 +0000 Subject: [PATCH] [bindings/go] Add Go bindings for CalledValue This is very useful for inspecting generated IR, there appears to be no other way to get the called function from a CallInst. Revision: https://reviews.llvm.org/D52972 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362890 91177308-0d34-0410-b5e6-96231b3b80d8 --- bindings/go/llvm/ir.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bindings/go/llvm/ir.go b/bindings/go/llvm/ir.go index 50e7d753020..71f741421e8 100644 --- a/bindings/go/llvm/ir.go +++ b/bindings/go/llvm/ir.go @@ -1228,6 +1228,10 @@ func (v Value) AddCallSiteAttribute(i int, a Attribute) { 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 } -- 2.11.0