Combine MovePCtoStack + POP32r into one instruction MOVPC32r so it can be moved if needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45605 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp
index d2112b4..5b64501 100644
--- a/lib/Target/X86/X86ATTAsmPrinter.cpp
+++ b/lib/Target/X86/X86ATTAsmPrinter.cpp
@@ -32,14 +32,14 @@
STATISTIC(EmittedInsts, "Number of machine instrs printed");
-static std::string computePICLabel(unsigned FnNum,
- const TargetAsmInfo *TAI,
- const X86Subtarget* Subtarget) {
+static std::string getPICLabelString(unsigned FnNum,
+ const TargetAsmInfo *TAI,
+ const X86Subtarget* Subtarget) {
std::string label;
if (Subtarget->isTargetDarwin())
label = "\"L" + utostr_32(FnNum) + "$pb\"";
else if (Subtarget->isTargetELF())
- label = ".Lllvm$" + utostr_32(FnNum) + "$piclabel";
+ label = ".Lllvm$" + utostr_32(FnNum) + "." + "$piclabel";
else
assert(0 && "Don't know how to print PIC label!\n");
@@ -318,8 +318,7 @@
}
if (!isCallOp && TM.getRelocationModel() == Reloc::PIC_)
- O << "-\"" << TAI->getPrivateGlobalPrefix() << getFunctionNumber()
- << "$pb\"";
+ O << '-' << getPICLabelString(getFunctionNumber(), TAI, Subtarget);
} else {
if (GV->hasDLLImportLinkage()) {
O << "__imp_";
@@ -420,7 +419,7 @@
// popl %some_register
// addl $_GLOBAL_ADDRESS_TABLE_ + [.-piclabel], %some_register
O << " + [.-"
- << computePICLabel(getFunctionNumber(), TAI, Subtarget) << "]";
+ << getPICLabelString(getFunctionNumber(), TAI, Subtarget) << "]";
if (isCallOp)
O << "@PLT";
@@ -515,11 +514,11 @@
O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
<< '_' << uid << '\n';
else
- O << '-' << computePICLabel(getFunctionNumber(), TAI, Subtarget) << '\n';
+ O << '-' << getPICLabelString(getFunctionNumber(), TAI, Subtarget) << '\n';
}
void X86ATTAsmPrinter::printPICLabel(const MachineInstr *MI, unsigned Op) {
- std::string label = computePICLabel(getFunctionNumber(), TAI, Subtarget);
+ std::string label = getPICLabelString(getFunctionNumber(), TAI, Subtarget);
O << label << "\n" << label << ":";
}