From 368a5e3a666ff38432be538370c46ff800fface1 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Mon, 29 Jun 2020 11:24:36 +0000 Subject: [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 --- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp') diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 03254ed77d71..8d670300933f 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(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(GO)) < 32) + GO->getParent()->getDataLayout().getPreferredAlign( + cast(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(GO)) < 32) + GO->getParent()->getDataLayout().getPreferredAlign( + cast(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(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, -- cgit v1.2.3