Take a baby step towards getting rid of inferred casts. Provide methods on

CastInst and ConstantExpr that allow the signedness to be explicitly passed
in and reliance on signedness removed from getCastOpcode. These are
temporary measures useful during the conversion of inferred casts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32164 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2006-12-04 02:43:42 +00:00
parent 75575fcfe4
commit 56667123b7
4 changed files with 58 additions and 14 deletions

View File

@@ -541,8 +541,15 @@ public:
const Type *Ty ///< The type to which the constant is converted
);
// 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
static Constant *getCast(Constant *C, const Type *Ty);
static Constant *getInferredCast(Constant *C, bool SrcIsSigned,
const Type *Ty, bool DestIsSigned);
static Constant *getCast(Constant *C, const Type *Ty) {
return getInferredCast(C, C->getType()->isSigned(), Ty, Ty->isSigned());
}
/// @brief Return true if this is a convert constant expression
bool isCast() const;