[llvm] [MC] Rename getPrivateGlobalPrefix to getInternalSymbolPrefix. NFC (PR #185164)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 7 00:24:38 PST 2026
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/185164
Rename the API in both MCAsmInfo and DataLayout as a step toward
adopting the "internal symbol prefix" terminology
(https://sourceware.org/pipermail/binutils/2026-March/148448.html).
The term "internal symbol" better describes the purpose of these
symbols: they are for internal use by compilers and assemblers, not
meant to be visible externally.
>From cdcbe6009ef780a9903a92a03f4585700957f4d9 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Sat, 7 Mar 2026 00:12:08 -0800
Subject: [PATCH] [MC] Rename getPrivateGlobalPrefix to
getInternalSymbolPrefix. NFC
Rename the API in both MCAsmInfo and DataLayout as a step toward
adopting the "internal symbol prefix" terminology
(https://sourceware.org/pipermail/binutils/2026-March/148448.html).
The term "internal symbol" better describes the purpose of these
symbols: they are for internal use by compilers and assemblers, not
meant to be visible externally.
---
bolt/lib/Core/BinaryContext.cpp | 2 +-
bolt/lib/Passes/ReorderData.cpp | 2 +-
bolt/lib/Rewrite/RewriteInstance.cpp | 4 +--
llvm/include/llvm/IR/DataLayout.h | 2 +-
llvm/include/llvm/MC/MCAsmInfo.h | 10 +++----
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 4 +--
.../AsmPrinter/AsmPrinterInlineAsm.cpp | 2 +-
llvm/lib/CodeGen/MachineFunction.cpp | 4 +--
.../CodeGen/TargetLoweringObjectFileImpl.cpp | 2 +-
llvm/lib/IR/Mangler.cpp | 2 +-
llvm/lib/MC/ELFObjectWriter.cpp | 2 +-
llvm/lib/MC/MCContext.cpp | 12 ++++-----
llvm/lib/MC/MCStreamer.cpp | 2 +-
.../Target/AMDGPU/AMDGPUMCResourceInfo.cpp | 2 +-
llvm/lib/Target/ARM/ARMAsmPrinter.cpp | 26 +++++++++----------
llvm/lib/Target/ARM/ARMISelLowering.cpp | 9 +++----
llvm/lib/Target/CSKY/CSKYAsmPrinter.cpp | 6 ++---
llvm/lib/Target/Lanai/LanaiAsmPrinter.cpp | 4 +--
llvm/lib/Target/Lanai/LanaiMCInstLower.cpp | 12 ++++-----
llvm/lib/Target/M68k/M68kAsmPrinter.cpp | 2 +-
llvm/lib/Target/M68k/M68kMCInstLower.cpp | 2 +-
llvm/lib/Target/MSP430/MSP430MCInstLower.cpp | 12 ++++-----
llvm/lib/Target/Mips/MipsAsmPrinter.cpp | 2 +-
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 2 +-
.../Target/PowerPC/PPCMachineFunctionInfo.cpp | 8 +++---
llvm/lib/Target/Sparc/SparcAsmPrinter.cpp | 2 +-
llvm/lib/Target/TargetLoweringObjectFile.cpp | 2 +-
llvm/lib/Target/X86/X86MCInstLower.cpp | 2 +-
llvm/lib/Target/XCore/XCoreAsmPrinter.cpp | 2 +-
llvm/lib/Target/Xtensa/XtensaAsmPrinter.cpp | 2 +-
30 files changed, 73 insertions(+), 74 deletions(-)
diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index f492a91b788ec..5b3baf1669624 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -1870,7 +1870,7 @@ void BinaryContext::preprocessDebugInfo() {
uint64_t NumMissingDWOs = 0;
// Populate MCContext with DWARF files from all units.
- StringRef GlobalPrefix = AsmInfo->getPrivateGlobalPrefix();
+ StringRef GlobalPrefix = AsmInfo->getInternalSymbolPrefix();
for (const std::unique_ptr<DWARFUnit> &CU : DwCtx->compile_units()) {
const uint64_t CUID = CU->getOffset();
DwarfLineTable &BinaryLineTable = getDwarfLineTable(CUID);
diff --git a/bolt/lib/Passes/ReorderData.cpp b/bolt/lib/Passes/ReorderData.cpp
index 2b04361c9463f..fce0c8f12b393 100644
--- a/bolt/lib/Passes/ReorderData.cpp
+++ b/bolt/lib/Passes/ReorderData.cpp
@@ -408,7 +408,7 @@ bool ReorderData::markUnmoveableSymbols(BinaryContext &BC,
// suffix might start in one private symbol and end with the common
// suffix in another.
auto isPrivate = [&](const BinaryData *BD) {
- auto Prefix = std::string("PG") + BC.AsmInfo->getPrivateGlobalPrefix();
+ auto Prefix = std::string("PG") + BC.AsmInfo->getInternalSymbolPrefix();
return BD->getName().starts_with(Prefix.str());
};
auto Range = BC.getBinaryDataForSection(Section);
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 16c9012b1fee6..e45cd7a502b73 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -1041,7 +1041,7 @@ void RewriteInstance::discoverFileObjects() {
/// a local if it has a "private global" prefix, e.g. ".L". Thus we have to
/// change the prefix to enforce global scope of the symbol.
std::string Name =
- SymName.starts_with(BC->AsmInfo->getPrivateGlobalPrefix())
+ SymName.starts_with(BC->AsmInfo->getInternalSymbolPrefix())
? "PG" + std::string(SymName)
: std::string(SymName);
@@ -3231,7 +3231,7 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection,
Name = SymbolName;
} else {
if (StringRef(SymbolName)
- .starts_with(BC->AsmInfo->getPrivateGlobalPrefix()))
+ .starts_with(BC->AsmInfo->getInternalSymbolPrefix()))
Name = NR.uniquify("PG" + SymbolName);
else
Name = NR.uniquify(SymbolName);
diff --git a/llvm/include/llvm/IR/DataLayout.h b/llvm/include/llvm/IR/DataLayout.h
index 4d695e1e5c566..a4f4980520f6b 100644
--- a/llvm/include/llvm/IR/DataLayout.h
+++ b/llvm/include/llvm/IR/DataLayout.h
@@ -299,7 +299,7 @@ class DataLayout {
llvm_unreachable("invalid mangling mode");
}
- StringRef getPrivateGlobalPrefix() const {
+ StringRef getInternalSymbolPrefix() const {
switch (ManglingMode) {
case MM_None:
return "";
diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h
index 92ae4f242ae2f..090d0989411c4 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -154,9 +154,9 @@ class LLVM_ABI MCAsmInfo {
// Do we need to create a local symbol for .size?
bool NeedsLocalForSize = false;
- /// This prefix is used for globals like constant pool entries that are
- /// completely private to the .s file and should not have names in the .o
- /// file. Defaults to "L"
+ /// For internal use by compiler and assembler, not meant to be visible
+ /// externally. They are usually not emitted to the symbol table in the
+ /// object file.
StringRef PrivateGlobalPrefix = "L";
/// This prefix is used for labels for basic blocks. Defaults to "L"
@@ -544,7 +544,7 @@ class LLVM_ABI MCAsmInfo {
bool usesSetToEquateSymbol() const { return UsesSetToEquateSymbol; }
bool useAssignmentForEHBegin() const { return UseAssignmentForEHBegin; }
bool needsLocalForSize() const { return NeedsLocalForSize; }
- StringRef getPrivateGlobalPrefix() const { return PrivateGlobalPrefix; }
+ StringRef getInternalSymbolPrefix() const { return PrivateGlobalPrefix; }
StringRef getPrivateLabelPrefix() const { return PrivateLabelPrefix; }
bool hasLinkerPrivateGlobalPrefix() const {
@@ -554,7 +554,7 @@ class LLVM_ABI MCAsmInfo {
StringRef getLinkerPrivateGlobalPrefix() const {
if (hasLinkerPrivateGlobalPrefix())
return LinkerPrivateGlobalPrefix;
- return getPrivateGlobalPrefix();
+ return getInternalSymbolPrefix();
}
const char *getInlineAsmStart() const { return InlineAsmStart; }
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 2f83be4a071eb..8787401888168 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -4528,7 +4528,7 @@ MCSymbol *AsmPrinter::GetCPISymbol(unsigned CPID) const {
}
const DataLayout &DL = getDataLayout();
- return OutContext.getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
+ return OutContext.getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
"CPI" + Twine(getFunctionNumber()) + "_" +
Twine(CPID));
}
@@ -4542,7 +4542,7 @@ MCSymbol *AsmPrinter::GetJTISymbol(unsigned JTID, bool isLinkerPrivate) const {
/// FIXME: privatize to AsmPrinter.
MCSymbol *AsmPrinter::GetJTSetSymbol(unsigned UID, unsigned MBBID) const {
const DataLayout &DL = getDataLayout();
- return OutContext.getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
+ return OutContext.getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
Twine(getFunctionNumber()) + "_" +
Twine(UID) + "_set_" + Twine(MBBID));
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index ae9fff80133d0..b649c41f56208 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -435,7 +435,7 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, raw_ostream &OS,
StringRef Code) const {
if (Code == "private") {
const DataLayout &DL = MF->getDataLayout();
- OS << DL.getPrivateGlobalPrefix();
+ OS << DL.getInternalSymbolPrefix();
} else if (Code == "comment") {
OS << MAI->getCommentString();
} else if (Code == "uid") {
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 71ddafbbd7876..7ab7b65e8350f 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -820,7 +820,7 @@ MCSymbol *MachineFunction::getJTISymbol(unsigned JTI, MCContext &Ctx,
assert(JTI < JumpTableInfo->getJumpTables().size() && "Invalid JTI!");
StringRef Prefix = isLinkerPrivate ? DL.getLinkerPrivateGlobalPrefix()
- : DL.getPrivateGlobalPrefix();
+ : DL.getInternalSymbolPrefix();
SmallString<60> Name;
raw_svector_ostream(Name)
<< Prefix << "JTI" << getFunctionNumber() << '_' << JTI;
@@ -830,7 +830,7 @@ MCSymbol *MachineFunction::getJTISymbol(unsigned JTI, MCContext &Ctx,
/// Return a function-local symbol to represent the PIC base.
MCSymbol *MachineFunction::getPICBaseSymbol() const {
const DataLayout &DL = getDataLayout();
- return Ctx.getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
+ return Ctx.getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
Twine(getFunctionNumber()) + "$pb");
}
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index d3a8f0519f8dd..40ddbca84b111 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -1594,7 +1594,7 @@ const MCExpr *TargetLoweringObjectFileMachO::getIndirectSymViaGOTPCRel(
// non_lazy_ptr stubs.
SmallString<128> Name;
StringRef Suffix = "$non_lazy_ptr";
- Name += MMI->getModule()->getDataLayout().getPrivateGlobalPrefix();
+ Name += MMI->getModule()->getDataLayout().getInternalSymbolPrefix();
Name += Sym->getName();
Name += Suffix;
MCSymbol *Stub = Ctx.getOrCreateSymbol(Name);
diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp
index 43e8485434d9d..ae94af71111cd 100644
--- a/llvm/lib/IR/Mangler.cpp
+++ b/llvm/lib/IR/Mangler.cpp
@@ -50,7 +50,7 @@ static void getNameWithPrefixImpl(raw_ostream &OS, const Twine &GVName,
Prefix = '\0';
if (PrefixTy == Private)
- OS << DL.getPrivateGlobalPrefix();
+ OS << DL.getInternalSymbolPrefix();
else if (PrefixTy == LinkerPrivate)
OS << DL.getLinkerPrivateGlobalPrefix();
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index b23fa92ac194d..9aa9083549573 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -1367,7 +1367,7 @@ void ELFObjectWriter::recordRelocation(const MCFragment &F,
UseSectionSym = RSS == RelocSectionSymType::All ||
(RSS == RelocSectionSymType::Internal &&
SymA->getName().starts_with(
- Ctx.getAsmInfo()->getPrivateGlobalPrefix()));
+ Ctx.getAsmInfo()->getInternalSymbolPrefix()));
}
if (UseSectionSym && useSectionSymbol(Target, SymA, Addend, Type)) {
Addend += Asm->getSymbolOffset(*SymA);
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 36dcdd68cb80b..37331c8b88511 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -208,7 +208,7 @@ MCSymbol *MCContext::getOrCreateSymbol(const Twine &Name) {
MCSymbolTableEntry &Entry = getSymbolTableEntry(NameRef);
if (!Entry.second.Symbol) {
- bool IsRenamable = NameRef.starts_with(MAI->getPrivateGlobalPrefix());
+ bool IsRenamable = NameRef.starts_with(MAI->getInternalSymbolPrefix());
bool IsTemporary = IsRenamable && !SaveTempLabels;
if (!Entry.second.Used) {
Entry.second.Used = true;
@@ -253,17 +253,17 @@ MCSymbol *MCContext::parseSymbol(const Twine &Name) {
MCSymbol *MCContext::getOrCreateFrameAllocSymbol(const Twine &FuncName,
unsigned Idx) {
- return getOrCreateSymbol(MAI->getPrivateGlobalPrefix() + FuncName +
+ return getOrCreateSymbol(MAI->getInternalSymbolPrefix() + FuncName +
"$frame_escape_" + Twine(Idx));
}
MCSymbol *MCContext::getOrCreateParentFrameOffsetSymbol(const Twine &FuncName) {
- return getOrCreateSymbol(MAI->getPrivateGlobalPrefix() + FuncName +
+ return getOrCreateSymbol(MAI->getInternalSymbolPrefix() + FuncName +
"$parent_frame_offset");
}
MCSymbol *MCContext::getOrCreateLSDASymbol(const Twine &FuncName) {
- return getOrCreateSymbol(MAI->getPrivateGlobalPrefix() + "__ehtable$" +
+ return getOrCreateSymbol(MAI->getInternalSymbolPrefix() + "__ehtable$" +
FuncName);
}
@@ -360,12 +360,12 @@ MCSymbol *MCContext::createRenamableSymbol(const Twine &Name,
MCSymbol *MCContext::createTempSymbol(const Twine &Name, bool AlwaysAddSuffix) {
if (!UseNamesOnTempLabels)
return createSymbolImpl(nullptr, /*IsTemporary=*/true);
- return createRenamableSymbol(MAI->getPrivateGlobalPrefix() + Name,
+ return createRenamableSymbol(MAI->getInternalSymbolPrefix() + Name,
AlwaysAddSuffix, /*IsTemporary=*/true);
}
MCSymbol *MCContext::createNamedTempSymbol(const Twine &Name) {
- return createRenamableSymbol(MAI->getPrivateGlobalPrefix() + Name, true,
+ return createRenamableSymbol(MAI->getInternalSymbolPrefix() + Name, true,
/*IsTemporary=*/!SaveTempLabels);
}
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index a913528d53a70..35203b904fbe6 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -249,7 +249,7 @@ void MCStreamer::emitDwarfLocLabelDirective(SMLoc Loc, StringRef Name) {
MCSymbol *MCStreamer::getDwarfLineTableSymbol(unsigned CUID) {
MCDwarfLineTable &Table = getContext().getMCDwarfLineTable(CUID);
if (!Table.getLabel()) {
- StringRef Prefix = Context.getAsmInfo()->getPrivateGlobalPrefix();
+ StringRef Prefix = Context.getAsmInfo()->getInternalSymbolPrefix();
Table.setLabel(
Context.getOrCreateSymbol(Prefix + "line_table_start" + Twine(CUID)));
}
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp
index 6b3cdf57f3ad6..8186c329c4daf 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp
@@ -28,7 +28,7 @@ MCSymbol *MCResourceInfo::getSymbol(StringRef FuncName, ResourceInfoKind RIK,
MCContext &OutContext, bool IsLocal) {
auto GOCS = [FuncName, &OutContext, IsLocal](StringRef Suffix) {
StringRef Prefix =
- IsLocal ? OutContext.getAsmInfo()->getPrivateGlobalPrefix() : "";
+ IsLocal ? OutContext.getAsmInfo()->getInternalSymbolPrefix() : "";
return OutContext.getOrCreateSymbol(Twine(Prefix) + FuncName +
Twine(Suffix));
};
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
index f414672b825ac..fb2bbb5680156 100644
--- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -299,7 +299,7 @@ MCSymbol *ARMAsmPrinter::GetCPISymbol(unsigned CPID) const {
// The AsmPrinter::GetCPISymbol superclass method tries to use CPID as
// indexes in MachineConstantPool, which isn't in sync with indexes used here.
const DataLayout &DL = getDataLayout();
- return OutContext.getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
+ return OutContext.getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
"CPI" + Twine(getFunctionNumber()) + "_" +
Twine(CPID));
}
@@ -310,7 +310,7 @@ MCSymbol *ARMAsmPrinter::
GetARMJTIPICJumpTableLabel(unsigned uid) const {
const DataLayout &DL = getDataLayout();
SmallString<60> Name;
- raw_svector_ostream(Name) << DL.getPrivateGlobalPrefix() << "JTI"
+ raw_svector_ostream(Name) << DL.getInternalSymbolPrefix() << "JTI"
<< getFunctionNumber() << '_' << uid;
return OutContext.getOrCreateSymbol(Name);
}
@@ -1031,7 +1031,7 @@ void ARMAsmPrinter::emitMachineConstantPoolValue(
if (ACPV->getPCAdjustment()) {
MCSymbol *PCLabel =
- getPICLabel(DL.getPrivateGlobalPrefix(), getFunctionNumber(),
+ getPICLabel(DL.getInternalSymbolPrefix(), getFunctionNumber(),
ACPV->getLabelId(), OutContext);
const MCExpr *PCRelExpr = MCSymbolRefExpr::create(PCLabel, OutContext);
PCRelExpr =
@@ -2110,7 +2110,7 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
const MCExpr *GVSymExpr = MCSymbolRefExpr::create(GVSym, OutContext);
MCSymbol *LabelSym =
- getPICLabel(DL.getPrivateGlobalPrefix(), getFunctionNumber(),
+ getPICLabel(DL.getInternalSymbolPrefix(), getFunctionNumber(),
MI->getOperand(2).getImm(), OutContext);
const MCExpr *LabelSymExpr= MCSymbolRefExpr::create(LabelSym, OutContext);
unsigned PCAdj = (Opc == ARM::MOVi16_ga_pcrel) ? 8 : 4;
@@ -2146,7 +2146,7 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
const MCExpr *GVSymExpr = MCSymbolRefExpr::create(GVSym, OutContext);
MCSymbol *LabelSym =
- getPICLabel(DL.getPrivateGlobalPrefix(), getFunctionNumber(),
+ getPICLabel(DL.getInternalSymbolPrefix(), getFunctionNumber(),
MI->getOperand(3).getImm(), OutContext);
const MCExpr *LabelSymExpr= MCSymbolRefExpr::create(LabelSym, OutContext);
unsigned PCAdj = (Opc == ARM::MOVTi16_ga_pcrel) ? 8 : 4;
@@ -2175,7 +2175,7 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
// This is a Branch Future instruction.
const MCExpr *BranchLabel = MCSymbolRefExpr::create(
- getBFLabel(DL.getPrivateGlobalPrefix(), getFunctionNumber(),
+ getBFLabel(DL.getInternalSymbolPrefix(), getFunctionNumber(),
MI->getOperand(0).getIndex(), OutContext),
OutContext);
@@ -2205,7 +2205,7 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
if (Opc == ARM::t2BFic) {
const MCExpr *ElseLabel = MCSymbolRefExpr::create(
- getBFLabel(DL.getPrivateGlobalPrefix(), getFunctionNumber(),
+ getBFLabel(DL.getInternalSymbolPrefix(), getFunctionNumber(),
MI->getOperand(2).getIndex(), OutContext),
OutContext);
MCInst.addExpr(ElseLabel);
@@ -2222,9 +2222,9 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
// This is a pseudo op for a label used by a branch future instruction
// Emit the label.
- OutStreamer->emitLabel(getBFLabel(DL.getPrivateGlobalPrefix(),
- getFunctionNumber(),
- MI->getOperand(0).getIndex(), OutContext));
+ OutStreamer->emitLabel(
+ getBFLabel(DL.getInternalSymbolPrefix(), getFunctionNumber(),
+ MI->getOperand(0).getIndex(), OutContext));
return;
}
case ARM::tPICADD: {
@@ -2234,7 +2234,7 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
// This adds the address of LPC0 to r0.
// Emit the label.
- OutStreamer->emitLabel(getPICLabel(DL.getPrivateGlobalPrefix(),
+ OutStreamer->emitLabel(getPICLabel(DL.getInternalSymbolPrefix(),
getFunctionNumber(),
MI->getOperand(2).getImm(), OutContext));
@@ -2255,7 +2255,7 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
// This adds the address of LPC0 to r0.
// Emit the label.
- OutStreamer->emitLabel(getPICLabel(DL.getPrivateGlobalPrefix(),
+ OutStreamer->emitLabel(getPICLabel(DL.getInternalSymbolPrefix(),
getFunctionNumber(),
MI->getOperand(2).getImm(), OutContext));
@@ -2286,7 +2286,7 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
// a PC-relative address at the ldr instruction.
// Emit the label.
- OutStreamer->emitLabel(getPICLabel(DL.getPrivateGlobalPrefix(),
+ OutStreamer->emitLabel(getPICLabel(DL.getInternalSymbolPrefix(),
getFunctionNumber(),
MI->getOperand(2).getImm(), OutContext));
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index cb95356f9cd91..d4f01d0c5879f 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -3201,11 +3201,10 @@ SDValue ARMTargetLowering::LowerConstantPool(SDValue Op,
auto C = const_cast<Constant*>(CP->getConstVal());
auto M = DAG.getMachineFunction().getFunction().getParent();
auto GV = new GlobalVariable(
- *M, T, /*isConstant=*/true, GlobalVariable::InternalLinkage, C,
- Twine(DAG.getDataLayout().getPrivateGlobalPrefix()) + "CP" +
- Twine(DAG.getMachineFunction().getFunctionNumber()) + "_" +
- Twine(AFI->createPICLabelUId())
- );
+ *M, T, /*isConstant=*/true, GlobalVariable::InternalLinkage, C,
+ Twine(DAG.getDataLayout().getInternalSymbolPrefix()) + "CP" +
+ Twine(DAG.getMachineFunction().getFunctionNumber()) + "_" +
+ Twine(AFI->createPICLabelUId()));
SDValue GA = DAG.getTargetGlobalAddress(dyn_cast<GlobalValue>(GV),
dl, PtrVT);
return LowerGlobalAddress(GA, DAG);
diff --git a/llvm/lib/Target/CSKY/CSKYAsmPrinter.cpp b/llvm/lib/Target/CSKY/CSKYAsmPrinter.cpp
index 7e1eb9d9ec43a..9128160e95038 100644
--- a/llvm/lib/Target/CSKY/CSKYAsmPrinter.cpp
+++ b/llvm/lib/Target/CSKY/CSKYAsmPrinter.cpp
@@ -72,8 +72,8 @@ void CSKYAsmPrinter::expandTLSLA(const MachineInstr *MI) {
DebugLoc DL = MI->getDebugLoc();
MCSymbol *PCLabel = OutContext.getOrCreateSymbol(
- Twine(MAI->getPrivateGlobalPrefix()) + "PC" + Twine(getFunctionNumber()) +
- "_" + Twine(MI->getOperand(3).getImm()));
+ Twine(MAI->getInternalSymbolPrefix()) + "PC" +
+ Twine(getFunctionNumber()) + "_" + Twine(MI->getOperand(3).getImm()));
OutStreamer->emitLabel(PCLabel);
@@ -223,7 +223,7 @@ void CSKYAsmPrinter::emitMachineConstantPoolValue(
if (CCPV->getPCAdjustment()) {
MCSymbol *PCLabel = OutContext.getOrCreateSymbol(
- Twine(MAI->getPrivateGlobalPrefix()) + "PC" +
+ Twine(MAI->getInternalSymbolPrefix()) + "PC" +
Twine(getFunctionNumber()) + "_" + Twine(CCPV->getLabelID()));
const MCExpr *PCRelExpr = MCSymbolRefExpr::create(PCLabel, OutContext);
diff --git a/llvm/lib/Target/Lanai/LanaiAsmPrinter.cpp b/llvm/lib/Target/Lanai/LanaiAsmPrinter.cpp
index 24e4fc3f53e63..b245492a18847 100644
--- a/llvm/lib/Target/Lanai/LanaiAsmPrinter.cpp
+++ b/llvm/lib/Target/Lanai/LanaiAsmPrinter.cpp
@@ -91,12 +91,12 @@ void LanaiAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
break;
case MachineOperand::MO_JumpTableIndex:
- O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << '_'
+ O << MAI->getInternalSymbolPrefix() << "JTI" << getFunctionNumber() << '_'
<< MO.getIndex();
break;
case MachineOperand::MO_ConstantPoolIndex:
- O << MAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_'
+ O << MAI->getInternalSymbolPrefix() << "CPI" << getFunctionNumber() << '_'
<< MO.getIndex();
return;
diff --git a/llvm/lib/Target/Lanai/LanaiMCInstLower.cpp b/llvm/lib/Target/Lanai/LanaiMCInstLower.cpp
index b0db8d0887689..4f409a0db55ce 100644
--- a/llvm/lib/Target/Lanai/LanaiMCInstLower.cpp
+++ b/llvm/lib/Target/Lanai/LanaiMCInstLower.cpp
@@ -45,9 +45,9 @@ LanaiMCInstLower::GetExternalSymbolSymbol(const MachineOperand &MO) const {
MCSymbol *LanaiMCInstLower::GetJumpTableSymbol(const MachineOperand &MO) const {
SmallString<256> Name;
- raw_svector_ostream(Name) << Printer.MAI->getPrivateGlobalPrefix() << "JTI"
- << Printer.getFunctionNumber() << '_'
- << MO.getIndex();
+ raw_svector_ostream(Name)
+ << Printer.MAI->getInternalSymbolPrefix() << "JTI"
+ << Printer.getFunctionNumber() << '_' << MO.getIndex();
// Create a symbol for the name.
return Ctx.getOrCreateSymbol(Name.str());
}
@@ -55,9 +55,9 @@ MCSymbol *LanaiMCInstLower::GetJumpTableSymbol(const MachineOperand &MO) const {
MCSymbol *
LanaiMCInstLower::GetConstantPoolIndexSymbol(const MachineOperand &MO) const {
SmallString<256> Name;
- raw_svector_ostream(Name) << Printer.MAI->getPrivateGlobalPrefix() << "CPI"
- << Printer.getFunctionNumber() << '_'
- << MO.getIndex();
+ raw_svector_ostream(Name)
+ << Printer.MAI->getInternalSymbolPrefix() << "CPI"
+ << Printer.getFunctionNumber() << '_' << MO.getIndex();
// Create a symbol for the name.
return Ctx.getOrCreateSymbol(Name.str());
}
diff --git a/llvm/lib/Target/M68k/M68kAsmPrinter.cpp b/llvm/lib/Target/M68k/M68kAsmPrinter.cpp
index 1853b2bbe9291..13f7612fdd14f 100644
--- a/llvm/lib/Target/M68k/M68kAsmPrinter.cpp
+++ b/llvm/lib/Target/M68k/M68kAsmPrinter.cpp
@@ -55,7 +55,7 @@ void M68kAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
break;
case MachineOperand::MO_ConstantPoolIndex: {
const DataLayout &DL = getDataLayout();
- OS << DL.getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_'
+ OS << DL.getInternalSymbolPrefix() << "CPI" << getFunctionNumber() << '_'
<< MO.getIndex();
break;
}
diff --git a/llvm/lib/Target/M68k/M68kMCInstLower.cpp b/llvm/lib/Target/M68k/M68kMCInstLower.cpp
index 301112c41efb7..13a1d742893ab 100644
--- a/llvm/lib/Target/M68k/M68kMCInstLower.cpp
+++ b/llvm/lib/Target/M68k/M68kMCInstLower.cpp
@@ -52,7 +52,7 @@ M68kMCInstLower::GetSymbolFromOperand(const MachineOperand &MO) const {
StringRef Suffix;
if (!Suffix.empty())
- Name += DL.getPrivateGlobalPrefix();
+ Name += DL.getInternalSymbolPrefix();
if (MO.isGlobal()) {
const GlobalValue *GV = MO.getGlobal();
diff --git a/llvm/lib/Target/MSP430/MSP430MCInstLower.cpp b/llvm/lib/Target/MSP430/MSP430MCInstLower.cpp
index 52c037de76606..49cd8bddcaa05 100644
--- a/llvm/lib/Target/MSP430/MSP430MCInstLower.cpp
+++ b/llvm/lib/Target/MSP430/MSP430MCInstLower.cpp
@@ -51,9 +51,9 @@ MCSymbol *MSP430MCInstLower::
GetJumpTableSymbol(const MachineOperand &MO) const {
const DataLayout &DL = Printer.getDataLayout();
SmallString<256> Name;
- raw_svector_ostream(Name) << DL.getPrivateGlobalPrefix() << "JTI"
- << Printer.getFunctionNumber() << '_'
- << MO.getIndex();
+ raw_svector_ostream(Name)
+ << DL.getInternalSymbolPrefix() << "JTI" << Printer.getFunctionNumber()
+ << '_' << MO.getIndex();
switch (MO.getTargetFlags()) {
default: llvm_unreachable("Unknown target flag on GV operand");
@@ -68,9 +68,9 @@ MCSymbol *MSP430MCInstLower::
GetConstantPoolIndexSymbol(const MachineOperand &MO) const {
const DataLayout &DL = Printer.getDataLayout();
SmallString<256> Name;
- raw_svector_ostream(Name) << DL.getPrivateGlobalPrefix() << "CPI"
- << Printer.getFunctionNumber() << '_'
- << MO.getIndex();
+ raw_svector_ostream(Name)
+ << DL.getInternalSymbolPrefix() << "CPI" << Printer.getFunctionNumber()
+ << '_' << MO.getIndex();
switch (MO.getTargetFlags()) {
default: llvm_unreachable("Unknown target flag on GV operand");
diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
index a0e5872da5e6e..715b96e52e6c8 100644
--- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -660,7 +660,7 @@ void MipsAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
}
case MachineOperand::MO_ConstantPoolIndex:
- O << getDataLayout().getPrivateGlobalPrefix() << "CPI"
+ O << getDataLayout().getInternalSymbolPrefix() << "CPI"
<< getFunctionNumber() << "_" << MO.getIndex();
if (MO.getOffset())
O << "+" << MO.getOffset();
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 64102e7b6fdae..9a60d7acab84a 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -360,7 +360,7 @@ void PPCAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
MO.getMBB()->getSymbol()->print(O, MAI);
return;
case MachineOperand::MO_ConstantPoolIndex:
- O << DL.getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_'
+ O << DL.getInternalSymbolPrefix() << "CPI" << getFunctionNumber() << '_'
<< MO.getIndex();
return;
case MachineOperand::MO_BlockAddress:
diff --git a/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp b/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
index b2089521c4674..43c667e7f04aa 100644
--- a/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
@@ -33,28 +33,28 @@ PPCFunctionInfo::clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,
MCSymbol *PPCFunctionInfo::getPICOffsetSymbol(MachineFunction &MF) const {
const DataLayout &DL = MF.getDataLayout();
- return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
+ return MF.getContext().getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
Twine(MF.getFunctionNumber()) +
"$poff");
}
MCSymbol *PPCFunctionInfo::getGlobalEPSymbol(MachineFunction &MF) const {
const DataLayout &DL = MF.getDataLayout();
- return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
+ return MF.getContext().getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
"func_gep" +
Twine(MF.getFunctionNumber()));
}
MCSymbol *PPCFunctionInfo::getLocalEPSymbol(MachineFunction &MF) const {
const DataLayout &DL = MF.getDataLayout();
- return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
+ return MF.getContext().getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
"func_lep" +
Twine(MF.getFunctionNumber()));
}
MCSymbol *PPCFunctionInfo::getTOCOffsetSymbol(MachineFunction &MF) const {
const DataLayout &DL = MF.getDataLayout();
- return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
+ return MF.getContext().getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
"func_toc" +
Twine(MF.getFunctionNumber()));
}
diff --git a/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp b/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
index f1d487c87d6f3..96cbb262aa170 100644
--- a/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
+++ b/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
@@ -403,7 +403,7 @@ void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
O << MO.getSymbolName();
break;
case MachineOperand::MO_ConstantPoolIndex:
- O << DL.getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_"
+ O << DL.getInternalSymbolPrefix() << "CPI" << getFunctionNumber() << "_"
<< MO.getIndex();
break;
case MachineOperand::MO_Metadata:
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index 008ac70777482..83acd956b7a7b 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -130,7 +130,7 @@ MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
assert(!Suffix.empty());
SmallString<60> NameStr;
- NameStr += GV->getDataLayout().getPrivateGlobalPrefix();
+ NameStr += GV->getDataLayout().getInternalSymbolPrefix();
TM.getNameWithPrefix(NameStr, GV, *Mang);
NameStr.append(Suffix.begin(), Suffix.end());
return getContext().getOrCreateSymbol(NameStr);
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index 4ef4718e1b01c..0d4131632ff56 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -181,7 +181,7 @@ MCSymbol *X86MCInstLower::GetSymbolFromOperand(const MachineOperand &MO) const {
}
if (!Suffix.empty())
- Name += DL.getPrivateGlobalPrefix();
+ Name += DL.getInternalSymbolPrefix();
if (MO.isGlobal()) {
const GlobalValue *GV = MO.getGlobal();
diff --git a/llvm/lib/Target/XCore/XCoreAsmPrinter.cpp b/llvm/lib/Target/XCore/XCoreAsmPrinter.cpp
index 0426088caf244..ed16e34ae7724 100644
--- a/llvm/lib/Target/XCore/XCoreAsmPrinter.cpp
+++ b/llvm/lib/Target/XCore/XCoreAsmPrinter.cpp
@@ -213,7 +213,7 @@ void XCoreAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
PrintSymbolOperand(MO, O);
break;
case MachineOperand::MO_ConstantPoolIndex:
- O << DL.getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_'
+ O << DL.getInternalSymbolPrefix() << "CPI" << getFunctionNumber() << '_'
<< MO.getIndex();
break;
case MachineOperand::MO_BlockAddress:
diff --git a/llvm/lib/Target/Xtensa/XtensaAsmPrinter.cpp b/llvm/lib/Target/Xtensa/XtensaAsmPrinter.cpp
index 4d07400e996ba..c6e432fb9918c 100644
--- a/llvm/lib/Target/Xtensa/XtensaAsmPrinter.cpp
+++ b/llvm/lib/Target/Xtensa/XtensaAsmPrinter.cpp
@@ -85,7 +85,7 @@ void XtensaAsmPrinter::emitMachineConstantPoolValue(
if (XtensaSym->isPrivateLinkage()) {
const DataLayout &DL = getDataLayout();
- MCSym = OutContext.getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
+ MCSym = OutContext.getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
SymName);
} else {
MCSym = OutContext.getOrCreateSymbol(SymName);
More information about the llvm-commits
mailing list