[llvm-commits] CVS: llvm/include/llvm/InstrTypes.h Constants.h
Reid Spencer
reid at x10sys.com
Mon Dec 4 12:18:12 PST 2006
Changes in directory llvm/include/llvm:
InstrTypes.h updated: 1.50 -> 1.51
Constants.h updated: 1.99 -> 1.100
---
Log message:
Implement new cast creation functions for both instructions and constant
expressions. These will get used to reduce clutter as we replace various
calls to createInferredCast and getCast.
---
Diffs of the changes: (+66 -0)
Constants.h | 18 ++++++++++++++++++
InstrTypes.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+)
Index: llvm/include/llvm/InstrTypes.h
diff -u llvm/include/llvm/InstrTypes.h:1.50 llvm/include/llvm/InstrTypes.h:1.51
--- llvm/include/llvm/InstrTypes.h:1.50 Sun Dec 3 20:43:42 2006
+++ llvm/include/llvm/InstrTypes.h Mon Dec 4 14:17:56 2006
@@ -299,6 +299,54 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief Create a ZExt or BitCast cast instruction
+ static CastInst *createZExtOrBitCast(
+ Value *S, ///< The 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 ZExt or BitCast cast instruction
+ static CastInst *createZExtOrBitCast(
+ Value *S, ///< The 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 SExt or BitCast cast instruction
+ static CastInst *createSExtOrBitCast(
+ Value *S, ///< The 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)
+ 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 Trunc or BitCast cast instruction
+ static CastInst *createTruncOrBitCast(
+ Value *S, ///< The 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 Trunc or BitCast cast instruction
+ static CastInst *createTruncOrBitCast(
+ Value *S, ///< The 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
+ );
+
/// Returns the opcode necessary to cast Val into Ty using usual casting
/// rules.
static Instruction::CastOps getCastOpcode(
Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.99 llvm/include/llvm/Constants.h:1.100
--- llvm/include/llvm/Constants.h:1.99 Sun Dec 3 23:19:02 2006
+++ llvm/include/llvm/Constants.h Mon Dec 4 14:17:56 2006
@@ -541,6 +541,24 @@
const Type *Ty ///< The type to which the constant is converted
);
+ // @brief Create a ZExt or BitCast cast constant expression
+ static Constant *getZExtOrBitCast(
+ Constant *C, ///< The constant to zext or bitcast
+ const Type *Ty ///< The type to zext or bitcast C to
+ );
+
+ // @brief Create a SExt or BitCast cast constant expression
+ static Constant *getSExtOrBitCast(
+ Constant *C, ///< The constant to zext or bitcast
+ const Type *Ty ///< The type to zext or bitcast C to
+ );
+
+ // @brief Create a Trunc or BitCast cast constant expression
+ static Constant *getTruncOrBitCast(
+ Constant *C, ///< The constant to zext or bitcast
+ const Type *Ty ///< The type to zext or bitcast C to
+ );
+
// 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
More information about the llvm-commits
mailing list