diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-02 02:08:27 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-02 02:08:27 +0000 |
commit | 5fe31dc5202f05afcff9affec696e23fa90a62b0 (patch) | |
tree | 591fa0c2784d56fbb6934c0620e1b75564893d44 | |
parent | 8155d6d8d98e877f630581a17bd083606d6f99d9 (diff) |
Add some convenience functions for getting the source and destination
types from any Cast instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32807 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/InstrTypes.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index 5e7be3253d..50c1e7ab58 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -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) { |