[llvm-commits] CVS: llvm/include/llvm/Instruction.h Instructions.h

Chris Lattner sabre at nondot.org
Sun Sep 17 12:15:03 PDT 2006



Changes in directory llvm/include/llvm:

Instruction.h updated: 1.72 -> 1.73
Instructions.h updated: 1.37 -> 1.38
---
Log message:

Add new SetCondInst::isRelational/isEquality methods.  Rename 
Instruction::isRelational to Instruction::isComparison.


---
Diffs of the changes:  (+15 -4)

 Instruction.h  |    6 +++---
 Instructions.h |   13 ++++++++++++-
 2 files changed, 15 insertions(+), 4 deletions(-)


Index: llvm/include/llvm/Instruction.h
diff -u llvm/include/llvm/Instruction.h:1.72 llvm/include/llvm/Instruction.h:1.73
--- llvm/include/llvm/Instruction.h:1.72	Wed Jun 21 11:53:47 2006
+++ llvm/include/llvm/Instruction.h	Sun Sep 17 14:14:47 2006
@@ -141,10 +141,10 @@
   bool isCommutative() const { return isCommutative(getOpcode()); }
   static bool isCommutative(unsigned op);
 
-  /// isRelational - Return true if the instruction is a Set* instruction:
+  /// isComparison - Return true if the instruction is a Set* instruction:
   ///
-  bool isRelational() const { return isRelational(getOpcode()); }
-  static bool isRelational(unsigned op);
+  bool isComparison() const { return isComparison(getOpcode()); }
+  static bool isComparison(unsigned op);
 
 
   /// isTrappingInstruction - Return true if the instruction may trap.


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.37 llvm/include/llvm/Instructions.h:1.38
--- llvm/include/llvm/Instructions.h:1.37	Wed Jun 21 11:53:47 2006
+++ llvm/include/llvm/Instructions.h	Sun Sep 17 14:14:47 2006
@@ -454,7 +454,18 @@
   ///
   static BinaryOps getSwappedCondition(BinaryOps Opcode);
 
-
+  /// isEquality - Return true if this comparison is an ==/!= comparison.
+  ///
+  bool isEquality() const {
+    return getOpcode() == SetEQ || getOpcode() == SetNE;
+  }
+  
+  /// isRelational - Return true if this comparison is a </>/<=/>= comparison.
+  ///
+  bool isRelational() const {
+    return !isEquality();
+  }
+  
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const SetCondInst *) { return true; }
   static inline bool classof(const Instruction *I) {






More information about the llvm-commits mailing list