aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorHaohai Wen <haohai.wen@intel.com>2025-02-12 14:28:37 +0800
committerGitHub <noreply@github.com>2025-02-12 14:28:37 +0800
commitec28e9b7579347f0ba00882850fdc99218da7c20 (patch)
tree1b40e368685b5be149f4ddd0fbc53be615460816 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parentd222488007b294e897fb5c29971d87c3148ae33b (diff)
downloadllvm-ec28e9b7579347f0ba00882850fdc99218da7c20.zip
llvm-ec28e9b7579347f0ba00882850fdc99218da7c20.tar.gz
llvm-ec28e9b7579347f0ba00882850fdc99218da7c20.tar.bz2
[MC] Replace MCContext::GenericSectionID with MCSection::NonUniqueID (#126202)
They have same semantics. NonUniqueID is more friendly for isUnique implementation in MCSectionELF. History: 97837b7 added support for unique IDs in sections and added GenericSectionID. Later, 1dc16c7 added NonUniqueID.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 6cbc4b9..9f44f8b 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -758,7 +758,7 @@ calcUniqueIDUpdateFlagsAndSize(const GlobalObject *GO, StringRef SectionName,
if (!SupportsUnique) {
Flags &= ~ELF::SHF_MERGE;
EntrySize = 0;
- return MCContext::GenericSectionID;
+ return MCSection::NonUniqueID;
}
const bool SymbolMergeable = Flags & ELF::SHF_MERGE;
@@ -770,7 +770,7 @@ calcUniqueIDUpdateFlagsAndSize(const GlobalObject *GO, StringRef SectionName,
if (TM.getSeparateNamedSections())
return NextUniqueID++;
else
- return MCContext::GenericSectionID;
+ return MCSection::NonUniqueID;
}
// Symbols must be placed into sections with compatible entry sizes. Generate
@@ -778,8 +778,8 @@ calcUniqueIDUpdateFlagsAndSize(const GlobalObject *GO, StringRef SectionName,
// sections.
const auto PreviousID =
Ctx.getELFUniqueIDForEntsize(SectionName, Flags, EntrySize);
- if (PreviousID && (!TM.getSeparateNamedSections() ||
- *PreviousID == MCContext::GenericSectionID))
+ if (PreviousID &&
+ (!TM.getSeparateNamedSections() || *PreviousID == MCSection::NonUniqueID))
return *PreviousID;
// If the user has specified the same section name as would be created
@@ -791,7 +791,7 @@ calcUniqueIDUpdateFlagsAndSize(const GlobalObject *GO, StringRef SectionName,
if (SymbolMergeable &&
Ctx.isELFImplicitMergeableSectionNamePrefix(SectionName) &&
SectionName.starts_with(ImplicitSectionNameStem))
- return MCContext::GenericSectionID;
+ return MCSection::NonUniqueID;
// We have seen this section name before, but with different flags or entity
// size. Create a new unique ID.
@@ -903,7 +903,7 @@ static MCSectionELF *selectELFSectionForGlobal(
unsigned EntrySize = getEntrySizeForKind(Kind);
bool UniqueSectionName = false;
- unsigned UniqueID = MCContext::GenericSectionID;
+ unsigned UniqueID = MCSection::NonUniqueID;
if (EmitUniqueSection) {
if (TM.getUniqueSectionNames()) {
UniqueSectionName = true;
@@ -1073,7 +1073,7 @@ MCSection *TargetLoweringObjectFileELF::getSectionForMachineBasicBlock(
const Function &F, const MachineBasicBlock &MBB,
const TargetMachine &TM) const {
assert(MBB.isBeginSection() && "Basic block does not start a section!");
- unsigned UniqueID = MCContext::GenericSectionID;
+ unsigned UniqueID = MCSection::NonUniqueID;
// For cold sections use the .text.split. prefix along with the parent
// function name. All cold blocks for the same function go to the same
@@ -1774,7 +1774,7 @@ MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
else
ComdatGV = GO;
- unsigned UniqueID = MCContext::GenericSectionID;
+ unsigned UniqueID = MCSection::NonUniqueID;
if (EmitUniquedSection)
UniqueID = NextUniqueID++;
@@ -2220,8 +2220,8 @@ MCSection *TargetLoweringObjectFileWasm::getExplicitSectionGlobal(
}
unsigned Flags = getWasmSectionFlags(Kind, Used.count(GO));
- MCSectionWasm *Section = getContext().getWasmSection(
- Name, Kind, Flags, Group, MCContext::GenericSectionID);
+ MCSectionWasm *Section = getContext().getWasmSection(Name, Kind, Flags, Group,
+ MCSection::NonUniqueID);
return Section;
}
@@ -2249,7 +2249,7 @@ selectWasmSectionForGlobal(MCContext &Ctx, const GlobalObject *GO,
Name.push_back('.');
TM.getNameWithPrefix(Name, GO, Mang, true);
}
- unsigned UniqueID = MCContext::GenericSectionID;
+ unsigned UniqueID = MCSection::NonUniqueID;
if (EmitUniqueSection && !UniqueSectionNames) {
UniqueID = *NextUniqueID;
(*NextUniqueID)++;