[llvm] r362890 - [bindings/go] Add Go bindings for CalledValue

Ayke van Laethem via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 8 15:08:52 PDT 2019


Author: aykevl
Date: Sat Jun  8 15:08:52 2019
New Revision: 362890

URL: http://llvm.org/viewvc/llvm-project?rev=362890&view=rev
Log:
[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

Modified:
    llvm/trunk/bindings/go/llvm/ir.go

Modified: llvm/trunk/bindings/go/llvm/ir.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/ir.go?rev=362890&r1=362889&r2=362890&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/ir.go (original)
+++ llvm/trunk/bindings/go/llvm/ir.go Sat Jun  8 15:08:52 2019
@@ -1228,6 +1228,10 @@ func (v Value) AddCallSiteAttribute(i in
 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 }




More information about the llvm-commits mailing list