Typo.
[oota-llvm.git] / lib / CodeGen / AsmPrinter.cpp
index e8ce0b7a5629fb5cfae60f4e80b25ca1129d56e8..47a53457fc9823f5470a6f05a66cb472ceb72852 100644 (file)
@@ -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