diff options
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 35 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 14 |
6 files changed, 41 insertions, 31 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 358521ef131..4978fba44cd 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -911,8 +911,8 @@ void AsmPrinter::EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo, // Otherwise, emit with .set (aka assignment). MCSymbol *SetLabel = - OutContext.GetOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix()) + "set" + - Twine(SetCounter++)); + OutContext.GetOrCreateTemporarySymbol(Twine(MAI->getPrivateGlobalPrefix()) + + "set" + Twine(SetCounter++)); OutStreamer.EmitAssignment(SetLabel, Diff); OutStreamer.EmitSymbolValue(SetLabel, Size, 0/*AddrSpace*/); } @@ -1553,15 +1553,15 @@ void AsmPrinter::printKill(const MachineInstr *MI) const { /// exception handling tables. void AsmPrinter::printLabelInst(const MachineInstr *MI) const { MCSymbol *Sym = - OutContext.GetOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix()) + + OutContext.GetOrCreateTemporarySymbol(Twine(MAI->getPrivateGlobalPrefix()) + "label" + Twine(MI->getOperand(0).getImm())); OutStreamer.EmitLabel(Sym); } void AsmPrinter::printLabel(unsigned Id) const { MCSymbol *Sym = - OutContext.GetOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix()) + - "label" + Twine(Id)); + OutContext.GetOrCreateTemporarySymbol(Twine(MAI->getPrivateGlobalPrefix()) + + "label" + Twine(Id)); OutStreamer.EmitLabel(Sym); } @@ -1603,15 +1603,14 @@ MCSymbol *AsmPrinter::GetBlockAddressSymbol(const Function *F, "_" + FnName.str() + "_" + BB->getName(), Mangler::Private); - return OutContext.GetOrCreateSymbol(NameResult.str()); + return OutContext.GetOrCreateTemporarySymbol(NameResult.str()); } /// GetCPISymbol - Return the symbol for the specified constant pool entry. MCSymbol *AsmPrinter::GetCPISymbol(unsigned CPID) const { - SmallString<60> Name; - raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() << "CPI" - << getFunctionNumber() << '_' << CPID; - return OutContext.GetOrCreateSymbol(Name.str()); + return OutContext.GetOrCreateTemporarySymbol + (Twine(MAI->getPrivateGlobalPrefix()) + "CPI" + Twine(getFunctionNumber()) + + "_" + Twine(CPID)); } /// GetJTISymbol - Return the symbol for the specified jump table entry. @@ -1622,10 +1621,9 @@ MCSymbol *AsmPrinter::GetJTISymbol(unsigned JTID, bool isLinkerPrivate) const { /// GetJTSetSymbol - Return the symbol for the specified jump table .set /// FIXME: privatize to AsmPrinter. MCSymbol *AsmPrinter::GetJTSetSymbol(unsigned UID, unsigned MBBID) const { - SmallString<60> Name; - raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() - << getFunctionNumber() << '_' << UID << "_set_" << MBBID; - return OutContext.GetOrCreateSymbol(Name.str()); + return OutContext.GetOrCreateTemporarySymbol + (Twine(MAI->getPrivateGlobalPrefix()) + Twine(getFunctionNumber()) + "_" + + Twine(UID) + "_set_" + Twine(MBBID)); } /// GetGlobalValueSymbol - Return the MCSymbol for the specified global @@ -1633,7 +1631,10 @@ MCSymbol *AsmPrinter::GetJTSetSymbol(unsigned UID, unsigned MBBID) const { MCSymbol *AsmPrinter::GetGlobalValueSymbol(const GlobalValue *GV) const { SmallString<60> NameStr; Mang->getNameWithPrefix(NameStr, GV, false); - return OutContext.GetOrCreateSymbol(NameStr.str()); + + if (!GV->hasPrivateLinkage()) + return OutContext.GetOrCreateSymbol(NameStr.str()); + return OutContext.GetOrCreateTemporarySymbol(NameStr.str()); } /// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with @@ -1645,7 +1646,9 @@ MCSymbol *AsmPrinter::GetSymbolWithGlobalValueBase(const GlobalValue *GV, SmallString<60> NameStr; Mang->getNameWithPrefix(NameStr, GV, ForcePrivate); NameStr.append(Suffix.begin(), Suffix.end()); - return OutContext.GetOrCreateSymbol(NameStr.str()); + if (!GV->hasPrivateLinkage() && !ForcePrivate) + return OutContext.GetOrCreateSymbol(NameStr.str()); + return OutContext.GetOrCreateTemporarySymbol(NameStr.str()); } /// GetExternalSymbolSymbol - Return the MCSymbol for the specified diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp index b85ae3ba99e..47b829d7637 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -60,7 +60,7 @@ const MCExpr *DwarfException::CreateLabelDiff(const MCExpr *ExprRef, raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() << LabelName << Asm->getFunctionNumber() << "_" << Index; - MCSymbol *DotSym = Asm->OutContext.GetOrCreateSymbol(Name.str()); + MCSymbol *DotSym = Asm->OutContext.GetOrCreateTemporarySymbol(Name.str()); Asm->OutStreamer.EmitLabel(DotSym); return MCBinaryExpr::CreateSub(ExprRef, diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp index 80d29072507..7890e5cc179 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp @@ -45,15 +45,15 @@ MCSymbol *DwarfPrinter::getDWLabel(const char *Name, unsigned ID) const { //assert(ID && "Should use getTempLabel if no ID"); if (ID == 0) return getTempLabel(Name); - return Asm->OutContext.GetOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix()) - + Twine(Name) + Twine(ID)); + return Asm->OutContext.GetOrCreateTemporarySymbol + (Twine(MAI->getPrivateGlobalPrefix()) + Twine(Name) + Twine(ID)); } /// getTempLabel - Return the MCSymbol corresponding to the assembler temporary /// label with the specified name. MCSymbol *DwarfPrinter::getTempLabel(const char *Name) const { - return Asm->OutContext.GetOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix()) - + Name); + return Asm->OutContext.GetOrCreateTemporarySymbol + (Twine(MAI->getPrivateGlobalPrefix()) + Name); } diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 64134ce59e9..32b1a7d728e 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -42,12 +42,11 @@ MachineBasicBlock::~MachineBasicBlock() { /// getSymbol - Return the MCSymbol for this basic block. /// MCSymbol *MachineBasicBlock::getSymbol(MCContext &Ctx) const { - SmallString<60> Name; const MachineFunction *MF = getParent(); - raw_svector_ostream(Name) - << MF->getTarget().getMCAsmInfo()->getPrivateGlobalPrefix() << "BB" - << MF->getFunctionNumber() << '_' << getNumber(); - return Ctx.GetOrCreateSymbol(Name.str()); + const char *Prefix = MF->getTarget().getMCAsmInfo()->getPrivateGlobalPrefix(); + return Ctx.GetOrCreateTemporarySymbol(Twine(Prefix) + "BB" + + Twine(MF->getFunctionNumber()) + "_" + + Twine(getNumber())); } diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 4377d5bd71a..1e3cb1ee5a5 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -464,7 +464,9 @@ MCSymbol *MachineFunction::getJTISymbol(unsigned JTI, MCContext &Ctx, SmallString<60> Name; raw_svector_ostream(Name) << Prefix << "JTI" << getFunctionNumber() << '_' << JTI; - return Ctx.GetOrCreateSymbol(Name.str()); + if (isLinkerPrivate) + return Ctx.GetOrCreateSymbol(Name.str()); + return Ctx.GetOrCreateTemporarySymbol(Name.str()); } diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index d127f53a4ed..69168317549 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -403,12 +403,15 @@ getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, // Add information about the stub reference to ELFMMI so that the stub // gets emitted by the asmprinter. - MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str()); + MCSymbol *Sym = getContext().GetOrCreateTemporarySymbol(Name.str()); MCSymbol *&StubSym = ELFMMI.getGVStubEntry(Sym); if (StubSym == 0) { Name.clear(); Mang->getNameWithPrefix(Name, GV, false); - StubSym = getContext().GetOrCreateSymbol(Name.str()); + if (GV->hasPrivateLinkage()) + StubSym = getContext().GetOrCreateTemporarySymbol(Name.str()); + else + StubSym = getContext().GetOrCreateSymbol(Name.str()); } return TargetLoweringObjectFile:: @@ -749,12 +752,15 @@ getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, // Add information about the stub reference to MachOMMI so that the stub // gets emitted by the asmprinter. - MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str()); + MCSymbol *Sym = getContext().GetOrCreateTemporarySymbol(Name.str()); MCSymbol *&StubSym = MachOMMI.getGVStubEntry(Sym); if (StubSym == 0) { Name.clear(); Mang->getNameWithPrefix(Name, GV, false); - StubSym = getContext().GetOrCreateSymbol(Name.str()); + if (GV->hasPrivateLinkage()) + StubSym = getContext().GetOrCreateTemporarySymbol(Name.str()); + else + StubSym = getContext().GetOrCreateSymbol(Name.str()); } return TargetLoweringObjectFile:: |