[llvm-commits] CVS: llvm/include/llvm/InstrTypes.h

Reid Spencer reid at x10sys.com
Wed Dec 6 20:18:46 PST 2006



Changes in directory llvm/include/llvm:

InstrTypes.h updated: 1.52 -> 1.53
---
Log message:

Provide a getOpcode() method on CmpInst to ensure the opcode is returned
as the right type. Use this to shorten some code.


---
Diffs of the changes:  (+5 -0)

 InstrTypes.h |    5 +++++
 1 files changed, 5 insertions(+)


Index: llvm/include/llvm/InstrTypes.h
diff -u llvm/include/llvm/InstrTypes.h:1.52 llvm/include/llvm/InstrTypes.h:1.53
--- llvm/include/llvm/InstrTypes.h:1.52	Mon Dec  4 17:14:27 2006
+++ llvm/include/llvm/InstrTypes.h	Wed Dec  6 22:18:31 2006
@@ -521,6 +521,11 @@
   /// @brief Implement superclass method.
   virtual CmpInst *clone() const;
 
+  /// @brief Get the opcode casted to the right type
+  OtherOps getOpcode() const {
+    return static_cast<OtherOps>(Instruction::getOpcode());
+  }
+
   /// The predicate for CmpInst is defined by the subclasses but stored in 
   /// the SubclassData field (see Value.h).  We allow it to be fetched here
   /// as the predicate but there is no enum type for it, just the raw unsigned 






More information about the llvm-commits mailing list