diff options
author | Micah Villmow <villmow@gmail.com> | 2012-10-24 18:36:13 +0000 |
---|---|---|
committer | Micah Villmow <villmow@gmail.com> | 2012-10-24 18:36:13 +0000 |
commit | bf3eeb2dfc1d7e4e4236ec1da7e20f58733b30cc (patch) | |
tree | 2514c697ab48d047ec6d2a104b35833dbf281645 /llvm/lib/ExecutionEngine/ExecutionEngine.cpp | |
parent | c9d17591d990b036df70bce2ed176357863cd417 (diff) | |
download | bcm5719-llvm-bf3eeb2dfc1d7e4e4236ec1da7e20f58733b30cc.tar.gz bcm5719-llvm-bf3eeb2dfc1d7e4e4236ec1da7e20f58733b30cc.zip |
Add some cleanup to the DataLayout changes requested by Chandler.
llvm-svn: 166607
Diffstat (limited to 'llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 94a2542e7ad..99f6ec691ab 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -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"); |