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 | b52fb876171e3670e7307fda4459ca005d49d9f5 (patch) | |
tree | e3327db438225073f62c4f4733c814082c9abfe5 /lib/ExecutionEngine | |
parent | 199063ea37d8cc651a20ab00eef4326cd9331371 (diff) |
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
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 94a2542e7a..99f6ec691a 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/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"); |