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';
   }
 }
 
diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp
index a51ea2d..ad6df15 100644
--- a/lib/CodeGen/AsmPrinter/DwarfException.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp
@@ -231,26 +231,17 @@
   // Externally visible entry into the functions eh frame info. If the
   // corresponding function is static, this should not be externally visible.
   if (!TheFunc->hasLocalLinkage())
-    if (const char *GlobalEHDirective = MAI->getGlobalEHDirective()) {
-      O << GlobalEHDirective;
-      EHFrameInfo.FunctionEHSym->print(O, MAI);
-      O << '\n';
-    }
+    if (const char *GlobalEHDirective = MAI->getGlobalEHDirective())
+      O << GlobalEHDirective << *EHFrameInfo.FunctionEHSym << '\n';
 
   // If corresponding function is weak definition, this should be too.
-  if (TheFunc->isWeakForLinker() && MAI->getWeakDefDirective()) {
-    O << MAI->getWeakDefDirective();
-    EHFrameInfo.FunctionEHSym->print(O, MAI);
-    O << '\n';
-  }
+  if (TheFunc->isWeakForLinker() && MAI->getWeakDefDirective())
+    O << MAI->getWeakDefDirective() << *EHFrameInfo.FunctionEHSym << '\n';
 
   // If corresponding function is hidden, this should be too.
   if (TheFunc->hasHiddenVisibility())
-    if (const char *HiddenDirective = MAI->getHiddenDirective()) {
-      O << HiddenDirective;
-      EHFrameInfo.FunctionEHSym->print(O, MAI);
-      O << '\n';
-    }
+    if (const char *HiddenDirective = MAI->getHiddenDirective())
+      O << HiddenDirective << *EHFrameInfo.FunctionEHSym << '\n';
 
   // If there are no calls then you can't unwind.  This may mean we can omit the
   // EH Frame, but some environments do not handle weak absolute symbols. If
@@ -260,19 +251,14 @@
       (!TheFunc->isWeakForLinker() ||
        !MAI->getWeakDefDirective() ||
        MAI->getSupportsWeakOmittedEHFrame())) {
-    EHFrameInfo.FunctionEHSym->print(O, MAI);
-    O << " = 0\n";
+    O << *EHFrameInfo.FunctionEHSym << " = 0\n";
     // This name has no connection to the function, so it might get
     // dead-stripped when the function is not, erroneously.  Prohibit
     // dead-stripping unconditionally.
-    if (const char *UsedDirective = MAI->getUsedDirective()) {
-      O << UsedDirective;
-      EHFrameInfo.FunctionEHSym->print(O, MAI);
-      O << "\n\n";
-    }
+    if (const char *UsedDirective = MAI->getUsedDirective())
+      O << UsedDirective << *EHFrameInfo.FunctionEHSym << "\n\n";
   } else {
-    EHFrameInfo.FunctionEHSym->print(O, MAI);
-    O << ":\n";
+    O << *EHFrameInfo.FunctionEHSym << ":\n";
 
     // EH frame header.
     EmitDifference("eh_frame_end", EHFrameInfo.Number,
@@ -344,9 +330,7 @@
     // link correctly.  Yes, there really is.
     if (MMI->isUsedFunction(EHFrameInfo.function))
       if (const char *UsedDirective = MAI->getUsedDirective()) {
-        O << UsedDirective;
-        EHFrameInfo.FunctionEHSym->print(O, MAI);
-        O << "\n\n";
+        O << UsedDirective << *EHFrameInfo.FunctionEHSym << "\n\n";
       }
   }
 
@@ -946,7 +930,7 @@
     PrintRelDirective();
 
     if (GV) {
-      Asm->GetGlobalValueSymbol(GV)->print(O, MAI);
+      O << *Asm->GetGlobalValueSymbol(GV);
     } else {
       O << "0x0";
     }
diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
index 7aca41e..093b196 100644
--- a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
@@ -79,7 +79,7 @@
 void Dwarf::EmitReference(const MCSymbol *Sym, bool IsPCRelative,
                           bool Force32Bit) const {
   PrintRelDirective(Force32Bit);
-  Sym->print(O, MAI);
+  O << *Sym;
   if (IsPCRelative) O << "-" << MAI->getPCSymbol();
 }