mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Add getBitCastOrAddrSpaceCast
llvm-svn: 196637
This commit is contained in:
parent
4beb89c7ad
commit
e6d3e47f0e
@ -943,12 +943,20 @@ public:
|
|||||||
Type *Ty ///< The type to trunc or bitcast C to
|
Type *Ty ///< The type to trunc or bitcast C to
|
||||||
);
|
);
|
||||||
|
|
||||||
/// @brief Create a BitCast or a PtrToInt cast constant expression
|
/// @brief Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant
|
||||||
|
/// expression.
|
||||||
static Constant *getPointerCast(
|
static Constant *getPointerCast(
|
||||||
Constant *C, ///< The pointer value to be casted (operand 0)
|
Constant *C, ///< The pointer value to be casted (operand 0)
|
||||||
Type *Ty ///< The type to which cast should be made
|
Type *Ty ///< The type to which cast should be made
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// @brief Create a BitCast or AddrSpaceCast for a pointer type depending on
|
||||||
|
/// the address space.
|
||||||
|
static Constant *getPointerBitCastOrAddrSpaceCast(
|
||||||
|
Constant *C, ///< The constant to addrspacecast or bitcast
|
||||||
|
Type *Ty ///< The type to bitcast or addrspacecast C to
|
||||||
|
);
|
||||||
|
|
||||||
/// @brief Create a ZExt, Bitcast or Trunc for integer -> integer casts
|
/// @brief Create a ZExt, Bitcast or Trunc for integer -> integer casts
|
||||||
static Constant *getIntegerCast(
|
static Constant *getIntegerCast(
|
||||||
Constant *C, ///< The integer constant to be casted
|
Constant *C, ///< The integer constant to be casted
|
||||||
|
@ -1499,7 +1499,18 @@ Constant *ConstantExpr::getPointerCast(Constant *S, Type *Ty) {
|
|||||||
return getBitCast(S, Ty);
|
return getBitCast(S, Ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
Constant *ConstantExpr::getIntegerCast(Constant *C, Type *Ty,
|
Constant *ConstantExpr::getPointerBitCastOrAddrSpaceCast(Constant *S,
|
||||||
|
Type *Ty) {
|
||||||
|
assert(S->getType()->isPtrOrPtrVectorTy() && "Invalid cast");
|
||||||
|
assert(Ty->isPtrOrPtrVectorTy() && "Invalid cast");
|
||||||
|
|
||||||
|
if (S->getType()->getPointerAddressSpace() != Ty->getPointerAddressSpace())
|
||||||
|
return getAddrSpaceCast(S, Ty);
|
||||||
|
|
||||||
|
return getBitCast(S, Ty);
|
||||||
|
}
|
||||||
|
|
||||||
|
Constant *ConstantExpr::getIntegerCast(Constant *C, Type *Ty,
|
||||||
bool isSigned) {
|
bool isSigned) {
|
||||||
assert(C->getType()->isIntOrIntVectorTy() &&
|
assert(C->getType()->isIntOrIntVectorTy() &&
|
||||||
Ty->isIntOrIntVectorTy() && "Invalid cast");
|
Ty->isIntOrIntVectorTy() && "Invalid cast");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user