From b52fb876171e3670e7307fda4459ca005d49d9f5 Mon Sep 17 00:00:00 2001 From: Micah Villmow Date: Wed, 24 Oct 2012 18:36:13 +0000 Subject: 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 --- lib/VMCore/DataLayout.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/VMCore/DataLayout.cpp') diff --git a/lib/VMCore/DataLayout.cpp b/lib/VMCore/DataLayout.cpp index 8d7a8e267c..104e5da057 100644 --- a/lib/VMCore/DataLayout.cpp +++ b/lib/VMCore/DataLayout.cpp @@ -524,6 +524,14 @@ std::string DataLayout::getStringRepresentation() const { return OS.str(); } +unsigned DataLayout::getPointerTypeSizeInBits(Type *Ty) const +{ + if (Ty->isPointerTy()) return getTypeSizeInBits(Ty); + if (Ty->isVectorTy() + && cast(Ty)->getElementType()->isPointerTy()) + return getTypeSizeInBits(cast(Ty)->getElementType()); + return getPointerSizeInBits(0); +} uint64_t DataLayout::getTypeSizeInBits(Type *Ty) const { assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); -- cgit v1.2.3