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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32191 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2006-12-04 20:17:56 +00:00
parent 4d42fcebe3
commit 848414e49c
4 changed files with 134 additions and 2 deletions

View File

@@ -541,6 +541,24 @@ public:
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