From 1feb00a28c9fdab162da08a15fcc9d088a36c352 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Wed, 10 May 2023 13:13:58 -0700 Subject: [X86] Introduce a large data threshold for the medium code model Currently clang's medium code model treats all data as large, putting them in a large data section and using more expensive instruction sequences to access them. Following gcc's -mlarge-data-threshold, which allows putting data under a certain size in a normal data section as opposed to a large data section. This allows using cheaper code sequences to access some portion of data in the binary (which will be implemented in LLVM in a future patch). And under the medium codel mode, only put data above the large data threshold into large data sections, not all data. Reviewed By: MaskRay, rnk Differential Revision: https://reviews.llvm.org/D149288 --- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp') diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 55fb522..622c8ad 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -651,8 +651,8 @@ getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind, Name += utostr(EntrySize); } else { bool IsLarge = false; - if (isa(GO)) - IsLarge = TM.isLargeData(); + if (auto *GV = dyn_cast(GO)) + IsLarge = TM.isLargeData(GV); Name = getSectionPrefixForGlobal(Kind, IsLarge); } @@ -855,8 +855,8 @@ static MCSectionELF *selectELFSectionForGlobal( Group = C->getName(); IsComdat = C->getSelectionKind() == Comdat::Any; } - if (isa(GO)) { - if (TM.isLargeData()) { + if (auto *GV = dyn_cast(GO)) { + if (TM.isLargeData(GV)) { assert(TM.getTargetTriple().getArch() == Triple::x86_64); Flags |= ELF::SHF_X86_64_LARGE; } -- cgit v1.1