diff options
author | Sergei Barannikov <barannikov88@gmail.com> | 2024-08-14 10:51:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-14 10:51:05 +0300 |
commit | 8eadf21004ecfa78fa3c6da385c5b2f2f44458fa (patch) | |
tree | 010aa7faece4be5857789d279fa102d1a72afd4f /llvm/lib/IR/DataLayout.cpp | |
parent | fa658ac7913408d5ec248193d531ba63f6fbe73d (diff) | |
download | llvm-8eadf21004ecfa78fa3c6da385c5b2f2f44458fa.zip llvm-8eadf21004ecfa78fa3c6da385c5b2f2f44458fa.tar.gz llvm-8eadf21004ecfa78fa3c6da385c5b2f2f44458fa.tar.bz2 |
[DataLayout] Split StructAlignment into two fields (NFC) (#103700)
Aggregate type specification doesn't have the size component.
Don't abuse LayoutAlignElem to avoid confusion.
Diffstat (limited to 'llvm/lib/IR/DataLayout.cpp')
-rw-r--r-- | llvm/lib/IR/DataLayout.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp index ae0ff9c..c10b302 100644 --- a/llvm/lib/IR/DataLayout.cpp +++ b/llvm/lib/IR/DataLayout.cpp @@ -219,7 +219,6 @@ DataLayout::DataLayout(StringRef LayoutString) { DefaultGlobalsAddrSpace = 0; TheFunctionPtrAlignType = FunctionPtrAlignType::Independent; ManglingMode = MM_None; - StructAlignment = LayoutAlignElem::get(Align(1), Align(8), 0); // Default alignments for (const auto &[Kind, Layout] : DefaultAlignments) { @@ -250,8 +249,9 @@ DataLayout &DataLayout::operator=(const DataLayout &Other) { IntAlignments = Other.IntAlignments; FloatAlignments = Other.FloatAlignments; VectorAlignments = Other.VectorAlignments; - StructAlignment = Other.StructAlignment; Pointers = Other.Pointers; + StructABIAlignment = Other.StructABIAlignment; + StructPrefAlignment = Other.StructPrefAlignment; NonIntegralAddressSpaces = Other.NonIntegralAddressSpaces; return *this; } @@ -271,7 +271,9 @@ bool DataLayout::operator==(const DataLayout &Other) const { IntAlignments == Other.IntAlignments && FloatAlignments == Other.FloatAlignments && VectorAlignments == Other.VectorAlignments && - StructAlignment == Other.StructAlignment && Pointers == Other.Pointers; + Pointers == Other.Pointers && + StructABIAlignment == Other.StructABIAlignment && + StructPrefAlignment == Other.StructPrefAlignment; } Expected<DataLayout> DataLayout::parse(StringRef LayoutDescription) { @@ -628,8 +630,8 @@ Error DataLayout::setAlignment(AlignTypeEnum AlignType, Align ABIAlign, SmallVectorImpl<LayoutAlignElem> *Alignments; switch (AlignType) { case AGGREGATE_ALIGN: - StructAlignment.ABIAlign = ABIAlign; - StructAlignment.PrefAlign = PrefAlign; + StructABIAlignment = ABIAlign; + StructPrefAlignment = PrefAlign; return Error::success(); case INTEGER_ALIGN: Alignments = &IntAlignments; @@ -801,8 +803,7 @@ Align DataLayout::getAlignment(Type *Ty, bool abi_or_pref) const { // Get the layout annotation... which is lazily created on demand. const StructLayout *Layout = getStructLayout(cast<StructType>(Ty)); - const Align Align = - abi_or_pref ? StructAlignment.ABIAlign : StructAlignment.PrefAlign; + const Align Align = abi_or_pref ? StructABIAlignment : StructPrefAlignment; return std::max(Align, Layout->getAlignment()); } case Type::IntegerTyID: |