STATISTIC(EmittedInsts, "Number of machine instrs printed");
-static std::string computePICLabel(const std::string &FnName,
+static std::string computePICLabel(unsigned FnNum,
const TargetAsmInfo *TAI,
const X86Subtarget* Subtarget) {
std::string label;
if (Subtarget->isTargetDarwin())
- label = "\"L" "pb$" + FnName + "\"";
+ label = "\"L" + utostr_32(FnNum) + "$pb\"";
else if (Subtarget->isTargetELF())
- label = ".Lllvm$piclabel$" + FnName;
+ label = ".Lllvm$" + utostr_32(FnNum) + "$piclabel";
else
assert(0 && "Don't know how to print PIC label!\n");
case MachineOperand::MO_JumpTableIndex: {
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
if (!isMemOp) O << '$';
- O << TAI->getPrivateGlobalPrefix() << "JTI" << MO.getJumpTableIndex()
- << '_' << CurrentFnName;
+ O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << "_"
+ << MO.getJumpTableIndex();
if (TM.getRelocationModel() == Reloc::PIC_) {
if (Subtarget->isPICStyleStub())
- O << "-\"" << TAI->getPrivateGlobalPrefix() << "pb$" << CurrentFnName
- << "\"";
+ O << "-\"" << TAI->getPrivateGlobalPrefix() << getFunctionNumber()
+ << "$pb\"";
else if (Subtarget->isPICStyleGOT())
O << "@GOTOFF";
}
case MachineOperand::MO_ConstantPoolIndex: {
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
if (!isMemOp) O << '$';
- O << TAI->getPrivateGlobalPrefix() << "CPI" << MO.getConstantPoolIndex()
- << '_' << CurrentFnName;
+ O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_"
+ << MO.getConstantPoolIndex();
if (TM.getRelocationModel() == Reloc::PIC_) {
if (Subtarget->isPICStyleStub())
- O << "-\"" << TAI->getPrivateGlobalPrefix() << "pb$" << CurrentFnName
- << "\"";
+ O << "-\"" << TAI->getPrivateGlobalPrefix() << getFunctionNumber()
+ << "$pb\"";
else if (Subtarget->isPICStyleGOT())
O << "@GOTOFF";
}
}
if (!isCallOp && TM.getRelocationModel() == Reloc::PIC_)
- O << "-\"" << TAI->getPrivateGlobalPrefix() << "pb$" << CurrentFnName
- << "\"";
+ O << "-\"" << TAI->getPrivateGlobalPrefix() << getFunctionNumber()
+ << "$pb\"";
} else {
if (GV->hasDLLImportLinkage()) {
O << "__imp_";
// popl %some_register
// addl $_GLOBAL_ADDRESS_TABLE_ + [.-piclabel], %some_register
O << " + [.-"
- << computePICLabel(CurrentFnName, TAI, Subtarget) << "]";
+ << computePICLabel(getFunctionNumber(), TAI, Subtarget) << "]";
if (isCallOp)
O << "@PLT";
}
void X86ATTAsmPrinter::printPICLabel(const MachineInstr *MI, unsigned Op) {
- std::string label = computePICLabel(CurrentFnName, TAI, Subtarget);
+ std::string label = computePICLabel(getFunctionNumber(), TAI, Subtarget);
O << label << "\n" << label << ":";
}