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

Chris Lattner sabre at nondot.org
Fri Dec 7 20:37:53 PST 2007


Author: lattner
Date: Fri Dec  7 22:37:52 2007
New Revision: 44697

URL: http://llvm.org/viewvc/llvm-project?rev=44697&view=rev
Log:
Implement correct isa<UnaryInstruction>, problem reported by "ST".

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=44697&r1=44696&r2=44697&view=diff

==============================================================================
--- llvm/trunk/include/llvm/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/InstrTypes.h Fri Dec  7 22:37:52 2007
@@ -108,6 +108,20 @@
     Op = Val;
   }
   unsigned getNumOperands() const { return 1; }
+  
+  // Methods for support type inquiry through isa, cast, and dyn_cast:
+  static inline bool classof(const UnaryInstruction *) { return true; }
+  static inline bool classof(const Instruction *I) {
+    return I->getOpcode() == Instruction::Malloc ||
+           I->getOpcode() == Instruction::Alloca ||
+           I->getOpcode() == Instruction::Free ||
+           I->getOpcode() == Instruction::Load ||
+           I->getOpcode() == Instruction::VAArg ||
+           (I->getOpcode() >= CastOpsBegin && I->getOpcode() < CastOpsEnd);
+  }
+  static inline bool classof(const Value *V) {
+    return isa<Instruction>(V) && classof(cast<Instruction>(V));
+  }
 };
 
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list