diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-04 23:14:27 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-04 23:14:27 +0000 |
commit | 887ee06f94c5b36ddbe22f54ff816fbc13bb2703 (patch) | |
tree | 0aa9edefd746498a8a59ff7bd8d55e8fad8d65f2 | |
parent | 98ae09ca5dba69cd9e5933ceea27d08b901907c6 (diff) |
Add cast creation functions for Pointer Casts, either BitCast or PtrToInt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32207 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Constants.h | 8 | ||||
-rw-r--r-- | include/llvm/InstrTypes.h | 16 |
2 files changed, 23 insertions, 1 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 93be8bf06f..f142976d33 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -561,6 +561,12 @@ public: const Type *Ty ///< The type to trunc or bitcast C to ); + /// @brief Create a BitCast or a PtrToInt cast constant expression + static Constant *getPointerCast( + Constant *C, ///< The pointer value to be casted (operand 0) + const Type *Ty ///< The type to which cast should be made + ); + // This method uses the CastInst::getCastOpcode method to infer the // cast opcode to use. // @brief Get a ConstantExpr Conversion operator that casts C to Ty @@ -597,7 +603,7 @@ public: /// static Constant *get(unsigned Opcode, Constant *C1, Constant *C2); - /// @brief Return an ICmp or FCmp comparison operator constante expression. + /// @brief Return an ICmp or FCmp comparison operator constant expression. static Constant *getCompare(unsigned Opcode, unsigned short pred, Constant *C1, Constant *C2); diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index 0878a9c4b5..0577db3efc 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -323,6 +323,22 @@ public: Instruction *InsertBefore = 0 ///< Place to insert the instruction ); + /// @brief Create a BitCast or a PtrToInt cast instruction + static CastInst *createPointerCast( + Value *S, ///< The pointer value to be casted (operand 0) + const Type *Ty, ///< The type to which operand is casted + const std::string &Name, ///< The name for the instruction + BasicBlock *InsertAtEnd ///< The block to insert the instruction into + ); + + /// @brief Create a BitCast or a PtrToInt cast instruction + static CastInst *createPointerCast( + Value *S, ///< The pointer value to be casted (operand 0) + const Type *Ty, ///< The type to which cast should be made + const std::string &Name = "", ///< Name for the instruction + Instruction *InsertBefore = 0 ///< Place to insert the instruction + ); + /// @brief Create a SExt or BitCast cast instruction static CastInst *createSExtOrBitCast( Value *S, ///< The value to be casted (operand 0) |