diff options
author | Guillaume Chatelet <gchatelet@google.com> | 2020-06-29 11:24:36 +0000 |
---|---|---|
committer | Guillaume Chatelet <gchatelet@google.com> | 2020-06-29 11:24:36 +0000 |
commit | 368a5e3a666ff38432be538370c46ff800fface1 (patch) | |
tree | 3b6b1b3586051f5fe8f5358d0b0b51235097796d /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 3521ecf1f8a3cf5e4811f93a9a809fc722462bbf (diff) | |
download | llvm-368a5e3a666ff38432be538370c46ff800fface1.zip llvm-368a5e3a666ff38432be538370c46ff800fface1.tar.gz llvm-368a5e3a666ff38432be538370c46ff800fface1.tar.bz2 |
[Alignment][NFC] migrate DataLayout::getPreferredAlignment
This 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
Differential Revision: https://reviews.llvm.org/D82752
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 03254ed..8d67030 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -599,11 +599,11 @@ getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind, // We also need alignment here. // FIXME: this is getting the alignment of the character, not the // alignment of the global! - unsigned Align = GO->getParent()->getDataLayout().getPreferredAlignment( + Align Alignment = GO->getParent()->getDataLayout().getPreferredAlign( cast<GlobalVariable>(GO)); std::string SizeSpec = ".rodata.str" + utostr(EntrySize) + "."; - Name = SizeSpec + utostr(Align); + Name = SizeSpec + utostr(Alignment.value()); } else if (Kind.isMergeableConst()) { Name = ".rodata.cst"; Name += utostr(EntrySize); @@ -1145,16 +1145,16 @@ MCSection *TargetLoweringObjectFileMachO::SelectSectionForGlobal( // FIXME: Alignment check should be handled by section classifier. if (Kind.isMergeable1ByteCString() && - GO->getParent()->getDataLayout().getPreferredAlignment( - cast<GlobalVariable>(GO)) < 32) + GO->getParent()->getDataLayout().getPreferredAlign( + cast<GlobalVariable>(GO)) < Align(32)) return CStringSection; // Do not put 16-bit arrays in the UString section if they have an // externally visible label, this runs into issues with certain linker // versions. if (Kind.isMergeable2ByteCString() && !GO->hasExternalLinkage() && - GO->getParent()->getDataLayout().getPreferredAlignment( - cast<GlobalVariable>(GO)) < 32) + GO->getParent()->getDataLayout().getPreferredAlign( + cast<GlobalVariable>(GO)) < Align(32)) return UStringSection; // With MachO only variables whose corresponding symbol starts with 'l' or @@ -2043,13 +2043,13 @@ MCSection *TargetLoweringObjectFileXCOFF::SelectSectionForGlobal( } if (Kind.isMergeableCString()) { - unsigned Align = GO->getParent()->getDataLayout().getPreferredAlignment( + Align Alignment = GO->getParent()->getDataLayout().getPreferredAlign( cast<GlobalVariable>(GO)); unsigned EntrySize = getEntrySizeForKind(Kind); std::string SizeSpec = ".rodata.str" + utostr(EntrySize) + "."; SmallString<128> Name; - Name = SizeSpec + utostr(Align); + Name = SizeSpec + utostr(Alignment.value()); return getContext().getXCOFFSection( Name, XCOFF::XMC_RO, XCOFF::XTY_SD, |