diff options
author | Guillaume Chatelet <gchatelet@google.com> | 2019-09-23 12:41:36 +0000 |
---|---|---|
committer | Guillaume Chatelet <gchatelet@google.com> | 2019-09-23 12:41:36 +0000 |
commit | 1ae7905fc86004a95fbf9a07f248af382f01909f (patch) | |
tree | efbe731f1e33252d366e43c6ad7ce6dd4d3d15bd /llvm/lib/IR/DataLayout.cpp | |
parent | 1588c08735618892abd7467ec50a41eb8f6dd9d0 (diff) | |
download | llvm-1ae7905fc86004a95fbf9a07f248af382f01909f.zip llvm-1ae7905fc86004a95fbf9a07f248af382f01909f.tar.gz llvm-1ae7905fc86004a95fbf9a07f248af382f01909f.tar.bz2 |
[Alignment][NFC] DataLayout migration to llvm::Align
Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: jholewinski, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67914
llvm-svn: 372596
Diffstat (limited to 'llvm/lib/IR/DataLayout.cpp')
-rw-r--r-- | llvm/lib/IR/DataLayout.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp index c3fda92..206649b 100644 --- a/llvm/lib/IR/DataLayout.cpp +++ b/llvm/lib/IR/DataLayout.cpp @@ -638,22 +638,22 @@ const StructLayout *DataLayout::getStructLayout(StructType *Ty) const { return L; } -unsigned DataLayout::getPointerABIAlignment(unsigned AS) const { +llvm::Align DataLayout::getPointerABIAlignment(unsigned AS) const { PointersTy::const_iterator I = findPointerLowerBound(AS); if (I == Pointers.end() || I->AddressSpace != AS) { I = findPointerLowerBound(0); assert(I->AddressSpace == 0); } - return I->ABIAlign.value(); + return I->ABIAlign; } -unsigned DataLayout::getPointerPrefAlignment(unsigned AS) const { +llvm::Align DataLayout::getPointerPrefAlignment(unsigned AS) const { PointersTy::const_iterator I = findPointerLowerBound(AS); if (I == Pointers.end() || I->AddressSpace != AS) { I = findPointerLowerBound(0); assert(I->AddressSpace == 0); } - return I->PrefAlign.value(); + return I->PrefAlign; } unsigned DataLayout::getPointerSize(unsigned AS) const { @@ -711,12 +711,11 @@ llvm::Align DataLayout::getAlignment(Type *Ty, bool abi_or_pref) const { switch (Ty->getTypeID()) { // Early escape for the non-numeric types. case Type::LabelTyID: - return llvm::Align(abi_or_pref ? getPointerABIAlignment(0) - : getPointerPrefAlignment(0)); + return abi_or_pref ? getPointerABIAlignment(0) : getPointerPrefAlignment(0); case Type::PointerTyID: { unsigned AS = cast<PointerType>(Ty)->getAddressSpace(); - return llvm::Align(abi_or_pref ? getPointerABIAlignment(AS) - : getPointerPrefAlignment(AS)); + return abi_or_pref ? getPointerABIAlignment(AS) + : getPointerPrefAlignment(AS); } case Type::ArrayTyID: return getAlignment(cast<ArrayType>(Ty)->getElementType(), abi_or_pref); @@ -762,8 +761,8 @@ unsigned DataLayout::getABITypeAlignment(Type *Ty) const { /// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for /// an integer type of the specified bitwidth. -unsigned DataLayout::getABIIntegerTypeAlignment(unsigned BitWidth) const { - return getAlignmentInfo(INTEGER_ALIGN, BitWidth, true, nullptr).value(); +llvm::Align DataLayout::getABIIntegerTypeAlignment(unsigned BitWidth) const { + return getAlignmentInfo(INTEGER_ALIGN, BitWidth, true, nullptr); } unsigned DataLayout::getPrefTypeAlignment(Type *Ty) const { |