diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-10-14 05:57:21 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-10-14 05:57:21 +0000 |
commit | 347d39f1fd8ad825a7ec5b8a3dce816723a56d42 (patch) | |
tree | b53cc576e0aba064bc5630eb5a5eddb28ee58fd1 /lib/CodeGen/AsmPrinter.cpp | |
parent | 296c1761416df3eb706dbcf5319f1f2267e1b4f7 (diff) |
Revert 42908 for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index e8ce0b7a56..47a53457fc 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -35,7 +35,7 @@ AsmVerbose("asm-verbose", cl::Hidden, cl::desc("Add comments to directives.")); char AsmPrinter::ID = 0; AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm, const TargetAsmInfo *T) - : MachineFunctionPass((intptr_t)&ID), O(o), TM(tm), TAI(T) + : MachineFunctionPass((intptr_t)&ID), FunctionNumber(0), O(o), TM(tm), TAI(T) {} std::string AsmPrinter::getSectionForFunction(const Function &F) const { @@ -169,6 +169,7 @@ std::string AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF) { void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { // What's my mangled name? CurrentFnName = Mang->getValueName(MF.getFunction()); + IncrementFunctionNumber(); } /// EmitConstantPool - Print to the current output stream assembly @@ -218,9 +219,8 @@ void AsmPrinter::EmitConstantPool(unsigned Alignment, const char *Section, SwitchToDataSection(Section); EmitAlignment(Alignment); for (unsigned i = 0, e = CP.size(); i != e; ++i) { - O << TAI->getPrivateGlobalPrefix() << "CPI" << CP[i].second - << '_' << CurrentFnName - << ":\t\t\t\t\t" << TAI->getCommentString() << ' '; + O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_' + << CP[i].second << ":\t\t\t\t\t" << TAI->getCommentString() << " "; WriteTypeSymbolic(O, CP[i].first.getType(), 0) << '\n'; if (CP[i].first.isMachineConstantPoolEntry()) EmitMachineConstantPoolValue(CP[i].first.Val.MachineCPVal); @@ -293,10 +293,10 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI, // the assembler and linker the extents of the jump table object. The // second label is actually referenced by the code. if (const char *JTLabelPrefix = TAI->getJumpTableSpecialLabelPrefix()) - O << JTLabelPrefix << "JTI" << i << '_' << CurrentFnName << ":\n"; + O << JTLabelPrefix << "JTI" << getFunctionNumber() << '_' << i << ":\n"; - O << TAI->getPrivateGlobalPrefix() << "JTI" << i - << '_' << CurrentFnName << ":\n"; + O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() + << '_' << i << ":\n"; for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) { O << JTEntryDirective << ' '; @@ -306,15 +306,15 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI, // If we're emitting non-PIC code, then emit the entries as direct // references to the target basic blocks. if (!EmittedSets.empty()) { - O << TAI->getPrivateGlobalPrefix() << i - << '_' << "_set_" << JTBBs[ii]->getNumber() << '_' << CurrentFnName; + O << TAI->getPrivateGlobalPrefix() << getFunctionNumber() + << '_' << i << "_set_" << JTBBs[ii]->getNumber(); } else if (IsPic) { printBasicBlockLabel(JTBBs[ii], false, false); // If the arch uses custom Jump Table directives, don't calc relative to // JT if (!HadJTEntryDirective) O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" - << i << '_' << CurrentFnName; + << getFunctionNumber() << '_' << i; } else { printBasicBlockLabel(JTBBs[ii], false, false); } @@ -1242,8 +1242,8 @@ bool AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, void AsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB, bool printColon, bool printComment) const { - O << TAI->getPrivateGlobalPrefix() << "BB" << MBB->getNumber() << '_' - << CurrentFnName; + O << TAI->getPrivateGlobalPrefix() << "BB" << getFunctionNumber() << "_" + << MBB->getNumber(); if (printColon) O << ':'; if (printComment && MBB->getBasicBlock()) @@ -1259,10 +1259,10 @@ void AsmPrinter::printSetLabel(unsigned uid, return; O << TAI->getSetDirective() << ' ' << TAI->getPrivateGlobalPrefix() - << uid << "_set_" << MBB->getNumber() << '_' << CurrentFnName << ','; + << getFunctionNumber() << '_' << uid << "_set_" << MBB->getNumber() << ','; printBasicBlockLabel(MBB, false, false); - O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" << uid - << '_' << CurrentFnName << '\n'; + O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() + << '_' << uid << '\n'; } void AsmPrinter::printSetLabel(unsigned uid, unsigned uid2, @@ -1271,11 +1271,11 @@ void AsmPrinter::printSetLabel(unsigned uid, unsigned uid2, return; O << TAI->getSetDirective() << ' ' << TAI->getPrivateGlobalPrefix() - << uid << '_' << uid2 - << "_set_" << MBB->getNumber() << '_' << CurrentFnName << ','; + << getFunctionNumber() << '_' << uid << '_' << uid2 + << "_set_" << MBB->getNumber() << ','; printBasicBlockLabel(MBB, false, false); - O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" << uid - << '_' << uid2 << '_' << CurrentFnName << '\n'; + O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() + << '_' << uid << '_' << uid2 << '\n'; } /// printDataDirective - This method prints the asm directive for the |