diff options
Diffstat (limited to 'lib/VMCore/DataLayout.cpp')
-rw-r--r-- | lib/VMCore/DataLayout.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/VMCore/DataLayout.cpp b/lib/VMCore/DataLayout.cpp index 7c9284f9b8..c127aaba42 100644 --- a/lib/VMCore/DataLayout.cpp +++ b/lib/VMCore/DataLayout.cpp @@ -524,14 +524,6 @@ std::string DataLayout::getStringRepresentation() const { return OS.str(); } -unsigned DataLayout::getPointerTypeSizeInBits(Type *Ty) const -{ - if (Ty->isPointerTy()) return getTypeSizeInBits(Ty); - if (Ty->isVectorTy() - && cast<VectorType>(Ty)->getElementType()->isPointerTy()) - return getTypeSizeInBits(cast<VectorType>(Ty)->getElementType()); - return getPointerSizeInBits(0); -} uint64_t DataLayout::getTypeSizeInBits(Type *Ty) const { assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); @@ -679,14 +671,20 @@ IntegerType *DataLayout::getIntPtrType(LLVMContext &C, /// least as big as that of a pointer of the given pointer (vector of pointer) /// type. Type *DataLayout::getIntPtrType(Type *Ty) const { - unsigned NumBits = getPointerTypeSizeInBits(Ty); +#if 0 + // FIXME: This assert should always have been here, but the review comments + // weren't addressed in time, and now there is lots of code "depending" on + // this. Uncomment once this is cleaned up. + assert(Ty->isPtrOrPtrVectorTy() && + "Expected a pointer or pointer vector type."); +#endif + unsigned NumBits = getTypeSizeInBits(Ty->getScalarType()); IntegerType *IntTy = IntegerType::get(Ty->getContext(), NumBits); if (VectorType *VecTy = dyn_cast<VectorType>(Ty)) return VectorType::get(IntTy, VecTy->getNumElements()); return IntTy; } - uint64_t DataLayout::getIndexedOffset(Type *ptrTy, ArrayRef<Value *> Indices) const { Type *Ty = ptrTy; |