From 192957d376923cefc993c1b5c04127c42f1008ec Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 14 Jul 2009 16:12:13 +0000 Subject: [PATCH] Revert r75615, which depended on 75610. --- Reverse-merging r75615 into '.': U lib/Target/XCore/XCoreAsmPrinter.cpp U lib/Target/PIC16/PIC16AsmPrinter.cpp U lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp U lib/Target/MSP430/MSP430AsmPrinter.cpp U lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp U lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp U lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp U lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp U lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp U lib/Target/MSIL/MSILWriter.cpp U lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp U lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75637 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 12 +++++----- .../Alpha/AsmPrinter/AlphaAsmPrinter.cpp | 8 ++++--- .../CellSPU/AsmPrinter/SPUAsmPrinter.cpp | 4 ++-- lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp | 8 +++---- lib/Target/MSIL/MSILWriter.cpp | 8 +++---- lib/Target/MSP430/MSP430AsmPrinter.cpp | 2 +- lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp | 7 ++++-- lib/Target/PIC16/PIC16AsmPrinter.cpp | 22 +++++++++---------- .../PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 9 ++++---- .../Sparc/AsmPrinter/SparcAsmPrinter.cpp | 7 ++++-- .../X86/AsmPrinter/X86IntelAsmPrinter.cpp | 11 +++++----- lib/Target/XCore/XCoreAsmPrinter.cpp | 4 ++-- 12 files changed, 55 insertions(+), 47 deletions(-) diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index f44a88cda16..0a55c0c397c 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -155,11 +155,9 @@ namespace { ARMConstantPoolValue *ACPV = static_cast(MCPV); GlobalValue *GV = ACPV->getGV(); - std::string Name; - if (GV) - Name = Mang->getMangledName(GV); - else - Name = std::string(TAI->getGlobalPrefix()) + ACPV->getSymbol(); + std::string Name = GV ? Mang->getValueName(GV) : TAI->getGlobalPrefix(); + if (!GV) + Name += ACPV->getSymbol(); if (ACPV->isNonLazyPointer()) { if (GV->hasHiddenVisibility()) HiddenGVNonLazyPtrs.insert(Name); @@ -326,7 +324,7 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum, case MachineOperand::MO_GlobalAddress: { bool isCallOp = Modifier && !strcmp(Modifier, "call"); GlobalValue *GV = MO.getGlobal(); - std::string Name = Mang->getMangledName(GV); + std::string Name = Mang->getValueName(GV); bool isExt = (GV->isDeclaration() || GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()); if (isExt && isCallOp && Subtarget->isTargetDarwin() && @@ -1039,7 +1037,7 @@ void ARMAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { return; } - std::string name = Mang->getMangledName(GVar); + std::string name = Mang->getValueName(GVar); Constant *C = GVar->getInitializer(); if (isa(C) || isa(C)) return; diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp index f2030059260..38bdeb25c06 100644 --- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp @@ -117,9 +117,11 @@ void AlphaAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) { O << MO.getSymbolName(); return; - case MachineOperand::MO_GlobalAddress: - O << Mang->getMangledName(MO.getGlobal()); + case MachineOperand::MO_GlobalAddress: { + GlobalValue *GV = MO.getGlobal(); + O << Mang->getValueName(GV); return; + } case MachineOperand::MO_JumpTableIndex: O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() @@ -216,7 +218,7 @@ void AlphaAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { if (EmitSpecialLLVMGlobal(GVar)) return; - std::string name = Mang->getMangledName(GVar); + std::string name = Mang->getValueName(GVar); Constant *C = GVar->getInitializer(); if (isa(C) || isa(C)) return; diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp index ddee80618bd..77e66c80e77 100644 --- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp +++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp @@ -347,7 +347,7 @@ void SPUAsmPrinter::printOp(const MachineOperand &MO) { case MachineOperand::MO_GlobalAddress: { // Computing the address of a global symbol, not calling it. GlobalValue *GV = MO.getGlobal(); - std::string Name = Mang->getMangledName(GV); + std::string Name = Mang->getValueName(GV); // External or weakly linked global variables need non-lazily-resolved // stubs @@ -515,7 +515,7 @@ void LinuxAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { if (EmitSpecialLLVMGlobal(GVar)) return; - std::string name = Mang->getMangledName(GVar); + std::string name = Mang->getValueName(GVar); printVisibility(name, GVar->getVisibility()); diff --git a/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp b/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp index dfea1404e73..111749e778d 100644 --- a/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp +++ b/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp @@ -201,16 +201,16 @@ void IA64AsmPrinter::printOp(const MachineOperand &MO, // Intel ias rightly complains of an 'undefined symbol') if (F /*&& isBRCALLinsn*/ && F->isDeclaration()) - ExternalFunctionNames.insert(Mang->getMangledName(MO.getGlobal())); + ExternalFunctionNames.insert(Mang->getValueName(MO.getGlobal())); else if (GV->isDeclaration()) // e.g. stuff like 'stdin' - ExternalObjectNames.insert(Mang->getMangledName(MO.getGlobal())); + ExternalObjectNames.insert(Mang->getValueName(MO.getGlobal())); if (!isBRCALLinsn) O << "@ltoff("; if (Needfptr) O << "@fptr("; - O << Mang->getMangledName(MO.getGlobal()); + O << Mang->getValueName(MO.getGlobal()); if (Needfptr && !isBRCALLinsn) O << "#))"; // close both fptr( and ltoff( @@ -268,7 +268,7 @@ void IA64AsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { return; O << "\n\n"; - std::string name = Mang->getMangledName(GVar); + std::string name = Mang->getValueName(GVar); Constant *C = GVar->getInitializer(); if (isa(C) || isa(C)) return; diff --git a/lib/Target/MSIL/MSILWriter.cpp b/lib/Target/MSIL/MSILWriter.cpp index 81e5cd4aec0..0fdbbf1adc7 100644 --- a/lib/Target/MSIL/MSILWriter.cpp +++ b/lib/Target/MSIL/MSILWriter.cpp @@ -242,7 +242,7 @@ bool MSILWriter::isZeroValue(const Value* V) { std::string MSILWriter::getValueName(const Value* V) { std::string Name; if (const GlobalValue *GV = cast(V)) - Name = Mang->getMangledName(GV); + Name = Mang->getValueName(GV); else { unsigned &No = AnonValueNumbers[V]; if (No == 0) No = ++NextAnonValueNumber; @@ -269,7 +269,7 @@ std::string MSILWriter::getLabelName(const std::string& Name) { std::string MSILWriter::getLabelName(const Value* V) { std::string Name; if (const GlobalValue *GV = cast(V)) - Name = Mang->getMangledName(GV); + Name = Mang->getValueName(GV); else { unsigned &No = AnonValueNumbers[V]; if (No == 0) No = ++NextAnonValueNumber; @@ -1630,7 +1630,7 @@ const char* MSILWriter::getLibraryName(const Function* F) { const char* MSILWriter::getLibraryName(const GlobalVariable* GV) { - return getLibraryForSymbol(Mang->getMangledName(GV).c_str(), false, 0); + return getLibraryForSymbol(Mang->getValueName(GV).c_str(), false, 0); } @@ -1688,7 +1688,7 @@ void MSILWriter::printExternals() { std::string Tmp = getTypeName(I->getType())+getValueName(&*I); printSimpleInstruction("ldsflda",Tmp.c_str()); Out << "\tldstr\t\"" << getLibraryName(&*I) << "\"\n"; - Out << "\tldstr\t\"" << Mang->getMangledName(&*I) << "\"\n"; + Out << "\tldstr\t\"" << Mang->getValueName(&*I) << "\"\n"; printSimpleInstruction("call","void* $MSIL_Import(string,string)"); printIndirectSave(I->getType()); } diff --git a/lib/Target/MSP430/MSP430AsmPrinter.cpp b/lib/Target/MSP430/MSP430AsmPrinter.cpp index 9457c48f74d..0f711abc4f8 100644 --- a/lib/Target/MSP430/MSP430AsmPrinter.cpp +++ b/lib/Target/MSP430/MSP430AsmPrinter.cpp @@ -185,7 +185,7 @@ void MSP430AsmPrinter::printOperand(const MachineInstr *MI, int OpNum, case MachineOperand::MO_GlobalAddress: { bool isMemOp = Modifier && !strcmp(Modifier, "mem"); bool isCallOp = Modifier && !strcmp(Modifier, "call"); - std::string Name = Mang->getMangledName(MO.getGlobal()); + std::string Name = Mang->getValueName(MO.getGlobal()); assert(MO.getOffset() == 0 && "No offsets allowed!"); if (isCallOp) diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp index 27316a7d4d8..97687104693 100644 --- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp @@ -385,7 +385,10 @@ printOperand(const MachineInstr *MI, int opNum) return; case MachineOperand::MO_GlobalAddress: - O << Mang->getMangledName(MO.getGlobal()); + { + const GlobalValue *GV = MO.getGlobal(); + O << Mang->getValueName(GV); + } break; case MachineOperand::MO_ExternalSymbol: @@ -478,7 +481,7 @@ printModuleLevelGV(const GlobalVariable* GVar) { return; O << "\n\n"; - std::string name = Mang->getMangledName(GVar); + std::string name = Mang->getValueName(GVar); Constant *C = GVar->getInitializer(); if (isa(C) || isa(C)) return; diff --git a/lib/Target/PIC16/PIC16AsmPrinter.cpp b/lib/Target/PIC16/PIC16AsmPrinter.cpp index b2f015f19ab..d80476cdfad 100644 --- a/lib/Target/PIC16/PIC16AsmPrinter.cpp +++ b/lib/Target/PIC16/PIC16AsmPrinter.cpp @@ -47,7 +47,7 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) { // Get the mangled name. const Function *F = MF.getFunction(); - CurrentFnName = Mang->getMangledName(F); + CurrentFnName = Mang->getValueName(F); // Emit the function frame (args and temps). EmitFunctionFrame(MF); @@ -136,7 +136,7 @@ void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) { return; case MachineOperand::MO_GlobalAddress: { - O << Mang->getMangledName(MO.getGlobal()); + O << Mang->getValueName(MO.getGlobal()); break; } case MachineOperand::MO_ExternalSymbol: { @@ -222,7 +222,7 @@ void PIC16AsmPrinter::EmitFunctionDecls (Module &M) { // Emit declarations for external functions. O <<"\n"<getCommentString() << "Function Declarations - BEGIN." <<"\n"; for (Module::iterator I = M.begin(), E = M.end(); I != E; I++) { - std::string Name = Mang->getMangledName(I); + std::string Name = Mang->getValueName(I); if (Name.compare("@abort") == 0) continue; @@ -252,7 +252,7 @@ void PIC16AsmPrinter::EmitUndefinedVars (Module &M) O << "\n" << TAI->getCommentString() << "Imported Variables - BEGIN" << "\n"; for (unsigned j = 0; j < Items.size(); j++) { - O << TAI->getExternDirective() << Mang->getMangledName(Items[j]) << "\n"; + O << TAI->getExternDirective() << Mang->getValueName(Items[j]) << "\n"; } O << TAI->getCommentString() << "Imported Variables - END" << "\n"; } @@ -265,7 +265,7 @@ void PIC16AsmPrinter::EmitDefinedVars (Module &M) O << "\n" << TAI->getCommentString() << "Exported Variables - BEGIN" << "\n"; for (unsigned j = 0; j < Items.size(); j++) { - O << TAI->getGlobalDirective() << Mang->getMangledName(Items[j]) << "\n"; + O << TAI->getGlobalDirective() << Mang->getValueName(Items[j]) << "\n"; } O << TAI->getCommentString() << "Exported Variables - END" << "\n"; } @@ -281,7 +281,7 @@ void PIC16AsmPrinter::EmitRomData (Module &M) O << "\n"; SwitchToSection(PTAI->ROSections[i]->S_); for (unsigned j = 0; j < Items.size(); j++) { - O << Mang->getMangledName(Items[j]); + O << Mang->getValueName(Items[j]); Constant *C = Items[j]->getInitializer(); int AddrSpace = Items[j]->getType()->getAddressSpace(); EmitGlobalConstant(C, AddrSpace); @@ -300,7 +300,7 @@ bool PIC16AsmPrinter::doFinalization(Module &M) { void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) { const Function *F = MF.getFunction(); - std::string FuncName = Mang->getMangledName(F); + std::string FuncName = Mang->getValueName(F); const TargetData *TD = TM.getTargetData(); // Emit the data section name. O << "\n"; @@ -354,7 +354,7 @@ void PIC16AsmPrinter::EmitIData (Module &M) { SwitchToSection(IDATASections[i]->S_); std::vector Items = IDATASections[i]->Items; for (unsigned j = 0; j < Items.size(); j++) { - std::string Name = Mang->getMangledName(Items[j]); + std::string Name = Mang->getValueName(Items[j]); Constant *C = Items[j]->getInitializer(); int AddrSpace = Items[j]->getType()->getAddressSpace(); O << Name; @@ -373,7 +373,7 @@ void PIC16AsmPrinter::EmitUData (Module &M) { SwitchToSection(BSSSections[i]->S_); std::vector Items = BSSSections[i]->Items; for (unsigned j = 0; j < Items.size(); j++) { - std::string Name = Mang->getMangledName(Items[j]); + std::string Name = Mang->getValueName(Items[j]); Constant *C = Items[j]->getInitializer(); const Type *Ty = C->getType(); unsigned Size = TD->getTypeAllocSize(Ty); @@ -401,7 +401,7 @@ void PIC16AsmPrinter::EmitAutos (std::string FunctName) SwitchToSection(AutosSections[i]->S_); std::vector Items = AutosSections[i]->Items; for (unsigned j = 0; j < Items.size(); j++) { - std::string VarName = Mang->getMangledName(Items[j]); + std::string VarName = Mang->getValueName(Items[j]); Constant *C = Items[j]->getInitializer(); const Type *Ty = C->getType(); unsigned Size = TD->getTypeAllocSize(Ty); @@ -434,7 +434,7 @@ void PIC16AsmPrinter::EmitRemainingAutos() SwitchToSection(AutosSections[i]->S_); std::vector Items = AutosSections[i]->Items; for (unsigned j = 0; j < Items.size(); j++) { - std::string VarName = Mang->getMangledName(Items[j]); + std::string VarName = Mang->getValueName(Items[j]); Constant *C = Items[j]->getInitializer(); const Type *Ty = C->getType(); unsigned Size = TD->getTypeAllocSize(Ty); diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 68a56ecfbae..cec32739bcb 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -191,7 +191,7 @@ namespace { GlobalValue *GV = MO.getGlobal(); if (GV->isDeclaration() || GV->isWeakForLinker()) { // Dynamically-resolved functions need a stub for the function. - std::string Name = Mang->getMangledName(GV); + std::string Name = Mang->getValueName(GV); FnStubs.insert(Name); printSuffixedName(Name, "$stub"); return; @@ -376,7 +376,7 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) { case MachineOperand::MO_GlobalAddress: { // Computing the address of a global symbol, not calling it. GlobalValue *GV = MO.getGlobal(); - std::string Name = Mang->getMangledName(GV); + std::string Name = Mang->getValueName(GV); // External or weakly linked global variables need non-lazily-resolved stubs if (TM.getRelocationModel() != Reloc::Static) { @@ -646,7 +646,7 @@ void PPCLinuxAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { if (EmitSpecialLLVMGlobal(GVar)) return; - std::string name = Mang->getMangledName(GVar); + std::string name = Mang->getValueName(GVar); printVisibility(name, GVar->getVisibility()); @@ -865,7 +865,8 @@ void PPCDarwinAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { return; } - std::string name = Mang->getMangledName(GVar); + std::string name = Mang->getValueName(GVar); + printVisibility(name, GVar->getVisibility()); Constant *C = GVar->getInitializer(); diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp index 5ed358c5931..04e1cc8bb61 100644 --- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp @@ -172,7 +172,10 @@ void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum) { printBasicBlockLabel(MO.getMBB()); return; case MachineOperand::MO_GlobalAddress: - O << Mang->getMangledName(MO.getGlobal()); + { + const GlobalValue *GV = MO.getGlobal(); + O << Mang->getValueName(GV); + } break; case MachineOperand::MO_ExternalSymbol: O << MO.getSymbolName(); @@ -248,7 +251,7 @@ void SparcAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { return; O << "\n\n"; - std::string name = Mang->getMangledName(GVar); + std::string name = Mang->getValueName(GVar); Constant *C = GVar->getInitializer(); if (isa(C) || isa(C)) return; diff --git a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp index 1a40ed46478..793616e7985 100644 --- a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp @@ -240,7 +240,8 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO, case MachineOperand::MO_GlobalAddress: { bool isMemOp = Modifier && !strcmp(Modifier, "mem"); GlobalValue *GV = MO.getGlobal(); - std::string Name = Mang->getMangledName(GV); + std::string Name = Mang->getValueName(GV); + decorateName(Name, GV); if (!isMemOp) O << "OFFSET "; @@ -277,7 +278,7 @@ void X86IntelAsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo){ case MachineOperand::MO_GlobalAddress: { GlobalValue *GV = MO.getGlobal(); - std::string Name = Mang->getMangledName(GV); + std::string Name = Mang->getValueName(GV); decorateName(Name, GV); // Handle dllimport linkage. @@ -445,7 +446,7 @@ bool X86IntelAsmPrinter::doInitialization(Module &M) { // Emit declarations for external functions. for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (I->isDeclaration()) { - std::string Name = Mang->getMangledName(I); + std::string Name = Mang->getValueName(I); decorateName(Name, I); O << "\tEXTERN " ; @@ -460,7 +461,7 @@ bool X86IntelAsmPrinter::doInitialization(Module &M) { for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { if (I->isDeclaration()) { - std::string Name = Mang->getMangledName(I); + std::string Name = Mang->getValueName(I); O << "\tEXTERN " ; if (I->hasDLLImportLinkage()) { @@ -485,7 +486,7 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { if (EmitSpecialLLVMGlobal(I)) continue; - std::string name = Mang->getMangledName(I); + std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); unsigned Align = TD->getPreferredAlignmentLog(I); bool bCustomSegment = false; diff --git a/lib/Target/XCore/XCoreAsmPrinter.cpp b/lib/Target/XCore/XCoreAsmPrinter.cpp index 8775f3c80c3..5234a9ba1f3 100644 --- a/lib/Target/XCore/XCoreAsmPrinter.cpp +++ b/lib/Target/XCore/XCoreAsmPrinter.cpp @@ -178,7 +178,7 @@ emitGlobal(const GlobalVariable *GV) SwitchToSection(TAI->SectionForGlobal(GV)); - std::string name = Mang->getMangledName(GV); + std::string name = Mang->getValueName(GV); Constant *C = GV->getInitializer(); unsigned Align = (unsigned)TD->getPreferredTypeAlignmentShift(C->getType()); @@ -367,7 +367,7 @@ void XCoreAsmPrinter::printOperand(const MachineInstr *MI, int opNum) { printBasicBlockLabel(MO.getMBB()); break; case MachineOperand::MO_GlobalAddress: - O << Mang->getMangledName(MO.getGlobal()); + O << Mang->getValueName(MO.getGlobal()); break; case MachineOperand::MO_ExternalSymbol: O << MO.getSymbolName();