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 &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..2649e080989c2 100644 --- a/llvm/include/llvm/MC/MCAsmInfo.h +++ b/llvm/include/llvm/MC/MCAsmInfo.h @@ -154,10 +154,10 @@ 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" - StringRef PrivateGlobalPrefix = "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 InternalSymbolPrefix = "L"; /// This prefix is used for labels for basic blocks. Defaults to "L" StringRef PrivateLabelPrefix = "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 InternalSymbolPrefix; } 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/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h index c5de76bd30b3f..ccc5cecd8ee80 100644 --- a/llvm/include/llvm/MC/MCContext.h +++ b/llvm/include/llvm/MC/MCContext.h @@ -460,7 +460,7 @@ class MCContext { /// Get or create a symbol for a basic block. For non-always-emit symbols, /// this behaves like createTempSymbol, except that it uses the - /// PrivateLabelPrefix instead of the PrivateGlobalPrefix. When AlwaysEmit is + /// PrivateLabelPrefix instead of the InternalSymbolPrefix. When AlwaysEmit is /// true, behaves like getOrCreateSymbol, prefixed with PrivateLabelPrefix. LLVM_ABI MCSymbol *createBlockSymbol(const Twine &Name, bool AlwaysEmit = false); 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/MCAsmInfoELF.cpp b/llvm/lib/MC/MCAsmInfoELF.cpp index 6beed71d904af..0aa062d31f4a0 100644 --- a/llvm/lib/MC/MCAsmInfoELF.cpp +++ b/llvm/lib/MC/MCAsmInfoELF.cpp @@ -44,7 +44,7 @@ MCAsmInfoELF::MCAsmInfoELF() { HasIdentDirective = true; HasPreferredAlignment = true; WeakRefDirective = "\t.weak\t"; - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; PrivateLabelPrefix = ".L"; } diff --git a/llvm/lib/MC/MCAsmInfoGOFF.cpp b/llvm/lib/MC/MCAsmInfoGOFF.cpp index 325854a0e740f..7aadabb1e4145 100644 --- a/llvm/lib/MC/MCAsmInfoGOFF.cpp +++ b/llvm/lib/MC/MCAsmInfoGOFF.cpp @@ -22,7 +22,7 @@ using namespace llvm; MCAsmInfoGOFF::MCAsmInfoGOFF() { Data64bitsDirective = "\t.quad\t"; WeakRefDirective = "WXTRN"; - PrivateGlobalPrefix = "L#"; + InternalSymbolPrefix = "L#"; PrivateLabelPrefix = "L#"; ZeroDirective = "\t.space\t"; } diff --git a/llvm/lib/MC/MCAsmInfoWasm.cpp b/llvm/lib/MC/MCAsmInfoWasm.cpp index 5e44f48c3c082..7af35dce343df 100644 --- a/llvm/lib/MC/MCAsmInfoWasm.cpp +++ b/llvm/lib/MC/MCAsmInfoWasm.cpp @@ -22,7 +22,7 @@ MCAsmInfoWasm::MCAsmInfoWasm() { HasIdentDirective = true; HasNoDeadStrip = true; WeakRefDirective = "\t.weak\t"; - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; PrivateLabelPrefix = ".L"; } diff --git a/llvm/lib/MC/MCAsmInfoXCOFF.cpp b/llvm/lib/MC/MCAsmInfoXCOFF.cpp index 0403b4409f2ec..8999732ce0824 100644 --- a/llvm/lib/MC/MCAsmInfoXCOFF.cpp +++ b/llvm/lib/MC/MCAsmInfoXCOFF.cpp @@ -24,7 +24,7 @@ MCAsmInfoXCOFF::MCAsmInfoXCOFF() { IsAIX = true; IsLittleEndian = false; - PrivateGlobalPrefix = "L.."; + InternalSymbolPrefix = "L.."; PrivateLabelPrefix = "L.."; SupportsQuotedNames = false; if (UseLEB128Directives == cl::BOU_UNSET) 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/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp index ff7831e752b8a..8c7336084c232 100644 --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp @@ -142,7 +142,7 @@ AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin(bool IsILP32) { // form when targeting Darwin. AssemblerDialect = AsmWriterVariant == Default ? Apple : AsmWriterVariant; - PrivateGlobalPrefix = "L"; + InternalSymbolPrefix = "L"; PrivateLabelPrefix = "L"; SeparatorString = "%%"; CommentString = ";"; @@ -215,7 +215,7 @@ AArch64MCAsmInfoELF::AArch64MCAsmInfoELF(const Triple &T) { AlignmentIsInBytes = false; CommentString = "//"; - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; PrivateLabelPrefix = ".L"; Data16bitsDirective = "\t.hword\t"; @@ -256,7 +256,7 @@ bool AArch64MCAsmInfoELF::evaluateAsRelocatableImpl( } AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() { - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; PrivateLabelPrefix = ".L"; Data16bitsDirective = "\t.hword\t"; @@ -286,7 +286,7 @@ bool AArch64MCAsmInfoMicrosoftCOFF::evaluateAsRelocatableImpl( } AArch64MCAsmInfoGNUCOFF::AArch64MCAsmInfoGNUCOFF() { - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; PrivateLabelPrefix = ".L"; Data16bitsDirective = "\t.hword\t"; 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/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.h b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.h index 65c9b1917bf8c..abe8265e253d8 100644 --- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.h +++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.h @@ -19,9 +19,9 @@ namespace llvm { class Triple; // If you need to create another MCAsmInfo class, which inherits from MCAsmInfo, -// you will need to make sure your new class sets PrivateGlobalPrefix to +// you will need to make sure your new class sets InternalSymbolPrefix to // a prefix that won't appear in a function name. The default value -// for PrivateGlobalPrefix is 'L', so it will consider any function starting +// for InternalSymbolPrefix is 'L', so it will consider any function starting // with 'L' as a local symbol. class AMDGPUMCAsmInfo : public MCAsmInfoELF { public: 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(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(GV), dl, PtrVT); return LowerGlobalAddress(GA, DAG); diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp index 8672836c16029..7fcdedf76597c 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp @@ -119,7 +119,7 @@ ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() { SupportsDebugInformation = true; ExceptionsType = ExceptionHandling::WinEH; WinEHEncodingType = WinEH::EncodingType::Itanium; - PrivateGlobalPrefix = "$M"; + InternalSymbolPrefix = "$M"; PrivateLabelPrefix = "$M"; CommentString = "@"; @@ -136,7 +136,7 @@ ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() { HasSingleParameterDotFile = true; CommentString = "@"; - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; PrivateLabelPrefix = ".L"; SupportsDebugInformation = true; diff --git a/llvm/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h b/llvm/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h index 8d8066a55b43e..b5913b8575f5d 100644 --- a/llvm/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h +++ b/llvm/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h @@ -24,7 +24,7 @@ class BPFMCAsmInfo : public MCAsmInfoELF { if (TT.getArch() == Triple::bpfeb) IsLittleEndian = false; - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; PrivateLabelPrefix = "L"; WeakRefDirective = "\t.weak\t"; 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/Lanai/MCTargetDesc/LanaiMCAsmInfo.cpp b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCAsmInfo.cpp index 6ad018c12a28b..14efd00ecf696 100644 --- a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCAsmInfo.cpp +++ b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCAsmInfo.cpp @@ -22,7 +22,7 @@ void LanaiMCAsmInfo::anchor() {} LanaiMCAsmInfo::LanaiMCAsmInfo(const Triple & /*TheTriple*/, const MCTargetOptions &Options) { IsLittleEndian = false; - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; WeakRefDirective = "\t.weak\t"; ExceptionsType = ExceptionHandling::DwarfCFI; 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/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index f91c378ad0afa..78983bea06ccd 100644 --- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -2956,7 +2956,7 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr, static_cast(Res.getAddSym())->getBinding() == ELF::STB_LOCAL); // For O32, "$"-prefixed symbols are recognized as temporary while - // .L-prefixed symbols are not (PrivateGlobalPrefix is "$"). Recognize ".L" + // .L-prefixed symbols are not (InternalSymbolPrefix is "$"). Recognize ".L" // manually. if (ABI.IsO32() && Res.getAddSym()->getName().starts_with(".L")) IsLocalSym = true; diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp index e04aa9cae1d8c..d4665a010d419 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp @@ -31,10 +31,10 @@ MipsELFMCAsmInfo::MipsELFMCAsmInfo(const Triple &TheTriple, CodePointerSize = CalleeSaveStackSlotSize = 8; if (ABI.IsO32()) - PrivateGlobalPrefix = "$"; + InternalSymbolPrefix = "$"; else if (ABI.IsN32() || ABI.IsN64()) - PrivateGlobalPrefix = ".L"; - PrivateLabelPrefix = PrivateGlobalPrefix; + InternalSymbolPrefix = ".L"; + PrivateLabelPrefix = InternalSymbolPrefix; AlignmentIsInBytes = false; Data16bitsDirective = "\t.2byte\t"; @@ -56,7 +56,7 @@ MipsCOFFMCAsmInfo::MipsCOFFMCAsmInfo() { ExceptionsType = ExceptionHandling::WinEH; - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; PrivateLabelPrefix = ".L"; AllowAtInName = true; } 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/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp index ce9cd12e26a4a..eed4f1b62e324 100644 --- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp +++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp @@ -47,8 +47,8 @@ NVPTXMCAsmInfo::NVPTXMCAsmInfo(const Triple &TheTriple, SupportsExtendedDwarfLocDirective = false; SupportsSignedData = false; - PrivateGlobalPrefix = "$L__"; - PrivateLabelPrefix = PrivateGlobalPrefix; + InternalSymbolPrefix = "$L__"; + PrivateLabelPrefix = InternalSymbolPrefix; // @TODO: Can we just disable this? WeakDirective = "\t// .weak\t"; 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/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp index fe852b64711b3..f0ad3071cd651 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp @@ -60,7 +60,7 @@ void RISCVMCAsmInfo::printSpecifierExpr(raw_ostream &OS, RISCVMCAsmInfoDarwin::RISCVMCAsmInfoDarwin() { CodePointerSize = 4; - PrivateGlobalPrefix = "L"; + InternalSymbolPrefix = "L"; PrivateLabelPrefix = "L"; SeparatorString = "%%"; CommentString = ";"; 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/MCTargetDesc/X86MCAsmInfo.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp index d07427b5b92b2..a7aa666cef597 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp @@ -147,7 +147,7 @@ void X86MCAsmInfoMicrosoft::anchor() { } X86MCAsmInfoMicrosoft::X86MCAsmInfoMicrosoft(const Triple &Triple) { if (Triple.isX86_64()) { - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; PrivateLabelPrefix = ".L"; CodePointerSize = 8; WinEHEncodingType = WinEH::EncodingType::Itanium; @@ -186,7 +186,7 @@ X86MCAsmInfoGNUCOFF::X86MCAsmInfoGNUCOFF(const Triple &Triple) { assert((Triple.isOSWindows() || Triple.isUEFI()) && "Windows and UEFI are the only supported COFF targets"); if (Triple.isX86_64()) { - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; PrivateLabelPrefix = ".L"; CodePointerSize = 8; WinEHEncodingType = WinEH::EncodingType::Itanium; 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/MCTargetDesc/XtensaMCAsmInfo.cpp b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCAsmInfo.cpp index 258f5cd7156a5..62783c753ed58 100644 --- a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCAsmInfo.cpp +++ b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCAsmInfo.cpp @@ -21,7 +21,7 @@ using namespace llvm; XtensaMCAsmInfo::XtensaMCAsmInfo(const Triple &TT) { CodePointerSize = 4; CalleeSaveStackSlotSize = 4; - PrivateGlobalPrefix = ".L"; + InternalSymbolPrefix = ".L"; CommentString = "#"; ZeroDirective = "\t.space\t"; Data64bitsDirective = "\t.quad\t"; 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); diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-externL.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-externL.ll index 1817f4754177b..46ce94a64b830 100644 --- a/llvm/test/CodeGen/PowerPC/aix-xcoff-externL.ll +++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-externL.ll @@ -1,5 +1,5 @@ ;; Test to make sure a symbol name that starts with an 'L' could be succesfully -;; consumed. Note that this could fail if PrivateGlobalPrefix returns +;; consumed. Note that this could fail if InternalSymbolPrefix returns ;; 'L'/'.L' instead of 'L..' because the resulting symbol gets created as ;; a temporary symbol.