[PATCH] D53884: [bindings/go] Add bindings to LLVMGet?CmpPredicate

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 12:56:04 PDT 2018


aykevl created this revision.
aykevl added reviewers: whitequark, pcc.

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 returned type name.


Repository:
  rL LLVM

https://reviews.llvm.org/D53884

Files:
  bindings/go/llvm/ir.go


Index: bindings/go/llvm/ir.go
===================================================================
--- bindings/go/llvm/ir.go
+++ bindings/go/llvm/ir.go
@@ -1272,6 +1272,10 @@
 	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
 //-------------------------------------------------------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53884.171768.patch
Type: text/x-patch
Size: 604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/4f01bb6c/attachment.bin>


More information about the llvm-commits mailing list