diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-16 00:32:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-16 00:32:38 +0000 |
commit | 274c0c0db395b0e7e99d90cf94ad7701fc80f088 (patch) | |
tree | 2a3658d855181ca7305ca8a0daf79ed77a81ddaf /llvm/lib | |
parent | 298cdac99cf7e81ba6960f6a6e20ad7646832627 (diff) | |
download | bcm5719-llvm-274c0c0db395b0e7e99d90cf94ad7701fc80f088.tar.gz bcm5719-llvm-274c0c0db395b0e7e99d90cf94ad7701fc80f088.zip |
MCize tis, and make it keep CurrentFnSym up to date with CurrentFnName.
llvm-svn: 93598
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp index 70c6dd03eb1..9545f233a3a 100644 --- a/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp +++ b/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp @@ -72,6 +72,7 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { X86COFFMachineModuleInfo &COFFMMI = MMI->getObjFileInfo<X86COFFMachineModuleInfo>(); COFFMMI.DecorateCygMingName(CurrentFnName, F, *TM.getTargetData()); + CurrentFnSym = OutContext.GetOrCreateSymbol(StringRef(CurrentFnName)); } OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); @@ -84,7 +85,9 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { break; case Function::DLLExportLinkage: case Function::ExternalLinkage: - O << "\t.globl\t" << CurrentFnName << '\n'; + O << "\t.globl\t"; + CurrentFnSym->print(O, MAI); + O << '\n'; break; case Function::LinkerPrivateLinkage: case Function::LinkOnceAnyLinkage: @@ -92,30 +95,41 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { case Function::WeakAnyLinkage: case Function::WeakODRLinkage: if (Subtarget->isTargetDarwin()) { - O << "\t.globl\t" << CurrentFnName << '\n'; - O << MAI->getWeakDefDirective() << CurrentFnName << '\n'; + O << "\t.globl\t"; + CurrentFnSym->print(O, MAI); + O << '\n'; + O << MAI->getWeakDefDirective(); + CurrentFnSym->print(O, MAI); + O << '\n'; } else if (Subtarget->isTargetCygMing()) { - O << "\t.globl\t" << CurrentFnName << "\n" - "\t.linkonce discard\n"; + O << "\t.globl\t"; + CurrentFnSym->print(O, MAI); + O << "\n\t.linkonce discard\n"; } else { - O << "\t.weak\t" << CurrentFnName << '\n'; + O << "\t.weak\t"; + CurrentFnSym->print(O, MAI); + O << '\n'; } break; } - printVisibility(CurrentFnName, F->getVisibility()); + printVisibility(CurrentFnSym, F->getVisibility()); - if (Subtarget->isTargetELF()) - O << "\t.type\t" << CurrentFnName << ",@function\n"; - else if (Subtarget->isTargetCygMing()) { - O << "\t.def\t " << CurrentFnName - << ";\t.scl\t" << + if (Subtarget->isTargetELF()) { + O << "\t.type\t"; + CurrentFnSym->print(O, MAI); + O << ",@function\n"; + } else if (Subtarget->isTargetCygMing()) { + O << "\t.def\t "; + CurrentFnSym->print(O, MAI); + O << ";\t.scl\t" << (F->hasInternalLinkage() ? COFF::C_STAT : COFF::C_EXT) << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) << ";\t.endef\n"; } - O << CurrentFnName << ':'; + CurrentFnSym->print(O, MAI); + O << ':'; if (VerboseAsm) { O.PadToColumn(MAI->getCommentColumn()); O << MAI->getCommentString() << ' '; @@ -125,8 +139,11 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { // Add some workaround for linkonce linkage on Cygwin\MinGW if (Subtarget->isTargetCygMing() && - (F->hasLinkOnceLinkage() || F->hasWeakLinkage())) - O << "Lllvm$workaround$fake$stub$" << CurrentFnName << ":\n"; + (F->hasLinkOnceLinkage() || F->hasWeakLinkage())) { + O << "Lllvm$workaround$fake$stub$"; + CurrentFnSym->print(O, MAI); + O << ":\n"; + } } /// runOnMachineFunction - This uses the printMachineInstruction() @@ -183,8 +200,13 @@ bool X86AsmPrinter::runOnMachineFunction(MachineFunction &MF) { O << "\tnop\n"; } - if (MAI->hasDotTypeDotSizeDirective()) - O << "\t.size\t" << CurrentFnName << ", .-" << CurrentFnName << '\n'; + if (MAI->hasDotTypeDotSizeDirective()) { + O << "\t.size\t"; + CurrentFnSym->print(O, MAI); + O << ", .-"; + CurrentFnSym->print(O, MAI); + O << '\n'; + } // Emit post-function debug information. if (MAI->doesSupportDebugInformation() || MAI->doesSupportExceptionHandling()) |