[llvm] r362893 - [bindings/go] Add bindings to LLVMGet?CmpPredicate

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


Author: aykevl
Date: Sat Jun  8 15:21:37 2019
New Revision: 362893

URL: http://llvm.org/viewvc/llvm-project?rev=362893&view=rev
Log:
[bindings/go] Add bindings to LLVMGet?CmpPredicate

Add bindings so that predicates on comparisons (icmp/fcmp) can be
inspected from IR.

Note: I considered adding Value.ICmpPredicate() etc. instead but
Value.IntPredicate() seemed easier to read and matches the name of the
returned type.

(This change was also pushed two commits ago but accidentally had the
wrong title and description.)

Revision: https://reviews.llvm.org/D53884

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=362893&r1=362892&r2=362893&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/ir.go (original)
+++ llvm/trunk/bindings/go/llvm/ir.go Sat Jun  8 15:21:37 2019
@@ -1275,6 +1275,10 @@ func (v Value) Indices() []uint32 {
 	return indices
 }
 
+// Operations on comparisons
+func (v Value) IntPredicate() IntPredicate     { return IntPredicate(C.LLVMGetICmpPredicate(v.C)) }
+func (v Value) FloatPredicate() FloatPredicate { return FloatPredicate(C.LLVMGetFCmpPredicate(v.C)) }
+
 //-------------------------------------------------------------------------
 // llvm.Builder
 //-------------------------------------------------------------------------




More information about the llvm-commits mailing list