now that MCSymbol::print doesn't use it's MAI argument, we can 
remove it and change all the code that prints MCSymbols to use 
<< instead, which is much simpler and cleaner.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93695 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index bb1f1d3..3beb4d6 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -156,16 +156,12 @@
     for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
          I != E; ++I) {
       if (!I->hasExternalWeakLinkage()) continue;
-      O << MAI->getWeakRefDirective();
-      GetGlobalValueSymbol(I)->print(O, MAI);
-      O << '\n';
+      O << MAI->getWeakRefDirective() << *GetGlobalValueSymbol(I) << '\n';
     }
     
     for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) {
       if (!I->hasExternalWeakLinkage()) continue;
-      O << MAI->getWeakRefDirective();
-      GetGlobalValueSymbol(I)->print(O, MAI);
-      O << '\n';
+      O << MAI->getWeakRefDirective() << *GetGlobalValueSymbol(I) << '\n';
     }
   }
 
@@ -178,25 +174,16 @@
       const GlobalValue *GV = cast<GlobalValue>(I->getAliasedGlobal());
       MCSymbol *Target = GetGlobalValueSymbol(GV);
 
-      if (I->hasExternalLinkage() || !MAI->getWeakRefDirective()) {
-        O << "\t.globl\t";
-        Name->print(O, MAI);
-        O << '\n';
-      } else if (I->hasWeakLinkage()) {
-        O << MAI->getWeakRefDirective();
-        Name->print(O, MAI);
-        O << '\n';
-      } else {
+      if (I->hasExternalLinkage() || !MAI->getWeakRefDirective())
+        O << "\t.globl\t" << *Name << '\n';
+      else if (I->hasWeakLinkage())
+        O << MAI->getWeakRefDirective() << *Name << '\n';
+      else
         assert(I->hasLocalLinkage() && "Invalid alias linkage");
-      }
 
       printVisibility(Name, I->getVisibility());
 
-      O << MAI->getSetDirective() << ' ';
-      Name->print(O, MAI);
-      O << ", ";
-      Target->print(O, MAI);
-      O << '\n';
+      O << MAI->getSetDirective() << ' ' << *Name << ", " << *Target << '\n';
     }
   }
 
@@ -422,12 +409,12 @@
   // If we're emitting non-PIC code, then emit the entries as direct
   // references to the target basic blocks.
   if (!isPIC) {
-    GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MBB->getNumber());
   } else if (MAI->getSetDirective()) {
     O << MAI->getPrivateGlobalPrefix() << getFunctionNumber()
       << '_' << uid << "_set_" << MBB->getNumber();
   } else {
-    GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MBB->getNumber());
     // If the arch uses custom Jump Table directives, don't calc relative to
     // JT
     if (!HadJTEntryDirective) 
@@ -812,12 +799,12 @@
   if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV)) {
     // This is a constant address for a global variable or function. Use the
     // name of the variable or function as the address value.
-    GetGlobalValueSymbol(GV)->print(O, MAI);
+    O << *GetGlobalValueSymbol(GV);
     return;
   }
   
   if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV)) {
-    GetBlockAddressSymbol(BA)->print(O, MAI);
+    O << *GetBlockAddressSymbol(BA);
     return;
   }
   
@@ -1580,9 +1567,8 @@
           unsigned OpFlags = MI->getOperand(OpNo).getImm();
           ++OpNo;  // Skip over the ID number.
 
-          if (Modifier[0]=='l')  // labels are target independent
-            GetMBBSymbol(MI->getOperand(OpNo).getMBB()
-                           ->getNumber())->print(O, MAI);
+          if (Modifier[0] == 'l')  // labels are target independent
+            O << *GetMBBSymbol(MI->getOperand(OpNo).getMBB()->getNumber());
           else {
             AsmPrinter *AP = const_cast<AsmPrinter*>(this);
             if ((OpFlags & 7) == 4) {
@@ -1597,8 +1583,7 @@
         if (Error) {
           std::string msg;
           raw_string_ostream Msg(msg);
-          Msg << "Invalid operand found in inline asm: '"
-               << AsmStr << "'\n";
+          Msg << "Invalid operand found in inline asm: '" << AsmStr << "'\n";
           MI->print(Msg);
           llvm_report_error(Msg.str());
         }
@@ -1734,8 +1719,8 @@
   // forward references to labels without knowing what their numbers
   // will be.
   if (MBB->hasAddressTaken()) {
-    GetBlockAddressSymbol(MBB->getBasicBlock()->getParent(),
-                          MBB->getBasicBlock())->print(O, MAI);
+    O << *GetBlockAddressSymbol(MBB->getBasicBlock()->getParent(),
+                                MBB->getBasicBlock());
     O << ':';
     if (VerboseAsm) {
       O.PadToColumn(MAI->getCommentColumn());
@@ -1749,8 +1734,7 @@
     if (VerboseAsm)
       O << MAI->getCommentString() << " BB#" << MBB->getNumber() << ':';
   } else {
-    GetMBBSymbol(MBB->getNumber())->print(O, MAI);
-    O << ':';
+    O << *GetMBBSymbol(MBB->getNumber()) << ':';
     if (!VerboseAsm)
       O << '\n';
   }
@@ -1777,9 +1761,9 @@
     return;
   
   O << MAI->getSetDirective() << ' ' << MAI->getPrivateGlobalPrefix()
-    << getFunctionNumber() << '_' << uid << "_set_" << MBB->getNumber() << ',';
-  GetMBBSymbol(MBB->getNumber())->print(O, MAI);
-  O << '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() 
+    << getFunctionNumber() << '_' << uid << "_set_" << MBB->getNumber() << ','
+    << *GetMBBSymbol(MBB->getNumber())
+    << '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() 
     << '_' << uid << '\n';
 }
 
@@ -1790,9 +1774,9 @@
   
   O << MAI->getSetDirective() << ' ' << MAI->getPrivateGlobalPrefix()
     << getFunctionNumber() << '_' << uid << '_' << uid2
-    << "_set_" << MBB->getNumber() << ',';
-  GetMBBSymbol(MBB->getNumber())->print(O, MAI);
-  O << '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() 
+    << "_set_" << MBB->getNumber() << ','
+    << *GetMBBSymbol(MBB->getNumber())
+    << '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() 
     << '_' << uid << '_' << uid2 << '\n';
 }
 
@@ -1842,17 +1826,11 @@
 void AsmPrinter::printVisibility(const MCSymbol *Sym,
                                  unsigned Visibility) const {
   if (Visibility == GlobalValue::HiddenVisibility) {
-    if (const char *Directive = MAI->getHiddenDirective()) {
-      O << Directive;
-      Sym->print(O, MAI);
-      O << '\n';
-    }
+    if (const char *Directive = MAI->getHiddenDirective())
+      O << Directive << *Sym << '\n';
   } else if (Visibility == GlobalValue::ProtectedVisibility) {
-    if (const char *Directive = MAI->getProtectedDirective()) {
-      O << Directive;
-      Sym->print(O, MAI);
-      O << '\n';
-    }
+    if (const char *Directive = MAI->getProtectedDirective())
+      O << Directive << *Sym << '\n';
   }
 }