revert the x86 part of my last patch, cygwin is mutating CurrentFnName!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93595 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-01-16 00:24:20 +00:00
parent 12164414dd
commit 99db039e72

View File

@ -84,9 +84,7 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
break; break;
case Function::DLLExportLinkage: case Function::DLLExportLinkage:
case Function::ExternalLinkage: case Function::ExternalLinkage:
O << "\t.globl\t"; O << "\t.globl\t" << CurrentFnName << '\n';
CurrentFnSym->print(O, MAI);
O << '\n';
break; break;
case Function::LinkerPrivateLinkage: case Function::LinkerPrivateLinkage:
case Function::LinkOnceAnyLinkage: case Function::LinkOnceAnyLinkage:
@ -94,41 +92,30 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
case Function::WeakAnyLinkage: case Function::WeakAnyLinkage:
case Function::WeakODRLinkage: case Function::WeakODRLinkage:
if (Subtarget->isTargetDarwin()) { if (Subtarget->isTargetDarwin()) {
O << "\t.globl\t"; O << "\t.globl\t" << CurrentFnName << '\n';
CurrentFnSym->print(O, MAI); O << MAI->getWeakDefDirective() << CurrentFnName << '\n';
O << '\n';
O << MAI->getWeakDefDirective();
CurrentFnSym->print(O, MAI);
O << '\n';
} else if (Subtarget->isTargetCygMing()) { } else if (Subtarget->isTargetCygMing()) {
O << "\t.globl\t"; O << "\t.globl\t" << CurrentFnName << "\n"
CurrentFnSym->print(O, MAI); "\t.linkonce discard\n";
O << "\n\t.linkonce discard\n";
} else { } else {
O << "\t.weak\t"; O << "\t.weak\t" << CurrentFnName << '\n';
CurrentFnSym->print(O, MAI);
O << '\n';
} }
break; break;
} }
printVisibility(CurrentFnSym, F->getVisibility()); printVisibility(CurrentFnName, F->getVisibility());
if (Subtarget->isTargetELF()) { if (Subtarget->isTargetELF())
O << "\t.type\t"; O << "\t.type\t" << CurrentFnName << ",@function\n";
CurrentFnSym->print(O, MAI); else if (Subtarget->isTargetCygMing()) {
O << ",@function\n"; O << "\t.def\t " << CurrentFnName
} else if (Subtarget->isTargetCygMing()) { << ";\t.scl\t" <<
O << "\t.def\t ";
CurrentFnSym->print(O, MAI);
O << ";\t.scl\t" <<
(F->hasInternalLinkage() ? COFF::C_STAT : COFF::C_EXT) (F->hasInternalLinkage() ? COFF::C_STAT : COFF::C_EXT)
<< ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT)
<< ";\t.endef\n"; << ";\t.endef\n";
} }
CurrentFnSym->print(O, MAI); O << CurrentFnName << ':';
O << ':';
if (VerboseAsm) { if (VerboseAsm) {
O.PadToColumn(MAI->getCommentColumn()); O.PadToColumn(MAI->getCommentColumn());
O << MAI->getCommentString() << ' '; O << MAI->getCommentString() << ' ';
@ -138,11 +125,8 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
// Add some workaround for linkonce linkage on Cygwin\MinGW // Add some workaround for linkonce linkage on Cygwin\MinGW
if (Subtarget->isTargetCygMing() && if (Subtarget->isTargetCygMing() &&
(F->hasLinkOnceLinkage() || F->hasWeakLinkage())) { (F->hasLinkOnceLinkage() || F->hasWeakLinkage()))
O << "Lllvm$workaround$fake$stub$"; O << "Lllvm$workaround$fake$stub$" << CurrentFnName << ":\n";
CurrentFnSym->print(O, MAI);
O << ":\n";
}
} }
/// runOnMachineFunction - This uses the printMachineInstruction() /// runOnMachineFunction - This uses the printMachineInstruction()
@ -199,13 +183,8 @@ bool X86AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
O << "\tnop\n"; O << "\tnop\n";
} }
if (MAI->hasDotTypeDotSizeDirective()) { if (MAI->hasDotTypeDotSizeDirective())
O << "\t.size\t"; O << "\t.size\t" << CurrentFnName << ", .-" << CurrentFnName << '\n';
CurrentFnSym->print(O, MAI);
O << ", .-";
CurrentFnSym->print(O, MAI);
O << '\n';
}
// Emit post-function debug information. // Emit post-function debug information.
if (MAI->doesSupportDebugInformation() || MAI->doesSupportExceptionHandling()) if (MAI->doesSupportDebugInformation() || MAI->doesSupportExceptionHandling())