Add some convenience functions for getting the source and destination
authorReid Spencer <rspencer@reidspencer.com>
Tue, 2 Jan 2007 02:08:27 +0000 (02:08 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Tue, 2 Jan 2007 02:08:27 +0000 (02:08 +0000)
types from any Cast instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32807 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/InstrTypes.h

index 5e7be3253df79794c60f22a108d904a519d5a07f..50c1e7ab585d2657d905638c2a4fc77e189b90c1 100644 (file)
@@ -454,6 +454,11 @@ public:
     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) {