summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/DataLayout.cpp
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
commitbf3eeb2dfc1d7e4e4236ec1da7e20f58733b30cc (patch)
tree2514c697ab48d047ec6d2a104b35833dbf281645 /llvm/lib/VMCore/DataLayout.cpp
parentc9d17591d990b036df70bce2ed176357863cd417 (diff)
downloadbcm5719-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/VMCore/DataLayout.cpp')
-rw-r--r--llvm/lib/VMCore/DataLayout.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/DataLayout.cpp b/llvm/lib/VMCore/DataLayout.cpp
index 8d7a8e267cc..104e5da057f 100644
--- a/llvm/lib/VMCore/DataLayout.cpp
+++ b/llvm/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!");
OpenPOWER on IntegriCloud