summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorMicah Villmow <villmow@gmail.com>2012-10-24 18:36:13 +0000
committerMicah Villmow <villmow@gmail.com>2012-10-24 18:36:13 +0000
commitb52fb876171e3670e7307fda4459ca005d49d9f5 (patch)
treee3327db438225073f62c4f4733c814082c9abfe5 /lib/VMCore
parent199063ea37d8cc651a20ab00eef4326cd9331371 (diff)
downloadllvm-b52fb876171e3670e7307fda4459ca005d49d9f5.tar.gz
llvm-b52fb876171e3670e7307fda4459ca005d49d9f5.tar.bz2
llvm-b52fb876171e3670e7307fda4459ca005d49d9f5.tar.xz
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/VMCore')
-rw-r--r--lib/VMCore/DataLayout.cpp8
1 files changed, 8 insertions, 0 deletions
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<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!");