mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 15:33:33 +00:00
Implement getPointerCast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32211 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4d7bd8fe6f
commit
c0459fb7f5
@ -1552,6 +1552,16 @@ Constant *ConstantExpr::getTruncOrBitCast(Constant *C, const Type *Ty) {
|
|||||||
return getCast(Instruction::Trunc, C, Ty);
|
return getCast(Instruction::Trunc, C, Ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Constant *ConstantExpr::getPointerCast(Constant *S, const Type *Ty) {
|
||||||
|
assert(isa<PointerType>(S->getType()) && "Invalid cast");
|
||||||
|
assert((Ty->isIntegral() || Ty->getTypeID() == Type::PointerTyID) &&
|
||||||
|
"Invalid cast");
|
||||||
|
|
||||||
|
if (Ty->isIntegral())
|
||||||
|
return getCast(Instruction::PtrToInt, S, Ty);
|
||||||
|
return getCast(Instruction::BitCast, S, Ty);
|
||||||
|
}
|
||||||
|
|
||||||
Constant *ConstantExpr::getTrunc(Constant *C, const Type *Ty) {
|
Constant *ConstantExpr::getTrunc(Constant *C, const Type *Ty) {
|
||||||
assert(C->getType()->isInteger() && "Trunc operand must be integer");
|
assert(C->getType()->isInteger() && "Trunc operand must be integer");
|
||||||
assert(Ty->isIntegral() && "Trunc produces only integral");
|
assert(Ty->isIntegral() && "Trunc produces only integral");
|
||||||
|
Loading…
Reference in New Issue
Block a user