mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
Add some cleanup to the DataLayout changes requested by Chandler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166607 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -645,16 +645,17 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
|
||||
}
|
||||
case Instruction::PtrToInt: {
|
||||
GenericValue GV = getConstantValue(Op0);
|
||||
unsigned AS = cast<PointerType>(CE->getOperand(1)->getType())
|
||||
->getAddressSpace();
|
||||
uint32_t PtrWidth = TD->getPointerSizeInBits(AS);
|
||||
assert(CE->getOperand(1)->getType()->isPointerTy() &&
|
||||
"Must be a pointer type!");
|
||||
uint32_t PtrWidth = TD->getTypeSizeInBits(CE->getOperand(1)->getType());
|
||||
GV.IntVal = APInt(PtrWidth, uintptr_t(GV.PointerVal));
|
||||
return GV;
|
||||
}
|
||||
case Instruction::IntToPtr: {
|
||||
GenericValue GV = getConstantValue(Op0);
|
||||
unsigned AS = cast<PointerType>(CE->getType())->getAddressSpace();
|
||||
uint32_t PtrWidth = TD->getPointerSizeInBits(AS);
|
||||
assert(CE->getOperand(1)->getType()->isPointerTy() &&
|
||||
"Must be a pointer type!");
|
||||
uint32_t PtrWidth = TD->getTypeSizeInBits(CE->getType());
|
||||
if (PtrWidth != GV.IntVal.getBitWidth())
|
||||
GV.IntVal = GV.IntVal.zextOrTrunc(PtrWidth);
|
||||
assert(GV.IntVal.getBitWidth() <= 64 && "Bad pointer width");
|
||||
|
Reference in New Issue
Block a user