diff options
| author | Duncan Sands <baldrick@free.fr> | 2012-10-29 14:30:05 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2012-10-29 14:30:05 +0000 |
| commit | 835e93a2319c027ce826e4ed6b987d40c09037d8 (patch) | |
| tree | bb578d6d12f14d31b75517a334d95edd7e966012 /llvm/lib/VMCore/DataLayout.cpp | |
| parent | 0a3322e5da56fc5808d2d98e83ad50a24c90eb05 (diff) | |
| download | bcm5719-llvm-835e93a2319c027ce826e4ed6b987d40c09037d8.tar.gz bcm5719-llvm-835e93a2319c027ce826e4ed6b987d40c09037d8.zip | |
Factorize code: rather than duplication the logic in getPointerTypeSizeInBits,
just call getPointerTypeSizeInBits. No functionality change.
llvm-svn: 166926
Diffstat (limited to 'llvm/lib/VMCore/DataLayout.cpp')
| -rw-r--r-- | llvm/lib/VMCore/DataLayout.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/llvm/lib/VMCore/DataLayout.cpp b/llvm/lib/VMCore/DataLayout.cpp index 104e5da057f..b8474927194 100644 --- a/llvm/lib/VMCore/DataLayout.cpp +++ b/llvm/lib/VMCore/DataLayout.cpp @@ -678,20 +678,8 @@ IntegerType *DataLayout::getIntPtrType(LLVMContext &C, /// getIntPtrType - Return an integer type that is the same size or /// greater to the pointer size of the specific PointerType. IntegerType *DataLayout::getIntPtrType(Type *Ty) const { - LLVMContext &C = Ty->getContext(); - // For pointers, we return the size for the specific address space. - if (Ty->isPointerTy()) return IntegerType::get(C, getTypeSizeInBits(Ty)); - // For vector of pointers, we return the size of the address space - // of the pointer type. - if (Ty->isVectorTy() && cast<VectorType>(Ty)->getElementType()->isPointerTy()) - return IntegerType::get(C, - getTypeSizeInBits(cast<VectorType>(Ty)->getElementType())); - // Otherwise return the address space for the default address space. - // An example of this occuring is that you want to get the IntPtr - // for all of the arguments in a function. However, the IntPtr - // for a non-pointer type cannot be determined by the type, so - // the default value is used. - return getIntPtrType(C, 0); + unsigned NumBits = getPointerTypeSizeInBits(Ty); + return IntegerType::get(Ty->getContext(), NumBits); } |

