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

Reid Spencer reid at x10sys.com
Mon Jan 1 18:08:43 PST 2007



Changes in directory llvm/include/llvm:

InstrTypes.h updated: 1.58 -> 1.59
---
Log message:

Add some convenience functions for getting the source and destination
types from any Cast instruction.


---
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.58 llvm/include/llvm/InstrTypes.h:1.59
--- llvm/include/llvm/InstrTypes.h:1.58	Sat Dec 30 23:23:18 2006
+++ llvm/include/llvm/InstrTypes.h	Mon Jan  1 20:08:27 2007
@@ -454,6 +454,11 @@
     return Instruction::CastOps(Instruction::getOpcode()); 
   }
 
+  /// @brief Return the source type, as a convenience
+  const Type* getSrcTy() const { return getOperand(0)->getType(); }
+  /// @brief Return the destination type, as a convenience
+  const Type* getDestTy() const { return getType(); }
+
   /// @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) {






More information about the llvm-commits mailing list