[llvm-commits] [llvm] r57735 - /llvm/trunk/include/llvm/InstrTypes.h

Dan Gohman gohman at apple.com
Fri Oct 17 14:42:46 PDT 2008


Author: djg
Date: Fri Oct 17 16:42:45 2008
New Revision: 57735

URL: http://llvm.org/viewvc/llvm-project?rev=57735&view=rev
Log:
Use the opcode predicates, instead of duplicating the code.

Modified:
    llvm/trunk/include/llvm/InstrTypes.h

Modified: llvm/trunk/include/llvm/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=57735&r1=57734&r2=57735&view=diff

==============================================================================
--- llvm/trunk/include/llvm/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/InstrTypes.h Fri Oct 17 16:42:45 2008
@@ -73,7 +73,7 @@
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const TerminatorInst *) { return true; }
   static inline bool classof(const Instruction *I) {
-    return I->getOpcode() >= TermOpsBegin && I->getOpcode() < TermOpsEnd;
+    return I->isTerminator();
   }
   static inline bool classof(const Value *V) {
     return isa<Instruction>(V) && classof(cast<Instruction>(V));
@@ -237,7 +237,7 @@
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const BinaryOperator *) { return true; }
   static inline bool classof(const Instruction *I) {
-    return I->getOpcode() >= BinaryOpsBegin && I->getOpcode() < BinaryOpsEnd;
+    return I->isBinaryOp();
   }
   static inline bool classof(const Value *V) {
     return isa<Instruction>(V) && classof(cast<Instruction>(V));
@@ -483,7 +483,7 @@
   /// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const CastInst *) { return true; }
   static inline bool classof(const Instruction *I) {
-    return I->getOpcode() >= CastOpsBegin && I->getOpcode() < CastOpsEnd;
+    return I->isCast();
   }
   static inline bool classof(const Value *V) {
     return isa<Instruction>(V) && classof(cast<Instruction>(V));





More information about the llvm-commits mailing list