1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Add cast creation functions for Pointer Casts, either BitCast or PtrToInt

llvm-svn: 32207
This commit is contained in:
Reid Spencer 2006-12-04 23:14:27 +00:00
parent 0be88afd90
commit 671de8b576
2 changed files with 23 additions and 1 deletions

View File

@ -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);

View File

@ -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)