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/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
index 300d2ed..5f99a3a 100644
--- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
+++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
@@ -187,11 +187,11 @@
         bool isIndirect = Subtarget->isTargetDarwin() &&
           Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel());
         if (!isIndirect)
-          GetGlobalValueSymbol(GV)->print(O, MAI);
+          O << *GetGlobalValueSymbol(GV);
         else {
           // FIXME: Remove this when Darwin transition to @GOT like syntax.
           MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
-          Sym->print(O, MAI);
+          O << *Sym;
           
           MachineModuleInfoMachO &MMIMachO =
             MMI->getObjFileInfo<MachineModuleInfoMachO>();
@@ -203,7 +203,7 @@
         }
       } else {
         assert(ACPV->isExtSymbol() && "unrecognized constant pool value");
-        GetExternalSymbolSymbol(ACPV->getSymbol())->print(O, MAI);
+        O << *GetExternalSymbolSymbol(ACPV->getSymbol());
       }
 
       if (ACPV->hasModifier()) O << "(" << ACPV->getModifier() << ")";
@@ -256,9 +256,7 @@
   case Function::InternalLinkage:
     break;
   case Function::ExternalLinkage:
-    O << "\t.globl\t";
-    CurrentFnSym->print(O, MAI);
-    O << "\n";
+    O << "\t.globl\t" << *CurrentFnSym << "\n";
     break;
   case Function::LinkerPrivateLinkage:
   case Function::WeakAnyLinkage:
@@ -266,16 +264,10 @@
   case Function::LinkOnceAnyLinkage:
   case Function::LinkOnceODRLinkage:
     if (Subtarget->isTargetDarwin()) {
-      O << "\t.globl\t";
-      CurrentFnSym->print(O, MAI);
-      O << "\n";
-      O << "\t.weak_definition\t";
-      CurrentFnSym->print(O, MAI);
-      O << "\n";
+      O << "\t.globl\t" << *CurrentFnSym << "\n";
+      O << "\t.weak_definition\t" << *CurrentFnSym << "\n";
     } else {
-      O << MAI->getWeakRefDirective();
-      CurrentFnSym->print(O, MAI);
-      O << "\n";
+      O << MAI->getWeakRefDirective() << *CurrentFnSym << "\n";
     }
     break;
   }
@@ -287,17 +279,14 @@
     EmitAlignment(FnAlign, F, AFI->getAlign());
     O << "\t.code\t16\n";
     O << "\t.thumb_func";
-    if (Subtarget->isTargetDarwin()) {
-      O << "\t";
-      CurrentFnSym->print(O, MAI);
-    }
+    if (Subtarget->isTargetDarwin())
+      O << "\t" << *CurrentFnSym;
     O << "\n";
   } else {
     EmitAlignment(FnAlign, F);
   }
 
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << *CurrentFnSym << ":\n";
   // Emit pre-function debug information.
   DW->BeginFunction(&MF);
 
@@ -324,13 +313,8 @@
       printMachineInstruction(II);
   }
 
-  if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.size ";
-    CurrentFnSym->print(O, MAI);
-    O << ", .-";
-    CurrentFnSym->print(O, MAI);
-    O << "\n";
-  }
+  if (MAI->hasDotTypeDotSizeDirective())
+    O << "\t.size " << *CurrentFnSym << ", .-" << *CurrentFnSym << "\n";
 
   // Emit post-function debug information.
   DW->EndFunction(&MF);
@@ -379,7 +363,7 @@
     break;
   }
   case MachineOperand::MO_MachineBasicBlock:
-    GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MO.getMBB()->getNumber());
     return;
   case MachineOperand::MO_GlobalAddress: {
     bool isCallOp = Modifier && !strcmp(Modifier, "call");
@@ -391,7 +375,7 @@
     else if ((Modifier && strcmp(Modifier, "hi16") == 0) ||
              (TF & ARMII::MO_HI16))
       O << ":upper16:";
-    GetGlobalValueSymbol(GV)->print(O, MAI);
+    O << *GetGlobalValueSymbol(GV);
 
     printOffset(MO.getOffset());
 
@@ -402,7 +386,7 @@
   }
   case MachineOperand::MO_ExternalSymbol: {
     bool isCallOp = Modifier && !strcmp(Modifier, "call");
-    GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
+    O << *GetExternalSymbolSymbol(MO.getSymbolName());
     
     if (isCallOp && Subtarget->isTargetELF() &&
         TM.getRelocationModel() == Reloc::PIC_)
@@ -949,11 +933,11 @@
         << '_' << JTI << '_' << MO2.getImm()
         << "_set_" << MBB->getNumber();
     else if (TM.getRelocationModel() == Reloc::PIC_) {
-      GetMBBSymbol(MBB->getNumber())->print(O, MAI);
-      O << '-' << MAI->getPrivateGlobalPrefix() << "JTI"
+      O << *GetMBBSymbol(MBB->getNumber())
+        << '-' << MAI->getPrivateGlobalPrefix() << "JTI"
         << getFunctionNumber() << '_' << JTI << '_' << MO2.getImm();
     } else {
-      GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+      O << *GetMBBSymbol(MBB->getNumber());
     }
     if (i != e-1)
       O << '\n';
@@ -984,13 +968,11 @@
     else if (HalfWordOffset)
       O << MAI->getData16bitsDirective();
     if (ByteOffset || HalfWordOffset) {
-      O << '(';
-      GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+      O << '(' << GetMBBSymbol(MBB->getNumber());
       O << "-" << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
         << '_' << JTI << '_' << MO2.getImm() << ")/2";
     } else {
-      O << "\tb.w ";
-      GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+      O << "\tb.w " << *GetMBBSymbol(MBB->getNumber());
     }
     if (i != e-1)
       O << '\n';
@@ -1211,11 +1193,8 @@
 
   printVisibility(GVarSym, GVar->getVisibility());
 
-  if (Subtarget->isTargetELF()) {
-    O << "\t.type ";
-    GVarSym->print(O, MAI);
-    O << ",%object\n";
-  }
+  if (Subtarget->isTargetELF())
+    O << "\t.type " << *GVarSym << ",%object\n";
 
   const MCSection *TheSection =
     getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
@@ -1227,12 +1206,9 @@
       !TheSection->getKind().isMergeableCString()) {
     if (GVar->hasExternalLinkage()) {
       if (const char *Directive = MAI->getZeroFillDirective()) {
-        O << "\t.globl\t";
-        GVarSym->print(O, MAI);
-        O << "\n";
-        O << Directive << "__DATA, __common, ";
-        GVarSym->print(O, MAI);
-        O << ", " << Size << ", " << Align << "\n";
+        O << "\t.globl\t" << *GVarSym << "\n";
+        O << Directive << "__DATA, __common, " << *GVarSym
+          << ", " << Size << ", " << Align << "\n";
         return;
       }
     }
@@ -1242,23 +1218,17 @@
 
       if (isDarwin) {
         if (GVar->hasLocalLinkage()) {
-          O << MAI->getLCOMMDirective();
-          GVarSym->print(O, MAI);
-          O << ',' << Size << ',' << Align;
+          O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size
+            << ',' << Align;
         } else if (GVar->hasCommonLinkage()) {
-          O << MAI->getCOMMDirective();
-          GVarSym->print(O, MAI);
-          O << ',' << Size << ',' << Align;
+          O << MAI->getCOMMDirective() << *GVarSym << ',' << Size
+            << ',' << Align;
         } else {
           OutStreamer.SwitchSection(TheSection);
-          O << "\t.globl ";
-          GVarSym->print(O, MAI);
-          O << '\n' << MAI->getWeakDefDirective();
-          GVarSym->print(O, MAI);
-          O << '\n';
+          O << "\t.globl " << *GVarSym << '\n' << MAI->getWeakDefDirective();
+          O << *GVarSym << '\n';
           EmitAlignment(Align, GVar);
-          GVarSym->print(O, MAI);
-          O << ":";
+          O << *GVarSym << ":";
           if (VerboseAsm) {
             O.PadToColumn(MAI->getCommentColumn());
             O << MAI->getCommentString() << ' ';
@@ -1270,25 +1240,16 @@
         }
       } else if (MAI->getLCOMMDirective() != NULL) {
         if (GVar->hasLocalLinkage()) {
-          O << MAI->getLCOMMDirective();
-          GVarSym->print(O, MAI);
-          O << "," << Size;
+          O << MAI->getLCOMMDirective() << *GVarSym << "," << Size;
         } else {
-          O << MAI->getCOMMDirective();
-          GVarSym->print(O, MAI);
-          O << "," << Size;
+          O << MAI->getCOMMDirective() << *GVarSym << "," << Size;
           if (MAI->getCOMMDirectiveTakesAlignment())
             O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
         }
       } else {
-        if (GVar->hasLocalLinkage()) {
-          O << "\t.local\t";
-          GVarSym->print(O, MAI);
-          O << '\n';
-        }
-        O << MAI->getCOMMDirective();
-        GVarSym->print(O, MAI);
-        O << "," << Size;
+        if (GVar->hasLocalLinkage())
+          O << "\t.local\t" << *GVarSym << '\n';
+        O << MAI->getCOMMDirective() << *GVarSym << "," << Size;
         if (MAI->getCOMMDirectiveTakesAlignment())
           O << "," << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
       }
@@ -1310,24 +1271,17 @@
   case GlobalValue::WeakODRLinkage:
   case GlobalValue::LinkerPrivateLinkage:
     if (isDarwin) {
-      O << "\t.globl ";
-      GVarSym->print(O, MAI);
-      O << "\n\t.weak_definition ";
-      GVarSym->print(O, MAI);
-      O << "\n";
+      O << "\t.globl " << *GVarSym
+        << "\n\t.weak_definition " << *GVarSym << "\n";
     } else {
-      O << "\t.weak ";
-      GVarSym->print(O, MAI);
-      O << "\n";
+      O << "\t.weak " << *GVarSym << "\n";
     }
     break;
   case GlobalValue::AppendingLinkage:
   // FIXME: appending linkage variables should go into a section of
   // their name or something.  For now, just emit them as external.
   case GlobalValue::ExternalLinkage:
-    O << "\t.globl ";
-    GVarSym->print(O, MAI);
-    O << "\n";
+    O << "\t.globl " << *GVarSym << "\n";
     break;
   case GlobalValue::PrivateLinkage:
   case GlobalValue::InternalLinkage:
@@ -1337,19 +1291,15 @@
   }
 
   EmitAlignment(Align, GVar);
-  GVarSym->print(O, MAI);
-  O << ":";
+  O << *GVarSym << ":";
   if (VerboseAsm) {
     O.PadToColumn(MAI->getCommentColumn());
     O << MAI->getCommentString() << ' ';
     WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
   }
   O << "\n";
-  if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.size ";
-    GVarSym->print(O, MAI);
-    O << ", " << Size << "\n";
-  }
+  if (MAI->hasDotTypeDotSizeDirective())
+    O << "\t.size " << *GVarSym << ", " << Size << "\n";
 
   EmitGlobalConstant(C);
   O << '\n';
@@ -1374,10 +1324,8 @@
       OutStreamer.SwitchSection(TLOFMacho.getNonLazySymbolPointerSection());
       EmitAlignment(2);
       for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
-        Stubs[i].first->print(O, MAI);
-        O << ":\n\t.indirect_symbol ";
-        Stubs[i].second->print(O, MAI);
-        O << "\n\t.long\t0\n";
+        O << *Stubs[i].first << ":\n\t.indirect_symbol ";
+        O << *Stubs[i].second << "\n\t.long\t0\n";
       }
     }
 
@@ -1385,12 +1333,8 @@
     if (!Stubs.empty()) {
       OutStreamer.SwitchSection(getObjFileLowering().getDataSection());
       EmitAlignment(2);
-      for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
-        Stubs[i].first->print(O, MAI);
-        O << ":\n\t.long ";
-        Stubs[i].second->print(O, MAI);
-        O << "\n";
-      }
+      for (unsigned i = 0, e = Stubs.size(); i != e; ++i)
+        O << *Stubs[i].first << ":\n\t.long " << *Stubs[i].second << "\n";
     }
 
     // Funny Darwin hack: This flag tells the linker that no global symbols
diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
index e280a45..4807800 100644
--- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
+++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
@@ -94,7 +94,7 @@
     return;
 
   case MachineOperand::MO_MachineBasicBlock:
-    GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MO.getMBB()->getNumber());
     return;
 
   case MachineOperand::MO_ConstantPoolIndex:
@@ -107,7 +107,7 @@
     return;
 
   case MachineOperand::MO_GlobalAddress:
-    GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+    O << *GetGlobalValueSymbol(MO.getGlobal());
     return;
 
   case MachineOperand::MO_JumpTableIndex:
@@ -148,35 +148,28 @@
   case Function::LinkerPrivateLinkage:
     break;
   case Function::ExternalLinkage:
-    O << "\t.globl ";
-    CurrentFnSym->print(O, MAI);
-    O << "\n";
+    O << "\t.globl " << *CurrentFnSym << '\n';
     break;
   case Function::WeakAnyLinkage:
   case Function::WeakODRLinkage:
   case Function::LinkOnceAnyLinkage:
   case Function::LinkOnceODRLinkage:
-    O << MAI->getWeakRefDirective();
-    CurrentFnSym->print(O, MAI);
-    O << "\n";
+    O << MAI->getWeakRefDirective() << *CurrentFnSym << '\n';
     break;
   }
 
   printVisibility(CurrentFnSym, F->getVisibility());
 
-  O << "\t.ent ";
-  CurrentFnSym->print(O, MAI);
-  O << "\n";
+  O << "\t.ent " << *CurrentFnSym << "\n";
 
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << *CurrentFnSym << ":\n";
 
   // Print out code for the function.
   for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
        I != E; ++I) {
-    if (I != MF.begin()) {
+    if (I != MF.begin())
       EmitBasicBlockStart(I);
-    }
+
     for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
          II != E; ++II) {
       // Print the assembly for the instruction.
@@ -191,9 +184,7 @@
     }
   }
 
-  O << "\t.end ";
-  CurrentFnSym->print(O, MAI);
-  O << "\n";
+  O << "\t.end " << *CurrentFnSym << "\n";
 
   // We didn't modify anything.
   return false;
@@ -235,15 +226,11 @@
   case GlobalValue::WeakAnyLinkage:
   case GlobalValue::WeakODRLinkage:
   case GlobalValue::CommonLinkage:
-    O << MAI->getWeakRefDirective();
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << MAI->getWeakRefDirective() << *GVarSym << '\n';
     break;
   case GlobalValue::AppendingLinkage:
   case GlobalValue::ExternalLinkage:
-    O << MAI->getGlobalDirective();
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << MAI->getGlobalDirective() << *GVarSym << '\n';
     break;
   case GlobalValue::InternalLinkage:
   case GlobalValue::PrivateLinkage:
@@ -255,18 +242,13 @@
 
   // 3: Type, Size, Align
   if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.type\t";
-    GVarSym->print(O, MAI);
-    O << ", @object\n";
-    O << "\t.size\t";
-    GVarSym->print(O, MAI);
-    O << ", " << Size << "\n";
+    O << "\t.type\t" << *GVarSym << ", @object\n";
+    O << "\t.size\t" << *GVarSym << ", " << Size << "\n";
   }
 
   EmitAlignment(Align, GVar);
   
-  GVarSym->print(O, MAI);
-  O << ":\n";
+  O << *GVarSym << ":\n";
 
   EmitGlobalConstant(C);
   O << '\n';
diff --git a/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp b/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
index 7fdf1e7..8afa650 100644
--- a/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
+++ b/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
@@ -79,20 +79,14 @@
   case GlobalValue::LinkerPrivateLinkage:
     break;
   case GlobalValue::ExternalLinkage:
-    O << MAI->getGlobalDirective();
-    GVSym->print(O, MAI);
-    O << "\n";
+    O << MAI->getGlobalDirective() << *GVSym << "\n";
     break;
   case GlobalValue::LinkOnceAnyLinkage:
   case GlobalValue::LinkOnceODRLinkage:
   case GlobalValue::WeakAnyLinkage:
   case GlobalValue::WeakODRLinkage:
-    O << MAI->getGlobalDirective();
-    GVSym->print(O, MAI);
-    O << "\n";
-    O << MAI->getWeakDefDirective();
-    GVSym->print(O, MAI);
-    O << "\n";
+    O << MAI->getGlobalDirective() << *GVSym << "\n";
+    O << MAI->getWeakDefDirective() << *GVSym << "\n";
     break;
   }
 }
@@ -112,15 +106,10 @@
   EmitAlignment(TD->getPreferredAlignmentLog(GV), GV);
   printVisibility(GVSym, GV->getVisibility());
 
-  O << "\t.type ";
-  GVSym->print(O, MAI);
-  O << ", STT_OBJECT\n";
-  O << "\t.size ";
-  GVSym->print(O, MAI);
-  O << "\n";
+  O << "\t.type " << *GVSym << ", STT_OBJECT\n";
+  O << "\t.size " << *GVSym << "\n";
   O << ',' << TD->getTypeAllocSize(C->getType()) << '\n';
-  GVSym->print(O, MAI);
-  O << ":\n";
+  O << *GVSym << ":\n";
   EmitGlobalConstant(C);
 }
 
@@ -138,11 +127,8 @@
   emitLinkage(CurrentFnSym, F->getLinkage());
   printVisibility(CurrentFnSym, F->getVisibility());
 
-  O << "\t.type\t";
-  CurrentFnSym->print(O, MAI);
-  O << ", STT_FUNC\n";
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << "\t.type\t" << *CurrentFnSym << ", STT_FUNC\n";
+  O << *CurrentFnSym << ":\n";
 
   if (DW)
     DW->BeginFunction(&MF);
@@ -168,11 +154,7 @@
     }
   }
 
-  O << "\t.size ";
-  CurrentFnSym->print(O, MAI);
-  O << ", .-";
-  CurrentFnSym->print(O, MAI);
-  O << "\n";
+  O << "\t.size " << *CurrentFnSym << ", .-" << *CurrentFnSym << "\n";
 
   if (DW)
     DW->EndFunction(&MF);
@@ -193,14 +175,14 @@
     O << MO.getImm();
     break;
   case MachineOperand::MO_MachineBasicBlock:
-    GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MO.getMBB()->getNumber());
     return;
   case MachineOperand::MO_GlobalAddress:
-    GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+    O << *GetGlobalValueSymbol(MO.getGlobal());
     printOffset(MO.getOffset());
     break;
   case MachineOperand::MO_ExternalSymbol:
-    GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
+    O << *GetExternalSymbolSymbol(MO.getSymbolName());
     break;
   case MachineOperand::MO_ConstantPoolIndex:
     O << MAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_"
diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
index 6e3b54e..b8ee8c0 100644
--- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
+++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
@@ -315,7 +315,7 @@
     return;
 
   case MachineOperand::MO_MachineBasicBlock:
-    GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MO.getMBB()->getNumber());
     return;
   case MachineOperand::MO_JumpTableIndex:
     O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
@@ -332,7 +332,7 @@
         << "$non_lazy_ptr";
       return;
     }
-    GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
+    O << *GetExternalSymbolSymbol(MO.getSymbolName());
     return;
   case MachineOperand::MO_GlobalAddress:
     // External or weakly linked global variables need non-lazily-resolved
@@ -341,11 +341,11 @@
       GlobalValue *GV = MO.getGlobal();
       if (((GV->isDeclaration() || GV->hasWeakLinkage() ||
             GV->hasLinkOnceLinkage() || GV->hasCommonLinkage()))) {
-        GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr")->print(O, MAI);
+        O << *GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
         return;
       }
     }
-    GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+    O << *GetGlobalValueSymbol(MO.getGlobal());
     return;
   default:
     O << "<unknown operand type: " << MO.getType() << ">";
@@ -427,27 +427,19 @@
   case Function::InternalLinkage:  // Symbols default to internal.
     break;
   case Function::ExternalLinkage:
-    O << "\t.global\t";
-    CurrentFnSym->print(O, MAI);
-    O << "\n" << "\t.type\t";
-    CurrentFnSym->print(O, MAI);
-    O << ", @function\n";
+    O << "\t.global\t" << *CurrentFnSym << "\n" << "\t.type\t";
+    O << *CurrentFnSym << ", @function\n";
     break;
   case Function::WeakAnyLinkage:
   case Function::WeakODRLinkage:
   case Function::LinkOnceAnyLinkage:
   case Function::LinkOnceODRLinkage:
-    O << "\t.global\t";
-    CurrentFnSym->print(O, MAI);
-    O << "\n";
-    O << "\t.weak_definition\t";
-    CurrentFnSym->print(O, MAI);
-    O << "\n";
+    O << "\t.global\t" << *CurrentFnSym << "\n";
+    O << "\t.weak_definition\t" << *CurrentFnSym << "\n";
     break;
   }
   
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << *CurrentFnSym << ":\n";
 
   // Emit pre-function debug information.
   DW->BeginFunction(&MF);
@@ -466,11 +458,7 @@
     }
   }
 
-  O << "\t.size\t";
-  CurrentFnSym->print(O, MAI);
-  O << ",.-";
-  CurrentFnSym->print(O, MAI);
-  O << "\n";
+  O << "\t.size\t" << *CurrentFnSym << ",.-" << *CurrentFnSym << "\n";
 
   // Print out jump tables referenced by the function.
   EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
@@ -518,23 +506,14 @@
       if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
 
       if (GVar->hasExternalLinkage()) {
-        O << "\t.global ";
-        GVarSym->print(O, MAI);
-        O << '\n';
-        O << "\t.type ";
-        GVarSym->print(O, MAI);
-        O << ", @object\n";
-        GVarSym->print(O, MAI);
-        O << ":\n";
+        O << "\t.global " << *GVarSym << '\n';
+        O << "\t.type " << *GVarSym << ", @object\n";
+        O << *GVarSym << ":\n";
         O << "\t.zero " << Size << '\n';
       } else if (GVar->hasLocalLinkage()) {
-        O << MAI->getLCOMMDirective();
-        GVarSym->print(O, MAI);
-        O << ',' << Size;
+        O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size;
       } else {
-        O << ".comm ";
-        GVarSym->print(O, MAI);
-        O << ',' << Size;
+        O << ".comm " << *GVarSym << ',' << Size;
       }
       O << "\t\t" << MAI->getCommentString() << " '";
       WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
@@ -549,24 +528,15 @@
   case GlobalValue::WeakAnyLinkage:
   case GlobalValue::WeakODRLinkage:
   case GlobalValue::CommonLinkage:
-    O << "\t.global ";
-    GVarSym->print(O, MAI);
-    O << "\n\t.type ";
-    GVarSym->print(O, MAI);
-    O << ", @object\n" << "\t.weak ";
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << "\t.global " << *GVarSym << "\n\t.type " << *GVarSym << ", @object\n";
+    O << "\t.weak " << *GVarSym << '\n';
     break;
   case GlobalValue::AppendingLinkage:
     // FIXME: appending linkage variables should go into a section of
     // their name or something.  For now, just emit them as external.
   case GlobalValue::ExternalLinkage:
     // If external or appending, declare as a global symbol
-    O << "\t.global ";
-    GVarSym->print(O, MAI);
-    O << "\n\t.type ";
-    GVarSym->print(O, MAI);
-    O << ", @object\n";
+    O << "\t.global " << *GVarSym << "\n\t.type " << *GVarSym << ", @object\n";
     break;
   case GlobalValue::PrivateLinkage:
   case GlobalValue::LinkerPrivateLinkage:
@@ -577,8 +547,7 @@
   }
 
   EmitAlignment(Align, GVar);
-  GVarSym->print(O, MAI);
-  O << ":\t\t\t\t" << MAI->getCommentString() << " '";
+  O << *GVarSym << ":\t\t\t\t" << MAI->getCommentString() << " '";
   WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
   O << "'\n";
 
diff --git a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
index c9a3520..19b8867 100644
--- a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
+++ b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
@@ -106,9 +106,7 @@
 
   printVisibility(GVarSym, GVar->getVisibility());
 
-  O << "\t.type\t";
-  GVarSym->print(O, MAI);
-  O << ",@object\n";
+  O << "\t.type\t" << *GVarSym << ",@object\n";
 
   OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang,
                                                                   TM));
@@ -119,15 +117,10 @@
 
     if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
 
-    if (GVar->hasLocalLinkage()) {
-      O << "\t.local\t";
-      GVarSym->print(O, MAI);
-      O << '\n';
-    }
+    if (GVar->hasLocalLinkage())
+      O << "\t.local\t" << *GVarSym << '\n';
 
-    O << MAI->getCOMMDirective();
-    GVarSym->print(O, MAI);
-    O << ',' << Size;
+    O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
     if (MAI->getCOMMDirectiveTakesAlignment())
       O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
 
@@ -146,9 +139,7 @@
   case GlobalValue::LinkOnceODRLinkage:
   case GlobalValue::WeakAnyLinkage:
   case GlobalValue::WeakODRLinkage:
-    O << "\t.weak\t";
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << "\t.weak\t" << *GVarSym << '\n';
     break;
   case GlobalValue::DLLExportLinkage:
   case GlobalValue::AppendingLinkage:
@@ -156,9 +147,7 @@
     // their name or something.  For now, just emit them as external.
   case GlobalValue::ExternalLinkage:
     // If external or appending, declare as a global symbol
-    O << "\t.globl ";
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << "\t.globl " << *GVarSym << '\n';
     // FALL THROUGH
   case GlobalValue::PrivateLinkage:
   case GlobalValue::LinkerPrivateLinkage:
@@ -170,8 +159,7 @@
 
   // Use 16-bit alignment by default to simplify bunch of stuff
   EmitAlignment(Align, GVar);
-  GVarSym->print(O, MAI);
-  O << ":";
+  O << *GVarSym << ":";
   if (VerboseAsm) {
     O.PadToColumn(MAI->getCommentColumn());
     O << MAI->getCommentString() << ' ';
@@ -181,11 +169,8 @@
 
   EmitGlobalConstant(C);
 
-  if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.size\t";
-    GVarSym->print(O, MAI);
-    O << ", " << Size << '\n';
-  }
+  if (MAI->hasDotTypeDotSizeDirective())
+    O << "\t.size\t" << *GVarSym << ", " << Size << '\n';
 }
 
 void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
@@ -203,27 +188,20 @@
   case Function::LinkerPrivateLinkage:
     break;
   case Function::ExternalLinkage:
-    O << "\t.globl\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
+    O << "\t.globl\t" << *CurrentFnSym << '\n';
     break;
   case Function::LinkOnceAnyLinkage:
   case Function::LinkOnceODRLinkage:
   case Function::WeakAnyLinkage:
   case Function::WeakODRLinkage:
-    O << "\t.weak\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
+    O << "\t.weak\t" << *CurrentFnSym << '\n';
     break;
   }
 
   printVisibility(CurrentFnSym, F->getVisibility());
 
-  O << "\t.type\t";
-  CurrentFnSym->print(O, MAI);
-  O << ",@function\n";
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << "\t.type\t" << *CurrentFnSym << ",@function\n";
+  O << *CurrentFnSym << ":\n";
 }
 
 bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
@@ -245,13 +223,8 @@
       printMachineInstruction(II);
   }
 
-  if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.size\t";
-    CurrentFnSym->print(O, MAI);
-    O << ", .-";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
-  }
+  if (MAI->hasDotTypeDotSizeDirective())
+    O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';
 
   // We didn't modify anything
   return false;
@@ -284,7 +257,7 @@
     O << MO.getImm();
     return;
   case MachineOperand::MO_MachineBasicBlock:
-    GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MO.getMBB()->getNumber());
     return;
   case MachineOperand::MO_GlobalAddress: {
     bool isMemOp  = Modifier && !strcmp(Modifier, "mem");
@@ -294,7 +267,7 @@
     if (Offset)
       O << '(' << Offset << '+';
 
-    GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+    O << *GetGlobalValueSymbol(MO.getGlobal());
     
     if (Offset)
       O << ')';
diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
index a7baf14..c254932 100644
--- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
+++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
@@ -217,23 +217,15 @@
   // 2 bits aligned
   EmitAlignment(MF.getAlignment(), F);
 
-  O << "\t.globl\t";
-  CurrentFnSym->print(O, MAI);
-  O << '\n';
-  O << "\t.ent\t";
-  CurrentFnSym->print(O, MAI);
-  O << '\n';
+  O << "\t.globl\t" << *CurrentFnSym << '\n';
+  O << "\t.ent\t" << *CurrentFnSym << '\n';
 
   printVisibility(CurrentFnSym, F->getVisibility());
 
-  if ((MAI->hasDotTypeDotSizeDirective()) && Subtarget->isLinux()) {
-    O << "\t.type\t";
-    CurrentFnSym->print(O, MAI);
-    O << ", @function\n";
-  }
+  if ((MAI->hasDotTypeDotSizeDirective()) && Subtarget->isLinux())
+    O << "\t.type\t" << *CurrentFnSym << ", @function\n";
 
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << *CurrentFnSym << ":\n";
 
   emitFrameDirective(MF);
   printSavedRegsBitmask(MF);
@@ -249,16 +241,9 @@
   O << "\t.set\tmacro\n"; 
   O << "\t.set\treorder\n"; 
 
-  O << "\t.end\t";
-  CurrentFnSym->print(O, MAI);
-  O << '\n';
-  if (MAI->hasDotTypeDotSizeDirective() && !Subtarget->isLinux()) {
-    O << "\t.size\t";
-    CurrentFnSym->print(O, MAI);
-    O << ", .-";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
-  }
+  O << "\t.end\t" << *CurrentFnSym << '\n';
+  if (MAI->hasDotTypeDotSizeDirective() && !Subtarget->isLinux())
+    O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';
 }
 
 /// runOnMachineFunction - This uses the printMachineInstruction()
@@ -359,15 +344,15 @@
       break;
 
     case MachineOperand::MO_MachineBasicBlock:
-      GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+      O << *GetMBBSymbol(MO.getMBB()->getNumber());
       return;
 
     case MachineOperand::MO_GlobalAddress:
-      GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+      O << *GetGlobalValueSymbol(MO.getGlobal());
       break;
 
     case MachineOperand::MO_ExternalSymbol:
-      GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
+      O << *GetExternalSymbolSymbol(MO.getSymbolName());
       break;
 
     case MachineOperand::MO_JumpTableIndex:
@@ -478,15 +463,10 @@
         (GVar->hasLocalLinkage() || GVar->isWeakForLinker())) {
       if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
 
-      if (GVar->hasLocalLinkage()) {
-        O << "\t.local\t";
-        GVarSym->print(O, MAI);
-        O << '\n';
-      }
+      if (GVar->hasLocalLinkage())
+        O << "\t.local\t" << *GVarSym << '\n';
 
-      O << MAI->getCOMMDirective();
-      GVarSym->print(O, MAI);
-      O << ',' << Size;
+      O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
       if (MAI->getCOMMDirectiveTakesAlignment())
         O << ',' << (1 << Align);
 
@@ -502,18 +482,14 @@
    case GlobalValue::WeakODRLinkage:
     // FIXME: Verify correct for weak.
     // Nonnull linkonce -> weak
-    O << "\t.weak ";
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << "\t.weak " << *GVarSym << '\n';
     break;
    case GlobalValue::AppendingLinkage:
     // FIXME: appending linkage variables should go into a section of their name
     // or something.  For now, just emit them as external.
    case GlobalValue::ExternalLinkage:
     // If external or appending, declare as a global symbol
-    O << MAI->getGlobalDirective();
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << MAI->getGlobalDirective() << *GVarSym << '\n';
     // Fall Through
    case GlobalValue::PrivateLinkage:
    case GlobalValue::LinkerPrivateLinkage:
@@ -534,16 +510,11 @@
   EmitAlignment(Align, GVar);
 
   if (MAI->hasDotTypeDotSizeDirective() && printSizeAndType) {
-    O << "\t.type ";
-    GVarSym->print(O, MAI);
-    O << ",@object\n";
-    O << "\t.size ";
-    GVarSym->print(O, MAI);
-    O << ',' << Size << '\n';
+    O << "\t.type " << *GVarSym << ",@object\n";
+    O << "\t.size " << *GVarSym << ',' << Size << '\n';
   }
 
-  GVarSym->print(O, MAI);
-  O << ":\n";
+  O << *GVarSym << ":\n";
   EmitGlobalConstant(C);
 }
 
diff --git a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
index af2169e..0463596 100644
--- a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
+++ b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
@@ -124,8 +124,7 @@
   O << "\tretlw  high(" << PAN::getFrameLabel(CurrentFnSym->getName()) << ")\n";
 
   // Emit function start label.
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << *CurrentFnSym << ":\n";
 
   DebugLoc CurDL;
   O << "\n"; 
@@ -191,7 +190,7 @@
       if (PAN::isMemIntrinsic(Sym->getName()))
         LibcallDecls.push_back(createESName(Sym->getName()));
 
-      Sym->print(O, MAI);
+      O << *Sym;
       break;
     }
     case MachineOperand::MO_ExternalSymbol: {
@@ -212,7 +211,7 @@
       break;
     }
     case MachineOperand::MO_MachineBasicBlock:
-      GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+      O << *GetMBBSymbol(MO.getMBB()->getNumber());
       return;
 
     default:
@@ -349,11 +348,8 @@
   if (!Items.size()) return;
 
   O << "\n" << MAI->getCommentString() << "Imported Variables - BEGIN" << "\n";
-  for (unsigned j = 0; j < Items.size(); j++) {
-    O << MAI->getExternDirective();
-    GetGlobalValueSymbol(Items[j])->print(O, MAI);
-    O << "\n";
-  }
+  for (unsigned j = 0; j < Items.size(); j++)
+    O << MAI->getExternDirective() << *GetGlobalValueSymbol(Items[j]) << "\n";
   O << MAI->getCommentString() << "Imported Variables - END" << "\n";
 }
 
@@ -363,11 +359,8 @@
   if (!Items.size()) return;
 
   O << "\n" << MAI->getCommentString() << "Exported Variables - BEGIN" << "\n";
-  for (unsigned j = 0; j < Items.size(); j++) {
-    O << MAI->getGlobalDirective();
-    GetGlobalValueSymbol(Items[j])->print(O, MAI);
-    O << "\n";
-  }
+  for (unsigned j = 0; j < Items.size(); j++)
+    O << MAI->getGlobalDirective() << *GetGlobalValueSymbol(Items[j]) << "\n";
   O <<  MAI->getCommentString() << "Exported Variables - END" << "\n";
 }
 
@@ -446,7 +439,7 @@
     for (unsigned j = 0; j < Items.size(); j++) {
       Constant *C = Items[j]->getInitializer();
       int AddrSpace = Items[j]->getType()->getAddressSpace();
-      GetGlobalValueSymbol(Items[j])->print(O, MAI);
+      O << *GetGlobalValueSymbol(Items[j]);
       EmitGlobalConstant(C, AddrSpace);
    }
 }
@@ -465,8 +458,7 @@
       Constant *C = Items[j]->getInitializer();
       const Type *Ty = C->getType();
       unsigned Size = TD->getTypeAllocSize(Ty);
-      GetGlobalValueSymbol(Items[j])->print(O, MAI);
-      O << " RES " << Size << "\n";
+      O << *GetGlobalValueSymbol(Items[j]) << " RES " << Size << "\n";
     }
 }
 
diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
index b62c812..db37a1a 100644
--- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
@@ -238,7 +238,7 @@
             // Dynamically-resolved functions need a stub for the function.
             FnStubInfo &FnInfo = FnStubs[GetGlobalValueSymbol(GV)];
             FnInfo.Init(GV, this);
-            FnInfo.Stub->print(O, MAI);
+            O << *FnInfo.Stub;
             return;
           }
         }
@@ -246,7 +246,7 @@
           FnStubInfo &FnInfo =
             FnStubs[GetExternalSymbolSymbol(MO.getSymbolName())];
           FnInfo.Init(MO.getSymbolName(), Mang, OutContext);
-          FnInfo.Stub->print(O, MAI);
+          O << *FnInfo.Stub;
           return;
         }
       }
@@ -342,8 +342,7 @@
           GetOrCreateSymbol(StringRef(MAI->getPrivateGlobalPrefix()) + "C" +
                             Twine(LabelID++));
 
-      TOCEntry->print(O, MAI);
-      O << "@toc";
+      O << *TOCEntry << "@toc";
     }
 
     void printPredicateOperand(const MachineInstr *MI, unsigned OpNo,
@@ -413,7 +412,7 @@
     llvm_unreachable("printOp() does not handle immediate values");
 
   case MachineOperand::MO_MachineBasicBlock:
-    GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MO.getMBB()->getNumber());
     return;
   case MachineOperand::MO_JumpTableIndex:
     O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
@@ -425,20 +424,20 @@
       << '_' << MO.getIndex();
     return;
   case MachineOperand::MO_BlockAddress:
-    GetBlockAddressSymbol(MO.getBlockAddress())->print(O, MAI);
+    O << *GetBlockAddressSymbol(MO.getBlockAddress());
     return;
   case MachineOperand::MO_ExternalSymbol: {
     // Computing the address of an external symbol, not calling it.
     const MCSymbol *SymName = GetExternalSymbolSymbol(MO.getSymbolName());
     if (TM.getRelocationModel() == Reloc::Static) {
-      SymName->print(O, MAI);
+      O << *SymName;
       return;
     }
     const MCSymbol *NLPSym = 
       OutContext.GetOrCreateSymbol(StringRef(MAI->getGlobalPrefix())+
                                    MO.getSymbolName()+"$non_lazy_ptr");
     GVStubs[SymName] = NLPSym;
-    NLPSym->print(O, MAI);
+    O << *NLPSym;
     return;
   }
   case MachineOperand::MO_GlobalAddress: {
@@ -463,7 +462,7 @@
       SymToPrint = GetGlobalValueSymbol(GV);
     }
     
-    SymToPrint->print(O, MAI);
+    O << *SymToPrint;
 
     printOffset(MO.getOffset());
     return;
@@ -635,23 +634,16 @@
   case Function::InternalLinkage:  // Symbols default to internal.
     break;
   case Function::ExternalLinkage:
-    O << "\t.global\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n' << "\t.type\t";
-    CurrentFnSym->print(O, MAI);
-    O << ", @function\n";
+    O << "\t.global\t" << *CurrentFnSym << '\n' << "\t.type\t";
+    O << *CurrentFnSym << ", @function\n";
     break;
   case Function::LinkerPrivateLinkage:
   case Function::WeakAnyLinkage:
   case Function::WeakODRLinkage:
   case Function::LinkOnceAnyLinkage:
   case Function::LinkOnceODRLinkage:
-    O << "\t.global\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
-    O << "\t.weak\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
+    O << "\t.global\t" << *CurrentFnSym << '\n';
+    O << "\t.weak\t" << *CurrentFnSym << '\n';
     break;
   }
 
@@ -664,18 +656,12 @@
     // FIXME 64-bit SVR4: Use MCSection here!
     O << "\t.section\t\".opd\",\"aw\"\n";
     O << "\t.align 3\n";
-    CurrentFnSym->print(O, MAI);
-    O  << ":\n";
-    O << "\t.quad .L.";
-    CurrentFnSym->print(O, MAI);
-    O << ",.TOC.@tocbase\n";
+    O << *CurrentFnSym << ":\n";
+    O << "\t.quad .L." << *CurrentFnSym << ",.TOC.@tocbase\n";
     O << "\t.previous\n";
-    O << ".L.";
-    CurrentFnSym->print(O, MAI);
-    O << ":\n";
+    O << ".L." << *CurrentFnSym << ":\n";
   } else {
-    CurrentFnSym->print(O, MAI);
-    O  << ":\n";
+    O << *CurrentFnSym << ":\n";
   }
 
   // Emit pre-function debug information.
@@ -695,11 +681,7 @@
     }
   }
 
-  O << "\t.size\t";
-  CurrentFnSym->print(O, MAI);
-  O << ",.-";
-  CurrentFnSym->print(O, MAI);
-  O << '\n';
+  O << "\t.size\t" << *CurrentFnSym << ",.-" << *CurrentFnSym << '\n';
 
   OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
 
@@ -742,23 +724,14 @@
       if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
 
       if (GVar->hasExternalLinkage()) {
-        O << "\t.global ";
-        GVarSym->print(O, MAI);
-        O << '\n';
-        O << "\t.type ";
-        GVarSym->print(O, MAI);
-        O << ", @object\n";
-        GVarSym->print(O, MAI);
-        O  << ":\n";
+        O << "\t.global " << *GVarSym << '\n';
+        O << "\t.type " << *GVarSym << ", @object\n";
+        O << *GVarSym << ":\n";
         O << "\t.zero " << Size << '\n';
       } else if (GVar->hasLocalLinkage()) {
-        O << MAI->getLCOMMDirective();
-        GVarSym->print(O, MAI);
-        O << ',' << Size;
+        O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size;
       } else {
-        O << ".comm ";
-        GVarSym->print(O, MAI);
-        O  << ',' << Size;
+        O << ".comm " << *GVarSym << ',' << Size;
       }
       if (VerboseAsm) {
         O << "\t\t" << MAI->getCommentString() << " '";
@@ -776,24 +749,16 @@
    case GlobalValue::WeakODRLinkage:
    case GlobalValue::CommonLinkage:
    case GlobalValue::LinkerPrivateLinkage:
-    O << "\t.global ";
-    GVarSym->print(O, MAI);
-    O << "\n\t.type ";
-    GVarSym->print(O, MAI);
-    O << ", @object\n\t.weak ";
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << "\t.global " << *GVarSym;
+    O << "\n\t.type " << *GVarSym << ", @object\n\t.weak " << *GVarSym << '\n';
     break;
    case GlobalValue::AppendingLinkage:
     // FIXME: appending linkage variables should go into a section of
     // their name or something.  For now, just emit them as external.
    case GlobalValue::ExternalLinkage:
     // If external or appending, declare as a global symbol
-    O << "\t.global ";
-    GVarSym->print(O, MAI);
-    O << "\n\t.type ";
-    GVarSym->print(O, MAI);
-    O << ", @object\n";
+    O << "\t.global " << *GVarSym;
+    O << "\n\t.type " << *GVarSym << ", @object\n";
     // FALL THROUGH
    case GlobalValue::InternalLinkage:
    case GlobalValue::PrivateLinkage:
@@ -803,8 +768,7 @@
   }
 
   EmitAlignment(Align, GVar);
-  GVarSym->print(O, MAI);
-  O << ":";
+  O << *GVarSym << ":";
   if (VerboseAsm) {
     O << "\t\t\t\t" << MAI->getCommentString() << " '";
     WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
@@ -828,13 +792,8 @@
     // FIXME: This is nondeterminstic!
     for (DenseMap<const MCSymbol*, const MCSymbol*>::iterator I = TOC.begin(),
          E = TOC.end(); I != E; ++I) {
-      I->second->print(O, MAI);
-      O << ":\n";
-      O << "\t.tc ";
-      I->first->print(O, MAI);
-      O << "[TC],";
-      I->first->print(O, MAI);
-      O << '\n';
+      O << *I->second << ":\n";
+      O << "\t.tc " << *I->first << "[TC]," << *I->first << '\n';
     }
   }
 
@@ -863,29 +822,22 @@
   case Function::InternalLinkage:  // Symbols default to internal.
     break;
   case Function::ExternalLinkage:
-    O << "\t.globl\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
+    O << "\t.globl\t" << *CurrentFnSym << '\n';
     break;
   case Function::WeakAnyLinkage:
   case Function::WeakODRLinkage:
   case Function::LinkOnceAnyLinkage:
   case Function::LinkOnceODRLinkage:
   case Function::LinkerPrivateLinkage:
-    O << "\t.globl\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
-    O << "\t.weak_definition\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
+    O << "\t.globl\t" << *CurrentFnSym << '\n';
+    O << "\t.weak_definition\t" << *CurrentFnSym << '\n';
     break;
   }
 
   printVisibility(CurrentFnSym, F->getVisibility());
 
   EmitAlignment(MF.getAlignment(), F);
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << *CurrentFnSym << ":\n";
 
   // Emit pre-function debug information.
   DW->BeginFunction(&MF);
@@ -1006,25 +958,16 @@
     if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
 
     if (GVar->hasExternalLinkage()) {
-      O << "\t.globl ";
-      GVarSym->print(O, MAI);
-      O << '\n';
-      O << "\t.zerofill __DATA, __common, ";
-      GVarSym->print(O, MAI);
-      O << ", " << Size << ", " << Align;
+      O << "\t.globl " << *GVarSym << '\n';
+      O << "\t.zerofill __DATA, __common, " << *GVarSym << ", "
+        << Size << ", " << Align;
     } else if (GVar->hasLocalLinkage()) {
-      O << MAI->getLCOMMDirective();
-      GVarSym->print(O, MAI);
-      O << ',' << Size << ',' << Align;
+      O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size << ',' << Align;
     } else if (!GVar->hasCommonLinkage()) {
-      O << "\t.globl ";
-      GVarSym->print(O, MAI);
-      O << '\n' << MAI->getWeakDefDirective();
-      GVarSym->print(O, MAI);
-      O << '\n';
+      O << "\t.globl " << *GVarSym << '\n' << MAI->getWeakDefDirective();
+      O << *GVarSym << '\n';
       EmitAlignment(Align, GVar);
-      GVarSym->print(O, MAI);
-      O << ":";
+      O << *GVarSym << ":";
       if (VerboseAsm) {
         O << "\t\t\t\t" << MAI->getCommentString() << " ";
         WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
@@ -1033,9 +976,7 @@
       EmitGlobalConstant(C);
       return;
     } else {
-      O << ".comm ";
-      GVarSym->print(O, MAI);
-      O << ',' << Size;
+      O << ".comm " << *GVarSym << ',' << Size;
       // Darwin 9 and above support aligned common data.
       if (Subtarget.isDarwin9())
         O << ',' << Align;
@@ -1056,20 +997,14 @@
   case GlobalValue::WeakODRLinkage:
   case GlobalValue::CommonLinkage:
   case GlobalValue::LinkerPrivateLinkage:
-    O << "\t.globl ";
-    GVarSym->print(O, MAI);
-    O << "\n\t.weak_definition ";
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << "\t.globl " << *GVarSym << "\n\t.weak_definition " << *GVarSym << '\n';
     break;
   case GlobalValue::AppendingLinkage:
     // FIXME: appending linkage variables should go into a section of
     // their name or something.  For now, just emit them as external.
   case GlobalValue::ExternalLinkage:
     // If external or appending, declare as a global symbol
-    O << "\t.globl ";
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << "\t.globl " << *GVarSym << '\n';
     // FALL THROUGH
   case GlobalValue::InternalLinkage:
   case GlobalValue::PrivateLinkage:
@@ -1079,8 +1014,7 @@
   }
 
   EmitAlignment(Align, GVar);
-  GVarSym->print(O, MAI);
-  O << ":";
+  O << *GVarSym << ":";
   if (VerboseAsm) {
     O << "\t\t\t\t" << MAI->getCommentString() << " '";
     WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
@@ -1120,38 +1054,23 @@
       OutStreamer.SwitchSection(StubSection);
       EmitAlignment(4);
       const FnStubInfo &Info = I->second;
-      Info.Stub->print(O, MAI);
-      O << ":\n";
-      O << "\t.indirect_symbol ";
-      I->first->print(O, MAI);
-      O << '\n';
+      O << *Info.Stub << ":\n";
+      O << "\t.indirect_symbol " << *I->first << '\n';
       O << "\tmflr r0\n";
-      O << "\tbcl 20,31,";
-      Info.AnonSymbol->print(O, MAI);
-      O << '\n';
-      Info.AnonSymbol->print(O, MAI);
-      O << ":\n";
+      O << "\tbcl 20,31," << *Info.AnonSymbol << '\n';
+      O << *Info.AnonSymbol << ":\n";
       O << "\tmflr r11\n";
-      O << "\taddis r11,r11,ha16(";
-      Info.LazyPtr->print(O, MAI);
-      O << '-';
-      Info.AnonSymbol->print(O, MAI);
-      O << ")\n";
+      O << "\taddis r11,r11,ha16(" << *Info.LazyPtr << '-' << *Info.AnonSymbol
+        << ")\n";
       O << "\tmtlr r0\n";
-      O << (isPPC64 ? "\tldu" : "\tlwzu") << " r12,lo16(";
-      Info.LazyPtr->print(O, MAI);
-      O << '-';
-      Info.AnonSymbol->print(O, MAI);
-      O << ")(r11)\n";
+      O << (isPPC64 ? "\tldu" : "\tlwzu") << " r12,lo16(" << *Info.LazyPtr
+        << '-' << *Info.AnonSymbol << ")(r11)\n";
       O << "\tmtctr r12\n";
       O << "\tbctr\n";
       
       OutStreamer.SwitchSection(LSPSection);
-      Info.LazyPtr->print(O, MAI);
-      O << ":\n";
-      O << "\t.indirect_symbol ";
-      I->first->print(O, MAI);
-      O << '\n';
+      O << *Info.LazyPtr << ":\n";
+      O << "\t.indirect_symbol " << *I->first << '\n';
       O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n";
     }
   } else if (!FnStubs.empty()) {
@@ -1167,25 +1086,16 @@
       OutStreamer.SwitchSection(StubSection);
       EmitAlignment(4);
       const FnStubInfo &Info = I->second;
-      Info.Stub->print(O, MAI);
-      O << ":\n";
-      O << "\t.indirect_symbol ";
-      I->first->print(O, MAI);
-      O << '\n';
-      O << "\tlis r11,ha16(";
-      Info.LazyPtr->print(O, MAI);
-      O << ")\n";
-      O << (isPPC64 ? "\tldu" :  "\tlwzu") << " r12,lo16(";
-      Info.LazyPtr->print(O, MAI);
-      O << ")(r11)\n";
+      O << *Info.Stub << ":\n";
+      O << "\t.indirect_symbol " << *I->first << '\n';
+      O << "\tlis r11,ha16(" << *Info.LazyPtr << ")\n";
+      O << (isPPC64 ? "\tldu" :  "\tlwzu") << " r12,lo16(" << *Info.LazyPtr
+        << ")(r11)\n";
       O << "\tmtctr r12\n";
       O << "\tbctr\n";
       OutStreamer.SwitchSection(LSPSection);
-      Info.LazyPtr->print(O, MAI);
-      O << ":\n";
-      O << "\t.indirect_symbol ";
-      I->first->print(O, MAI);
-      O << '\n';
+      O << *Info.LazyPtr << ":\n";
+      O << "\t.indirect_symbol " << *I->first << '\n';
       O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n";
     }
   }
@@ -1213,11 +1123,8 @@
     // FIXME: This is nondeterminstic.
     for (DenseMap<const MCSymbol *, const MCSymbol *>::iterator
          I = GVStubs.begin(), E = GVStubs.end(); I != E; ++I) {
-      I->second->print(O, MAI);
-      O << ":\n";
-      O << "\t.indirect_symbol ";
-      I->first->print(O, MAI);
-      O << '\n';
+      O << *I->second << ":\n";
+      O << "\t.indirect_symbol " << *I->first << '\n';
       O << (isPPC64 ? "\t.quad\t0\n" : "\t.long\t0\n");
     }
   }
@@ -1228,11 +1135,8 @@
     // FIXME: This is nondeterminstic.
     for (DenseMap<const MCSymbol *, const MCSymbol *>::iterator
          I = HiddenGVStubs.begin(), E = HiddenGVStubs.end(); I != E; ++I) {
-      I->second->print(O, MAI);
-      O << ":\n";
-      O << (isPPC64 ? "\t.quad\t" : "\t.long\t");
-      I->first->print(O, MAI);
-      O << '\n';
+      O << *I->second << ":\n";
+      O << (isPPC64 ? "\t.quad\t" : "\t.long\t") << *I->first << '\n';
     }
   }
 
diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
index bb9c75d..ca586f6 100644
--- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
+++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
@@ -137,11 +137,7 @@
   DW->EndFunction(&MF);
 
   // We didn't modify anything.
-  O << "\t.size\t";
-  CurrentFnSym->print(O, MAI);
-  O << ", .-";
-  CurrentFnSym->print(O, MAI);
-  O << '\n';
+  O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';
   return false;
 }
 
@@ -159,9 +155,7 @@
   case Function::DLLExportLinkage:
   case Function::ExternalLinkage:
     // Function is externally visible
-    O << "\t.global\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
+    O << "\t.global\t" << *CurrentFnSym << '\n';
     break;
   case Function::LinkerPrivateLinkage:
   case Function::LinkOnceAnyLinkage:
@@ -169,19 +163,14 @@
   case Function::WeakAnyLinkage:
   case Function::WeakODRLinkage:
     // Function is weak
-    O << "\t.weak\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
+    O << "\t.weak\t" << *CurrentFnSym << '\n';
     break;
   }
   
   printVisibility(CurrentFnSym, F->getVisibility());
   
-  O << "\t.type\t";
-  CurrentFnSym->print(O, MAI);
-  O << ", #function\n";
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << "\t.type\t" << *CurrentFnSym << ", #function\n";
+  O << *CurrentFnSym << ":\n";
 }
 
 
@@ -205,10 +194,10 @@
     O << (int)MO.getImm();
     break;
   case MachineOperand::MO_MachineBasicBlock:
-    GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MO.getMBB()->getNumber());
     return;
   case MachineOperand::MO_GlobalAddress:
-    GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+    O << *GetGlobalValueSymbol(MO.getGlobal());
     break;
   case MachineOperand::MO_ExternalSymbol:
     O << MO.getSymbolName();
@@ -314,14 +303,10 @@
       if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
 
       if (GVar->hasLocalLinkage()) {
-        O << "\t.local ";
-        GVarSym->print(O, MAI);
-        O << '\n';
+        O << "\t.local " << *GVarSym << '\n';
       }
 
-      O << MAI->getCOMMDirective();
-      GVarSym->print(O, MAI);
-      O << ',' << Size;
+      O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
       if (MAI->getCOMMDirectiveTakesAlignment())
         O << ',' << (1 << Align);
 
@@ -337,18 +322,14 @@
    case GlobalValue::WeakAnyLinkage: // FIXME: Verify correct for weak.
    case GlobalValue::WeakODRLinkage: // FIXME: Verify correct for weak.
     // Nonnull linkonce -> weak
-    O << "\t.weak ";
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << "\t.weak " << *GVarSym << '\n';
     break;
    case GlobalValue::AppendingLinkage:
     // FIXME: appending linkage variables should go into a section of
     // their name or something.  For now, just emit them as external.
    case GlobalValue::ExternalLinkage:
     // If external or appending, declare as a global symbol
-    O << MAI->getGlobalDirective();
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << MAI->getGlobalDirective() << *GVarSym << '\n';
     // FALL THROUGH
    case GlobalValue::PrivateLinkage:
    case GlobalValue::LinkerPrivateLinkage:
@@ -367,16 +348,11 @@
   EmitAlignment(Align, GVar);
 
   if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.type ";
-    GVarSym->print(O, MAI);
-    O << ",#object\n";
-    O << "\t.size ";
-    GVarSym->print(O, MAI);
-    O << ',' << Size << '\n';
+    O << "\t.type " << *GVarSym << ",#object\n";
+    O << "\t.size " << *GVarSym << ',' << Size << '\n';
   }
 
-  GVarSym->print(O, MAI);
-  O  << ":\n";
+  O << *GVarSym << ":\n";
   EmitGlobalConstant(C);
 }
 
diff --git a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
index b546358..53d2955 100644
--- a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
+++ b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
@@ -97,27 +97,20 @@
   case Function::LinkerPrivateLinkage:
     break;
   case Function::ExternalLinkage:
-    O << "\t.globl\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
+    O << "\t.globl\t" << *CurrentFnSym << '\n';
     break;
   case Function::LinkOnceAnyLinkage:
   case Function::LinkOnceODRLinkage:
   case Function::WeakAnyLinkage:
   case Function::WeakODRLinkage:
-    O << "\t.weak\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
+    O << "\t.weak\t" << *CurrentFnSym << '\n';
     break;
   }
 
   printVisibility(CurrentFnSym, F->getVisibility());
 
-  O << "\t.type\t";
-  CurrentFnSym->print(O, MAI);
-  O << ",@function\n";
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << "\t.type\t" << *CurrentFnSym << ",@function\n";
+  O << *CurrentFnSym << ":\n";
 }
 
 bool SystemZAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
@@ -142,13 +135,8 @@
       printMachineInstruction(II);
   }
 
-  if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.size\t";
-    CurrentFnSym->print(O, MAI);
-    O << ", .-";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
-  }
+  if (MAI->hasDotTypeDotSizeDirective())
+    O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';
 
   // Print out jump tables referenced by the function.
   EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
@@ -179,11 +167,11 @@
     O << MO.getImm();
     return;
   case MachineOperand::MO_MachineBasicBlock:
-    GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MO.getMBB()->getNumber());
     return;
   case MachineOperand::MO_GlobalAddress: {
     const GlobalValue *GV = MO.getGlobal();
-    GetGlobalValueSymbol(GV)->print(O, MAI);
+    O << *GetGlobalValueSymbol(GV);
 
     // Assemble calls via PLT for externally visible symbols if PIC.
     if (TM.getRelocationModel() == Reloc::PIC_ &&
@@ -234,7 +222,7 @@
     O << MO.getImm();
     return;
   case MachineOperand::MO_MachineBasicBlock:
-    GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MO.getMBB()->getNumber());
     return;
   case MachineOperand::MO_JumpTableIndex:
     O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << '_'
@@ -248,10 +236,10 @@
     printOffset(MO.getOffset());
     break;
   case MachineOperand::MO_GlobalAddress:
-    GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+    O << *GetGlobalValueSymbol(MO.getGlobal());
     break;
   case MachineOperand::MO_ExternalSymbol: {
-    GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
+    O << *GetExternalSymbolSymbol(MO.getSymbolName());
     break;
   }
   default:
@@ -323,9 +311,7 @@
 
   printVisibility(GVarSym, GVar->getVisibility());
 
-  O << "\t.type\t";
-  GVarSym->print(O, MAI);
-  O << ",@object\n";
+  O << "\t.type\t" << *GVarSym << ",@object\n";
 
   OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang,
                                                                   TM));
@@ -336,15 +322,10 @@
 
     if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
 
-    if (GVar->hasLocalLinkage()) {
-      O << "\t.local\t";
-      GVarSym->print(O, MAI);
-      O << '\n';
-    }
+    if (GVar->hasLocalLinkage())
+      O << "\t.local\t" << *GVarSym << '\n';
 
-    O << MAI->getCOMMDirective();
-    GVarSym->print(O, MAI);
-    O << ',' << Size;
+    O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
     if (MAI->getCOMMDirectiveTakesAlignment())
       O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
 
@@ -362,9 +343,7 @@
   case GlobalValue::LinkOnceODRLinkage:
   case GlobalValue::WeakAnyLinkage:
   case GlobalValue::WeakODRLinkage:
-    O << "\t.weak\t";
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << "\t.weak\t" << *GVarSym << '\n';
     break;
   case GlobalValue::DLLExportLinkage:
   case GlobalValue::AppendingLinkage:
@@ -372,9 +351,7 @@
     // their name or something.  For now, just emit them as external.
   case GlobalValue::ExternalLinkage:
     // If external or appending, declare as a global symbol
-    O << "\t.globl ";
-    GVarSym->print(O, MAI);
-    O << '\n';
+    O << "\t.globl " << *GVarSym << '\n';
     // FALL THROUGH
   case GlobalValue::PrivateLinkage:
   case GlobalValue::LinkerPrivateLinkage:
@@ -386,18 +363,14 @@
 
   // Use 16-bit alignment by default to simplify bunch of stuff
   EmitAlignment(Align, GVar, 1);
-  GVarSym->print(O, MAI);
-  O << ":";
+  O << *GVarSym << ":";
   if (VerboseAsm) {
     O << "\t\t\t\t" << MAI->getCommentString() << ' ';
     WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
   }
   O << '\n';
-  if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.size\t";
-    GVarSym->print(O, MAI);
-    O << ", " << Size << '\n';
-  }
+  if (MAI->hasDotTypeDotSizeDirective())
+    O << "\t.size\t" << *GVarSym << ", " << Size << '\n';
 
   EmitGlobalConstant(C);
 }
diff --git a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
index dbb7279..977d321 100644
--- a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
@@ -60,7 +60,7 @@
 void X86AsmPrinter::PrintPICBaseSymbol() const {
   // FIXME: Gross const cast hack.
   X86AsmPrinter *AP = const_cast<X86AsmPrinter*>(this);
-  X86MCInstLower(OutContext, 0, *AP).GetPICBaseSymbol()->print(O, MAI);
+  O << *X86MCInstLower(OutContext, 0, *AP).GetPICBaseSymbol();
 }
 
 void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
@@ -84,9 +84,7 @@
     break;
   case Function::DLLExportLinkage:
   case Function::ExternalLinkage:
-    O << "\t.globl\t";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
+    O << "\t.globl\t" << *CurrentFnSym << '\n';
     break;
   case Function::LinkerPrivateLinkage:
   case Function::LinkOnceAnyLinkage:
@@ -94,20 +92,13 @@
   case Function::WeakAnyLinkage:
   case Function::WeakODRLinkage:
     if (Subtarget->isTargetDarwin()) {
-      O << "\t.globl\t";
-      CurrentFnSym->print(O, MAI);
-      O << '\n';
-      O << MAI->getWeakDefDirective();
-      CurrentFnSym->print(O, MAI);
-      O << '\n';
+      O << "\t.globl\t" << *CurrentFnSym << '\n';
+      O << MAI->getWeakDefDirective() << *CurrentFnSym << '\n';
     } else if (Subtarget->isTargetCygMing()) {
-      O << "\t.globl\t";
-      CurrentFnSym->print(O, MAI);
+      O << "\t.globl\t" << *CurrentFnSym;
       O << "\n\t.linkonce discard\n";
     } else {
-      O << "\t.weak\t";
-      CurrentFnSym->print(O, MAI);
-      O << '\n';
+      O << "\t.weak\t" << *CurrentFnSym << '\n';
     }
     break;
   }
@@ -115,20 +106,16 @@
   printVisibility(CurrentFnSym, F->getVisibility());
 
   if (Subtarget->isTargetELF()) {
-    O << "\t.type\t";
-    CurrentFnSym->print(O, MAI);
-    O << ",@function\n";
+    O << "\t.type\t" << *CurrentFnSym << ",@function\n";
   } else if (Subtarget->isTargetCygMing()) {
-    O << "\t.def\t ";
-    CurrentFnSym->print(O, MAI);
+    O << "\t.def\t " << *CurrentFnSym;
     O << ";\t.scl\t" <<
       (F->hasInternalLinkage() ? COFF::C_STAT : COFF::C_EXT)
       << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT)
       << ";\t.endef\n";
   }
 
-  CurrentFnSym->print(O, MAI);
-  O << ':';
+  O << *CurrentFnSym << ':';
   if (VerboseAsm) {
     O.PadToColumn(MAI->getCommentColumn());
     O << MAI->getCommentString() << ' ';
@@ -138,11 +125,8 @@
 
   // Add some workaround for linkonce linkage on Cygwin\MinGW
   if (Subtarget->isTargetCygMing() &&
-      (F->hasLinkOnceLinkage() || F->hasWeakLinkage())) {
-    O << "Lllvm$workaround$fake$stub$";
-    CurrentFnSym->print(O, MAI);
-    O << ":\n";
-  }
+      (F->hasLinkOnceLinkage() || F->hasWeakLinkage()))
+    O << "Lllvm$workaround$fake$stub$" << *CurrentFnSym << ":\n";
 }
 
 /// runOnMachineFunction - This uses the printMachineInstruction()
@@ -199,13 +183,8 @@
     O << "\tnop\n";
   }
 
-  if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.size\t";
-    CurrentFnSym->print(O, MAI);
-    O << ", .-";
-    CurrentFnSym->print(O, MAI);
-    O << '\n';
-  }
+  if (MAI->hasDotTypeDotSizeDirective())
+    O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';
 
   // Emit post-function debug information.
   if (MAI->doesSupportDebugInformation() || MAI->doesSupportExceptionHandling())
@@ -282,12 +261,9 @@
     // If the name begins with a dollar-sign, enclose it in parens.  We do this
     // to avoid having it look like an integer immediate to the assembler.
     if (GVSym->getName()[0] != '$')
-      GVSym->print(O, MAI);
-    else {
-      O << '(';
-      GVSym->print(O, MAI);
-      O << ')';
-    }
+      O << *GVSym;
+    else
+      O << '(' << *GVSym << ')';
     printOffset(MO.getOffset());
     break;
   }
@@ -313,12 +289,9 @@
     // If the name begins with a dollar-sign, enclose it in parens.  We do this
     // to avoid having it look like an integer immediate to the assembler.
     if (SymToPrint->getName()[0] != '$') 
-      SymToPrint->print(O, MAI);
-    else {
-      O << '(';
-      SymToPrint->print(O, MAI);
-      O << '(';
-    }
+      O << *SymToPrint;
+    else
+      O << '(' << *SymToPrint << '(';
     break;
   }
   }
@@ -367,7 +340,7 @@
     O << MO.getImm();
     return;
   case MachineOperand::MO_MachineBasicBlock:
-    GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MO.getMBB()->getNumber());
     return;
   case MachineOperand::MO_GlobalAddress:
   case MachineOperand::MO_ExternalSymbol:
@@ -492,7 +465,7 @@
   O << MAI->getSetDirective() << ' ' << MAI->getPrivateGlobalPrefix()
     << getFunctionNumber() << '_' << uid << "_set_" << MBB->getNumber() << ',';
   
-  GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+  O << GetMBBSymbol(MBB->getNumber());
   
   if (Subtarget->isPICStyleRIPRel())
     O << '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
@@ -523,11 +496,10 @@
   if (Subtarget->isPICStyleRIPRel() || Subtarget->isPICStyleStubPIC()) {
     O << MAI->getPrivateGlobalPrefix() << getFunctionNumber()
       << '_' << uid << "_set_" << MBB->getNumber();
-  } else if (Subtarget->isPICStyleGOT()) {
-    GetMBBSymbol(MBB->getNumber())->print(O, MAI);
-    O << "@GOTOFF";
-  } else
-    GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+  } else if (Subtarget->isPICStyleGOT())
+    O << *GetMBBSymbol(MBB->getNumber()) << "@GOTOFF";
+  else
+    O << *GetMBBSymbol(MBB->getNumber());
 }
 
 bool X86AsmPrinter::printAsmMRegister(const MachineOperand &MO, char Mode) {
@@ -700,12 +672,8 @@
 
   printVisibility(GVSym, GVar->getVisibility());
 
-  if (Subtarget->isTargetELF()) {
-    O << "\t.type\t";
-    GVSym->print(O, MAI);
-    O << ",@object\n";
-  }
-
+  if (Subtarget->isTargetELF())
+    O << "\t.type\t" << *GVSym << ",@object\n";
   
   SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GVar, TM);
   const MCSection *TheSection =
@@ -718,11 +686,8 @@
       !TheSection->getKind().isMergeableCString()) {
     if (GVar->hasExternalLinkage()) {
       if (const char *Directive = MAI->getZeroFillDirective()) {
-        O << "\t.globl ";
-        GVSym->print(O, MAI);
-        O << '\n';
-        O << Directive << "__DATA, __common, ";
-        GVSym->print(O, MAI);
+        O << "\t.globl " << *GVSym << '\n';
+        O << Directive << "__DATA, __common, " << *GVSym;
         O << ", " << Size << ", " << Align << '\n';
         return;
       }
@@ -734,20 +699,14 @@
 
       if (MAI->getLCOMMDirective() != NULL) {
         if (GVar->hasLocalLinkage()) {
-          O << MAI->getLCOMMDirective();
-          GVSym->print(O, MAI);
-          O << ',' << Size;
+          O << MAI->getLCOMMDirective() << *GVSym << ',' << Size;
           if (Subtarget->isTargetDarwin())
             O << ',' << Align;
         } else if (Subtarget->isTargetDarwin() && !GVar->hasCommonLinkage()) {
-          O << "\t.globl ";
-          GVSym->print(O, MAI);
-          O << '\n' << MAI->getWeakDefDirective();
-          GVSym->print(O, MAI);
-          O << '\n';
+          O << "\t.globl " << *GVSym << '\n';
+          O << MAI->getWeakDefDirective() << *GVSym << '\n';
           EmitAlignment(Align, GVar);
-          GVSym->print(O, MAI);
-          O << ":";
+          O << *GVSym << ":";
           if (VerboseAsm) {
             O.PadToColumn(MAI->getCommentColumn());
             O << MAI->getCommentString() << ' ';
@@ -757,23 +716,16 @@
           EmitGlobalConstant(C);
           return;
         } else {
-          O << MAI->getCOMMDirective();
-          GVSym->print(O, MAI);
-          O << ',' << Size;
+          O << MAI->getCOMMDirective() << *GVSym << ',' << Size;
           if (MAI->getCOMMDirectiveTakesAlignment())
             O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
         }
       } else {
         if (!Subtarget->isTargetCygMing()) {
-          if (GVar->hasLocalLinkage()) {
-            O << "\t.local\t";
-            GVSym->print(O, MAI);
-            O << '\n';
-          }
+          if (GVar->hasLocalLinkage())
+            O << "\t.local\t" << *GVSym << '\n';
         }
-        O << MAI->getCOMMDirective();
-        GVSym->print(O, MAI);
-        O << ',' << Size;
+        O << MAI->getCOMMDirective() << *GVSym << ',' << Size;
         if (MAI->getCOMMDirectiveTakesAlignment())
           O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
       }
@@ -795,20 +747,13 @@
   case GlobalValue::WeakODRLinkage:
   case GlobalValue::LinkerPrivateLinkage:
     if (Subtarget->isTargetDarwin()) {
-      O << "\t.globl ";
-      GVSym->print(O, MAI);
-      O << '\n' << MAI->getWeakDefDirective();
-      GVSym->print(O, MAI);
-      O << '\n';
+      O << "\t.globl " << *GVSym << '\n';
+      O << MAI->getWeakDefDirective() << *GVSym << '\n';
     } else if (Subtarget->isTargetCygMing()) {
-      O << "\t.globl\t";
-      GVSym->print(O, MAI);
+      O << "\t.globl\t" << *GVSym;
       O << "\n\t.linkonce same_size\n";
-    } else {
-      O << "\t.weak\t";
-      GVSym->print(O, MAI);
-      O << '\n';
-    }
+    } else
+      O << "\t.weak\t" << *GVSym << '\n';
     break;
   case GlobalValue::DLLExportLinkage:
   case GlobalValue::AppendingLinkage:
@@ -816,9 +761,7 @@
     // their name or something.  For now, just emit them as external.
   case GlobalValue::ExternalLinkage:
     // If external or appending, declare as a global symbol
-    O << "\t.globl ";
-    GVSym->print(O, MAI);
-    O << '\n';
+    O << "\t.globl " << *GVSym << '\n';
     // FALL THROUGH
   case GlobalValue::PrivateLinkage:
   case GlobalValue::InternalLinkage:
@@ -828,8 +771,7 @@
   }
 
   EmitAlignment(Align, GVar);
-  GVSym->print(O, MAI);
-  O << ":";
+  O << *GVSym << ":";
   if (VerboseAsm){
     O.PadToColumn(MAI->getCommentColumn());
     O << MAI->getCommentString() << ' ';
@@ -839,11 +781,8 @@
 
   EmitGlobalConstant(C);
 
-  if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.size\t";
-    GVSym->print(O, MAI);
-    O << ", " << Size << '\n';
-  }
+  if (MAI->hasDotTypeDotSizeDirective())
+    O << "\t.size\t" << *GVSym << ", " << Size << '\n';
 }
 
 void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
@@ -869,10 +808,9 @@
       OutStreamer.SwitchSection(TheSection);
 
       for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
-        Stubs[i].first->print(O, MAI);
-        O << ":\n" << "\t.indirect_symbol ";
+        O << *Stubs[i].first << ":\n";
         // Get the MCSymbol without the $stub suffix.
-        Stubs[i].second->print(O, MAI);
+        O << "\t.indirect_symbol " << *Stubs[i].second;
         O << "\n\thlt ; hlt ; hlt ; hlt ; hlt\n";
       }
       O << '\n';
@@ -890,9 +828,7 @@
       OutStreamer.SwitchSection(TheSection);
 
       for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
-        Stubs[i].first->print(O, MAI);
-        O << ":\n\t.indirect_symbol ";
-        Stubs[i].second->print(O, MAI);
+        O << *Stubs[i].first << ":\n\t.indirect_symbol " << *Stubs[i].second;
         O << "\n\t.long\t0\n";
       }
       Stubs.clear();
@@ -904,10 +840,8 @@
       EmitAlignment(2);
 
       for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
-        Stubs[i].first->print(O, MAI);
-        O << ":\n" << MAI->getData32bitsDirective();
-        Stubs[i].second->print(O, MAI);
-        O << '\n';
+        O << *Stubs[i].first << ":\n" << MAI->getData32bitsDirective();
+        O << *Stubs[i].second << '\n';
       }
       Stubs.clear();
     }
@@ -957,17 +891,11 @@
         OutStreamer.SwitchSection(TLOFCOFF.getCOFFSection(".section .drectve",
                                                           true,
                                                    SectionKind::getMetadata()));
-        for (unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i) {
-          O << "\t.ascii \" -export:";
-          DLLExportedGlobals[i]->print(O, MAI);
-          O << ",data\"\n";
-        }
+        for (unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i)
+          O << "\t.ascii \" -export:" << *DLLExportedGlobals[i] << ",data\"\n";
 
-        for (unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i) {
-          O << "\t.ascii \" -export:";
-          DLLExportedFns[i]->print(O, MAI);
-          O << "\"\n";
-        }
+        for (unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i)
+          O << "\t.ascii \" -export:" << *DLLExportedFns[i] << "\"\n";
       }
     }
   }
diff --git a/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp b/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
index 5ac025b..8ac6fd5 100644
--- a/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
+++ b/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
@@ -94,9 +94,7 @@
 #include "XCoreGenAsmWriter.inc"
 
 void XCoreAsmPrinter::emitGlobalDirective(const MCSymbol *Sym) {
-  O << MAI->getGlobalDirective();
-  Sym->print(O, MAI);
-  O << "\n";
+  O << MAI->getGlobalDirective() << *Sym << "\n";
 }
 
 void XCoreAsmPrinter::emitArrayBound(const MCSymbol *Sym,
@@ -106,18 +104,13 @@
     GV->hasLinkOnceLinkage()) && "Unexpected linkage");
   if (const ArrayType *ATy = dyn_cast<ArrayType>(
     cast<PointerType>(GV->getType())->getElementType())) {
-    O << MAI->getGlobalDirective();
-    Sym->print(O, MAI);
+    O << MAI->getGlobalDirective() << *Sym;
     O << ".globound" << "\n";
-    O << MAI->getSetDirective();
-    Sym->print(O, MAI);
-    O << ".globound" << ","
-      << ATy->getNumElements() << "\n";
+    O << MAI->getSetDirective() << *Sym;
+    O << ".globound" << "," << ATy->getNumElements() << "\n";
     if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) {
       // TODO Use COMDAT groups for LinkOnceLinkage
-      O << MAI->getWeakDefDirective();
-      Sym->print(O, MAI);
-      O << ".globound" << "\n";
+      O << MAI->getWeakDefDirective() << *Sym << ".globound" << "\n";
     }
   }
 }
@@ -137,11 +130,7 @@
   unsigned Align = (unsigned)TD->getPreferredTypeAlignmentShift(C->getType());
   
   // Mark the start of the global
-  O << "\t.cc_top ";
-  GVSym->print(O, MAI);
-  O << ".data,";
-  GVSym->print(O, MAI);
-  O << "\n";
+  O << "\t.cc_top " << *GVSym << ".data," << *GVSym << "\n";
 
   switch (GV->getLinkage()) {
   case GlobalValue::AppendingLinkage:
@@ -154,11 +143,8 @@
     emitArrayBound(GVSym, GV);
     emitGlobalDirective(GVSym);
     // TODO Use COMDAT groups for LinkOnceLinkage
-    if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) {
-      O << MAI->getWeakDefDirective();
-      GVSym->print(O, MAI);
-      O << "\n";
-    }
+    if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage())
+      O << MAI->getWeakDefDirective() << *GVSym << "\n";
     // FALL THROUGH
   case GlobalValue::InternalLinkage:
   case GlobalValue::PrivateLinkage:
@@ -181,15 +167,10 @@
     Size *= MaxThreads;
   }
   if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.type ";
-    GVSym->print(O, MAI);
-    O << ",@object\n";
-    O << "\t.size ";
-    GVSym->print(O, MAI);
-    O << "," << Size << "\n";
+    O << "\t.type " << *GVSym << ",@object\n";
+    O << "\t.size " << *GVSym << "," << Size << "\n";
   }
-  GVSym->print(O, MAI);
-  O << ":\n";
+  O << *GVSym << ":\n";
   
   EmitGlobalConstant(C);
   if (GV->isThreadLocal()) {
@@ -204,9 +185,7 @@
   }
   
   // Mark the end of the global
-  O << "\t.cc_bottom ";
-  GVSym->print(O, MAI);
-  O << ".data\n";
+  O << "\t.cc_bottom " << *GVSym << ".data\n";
 }
 
 /// Emit the directives on the start of functions
@@ -217,11 +196,7 @@
   OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
   
   // Mark the start of the function
-  O << "\t.cc_top ";
-  CurrentFnSym->print(O, MAI);
-  O << ".function,";
-  CurrentFnSym->print(O, MAI);
-  O << "\n";
+  O << "\t.cc_top " << *CurrentFnSym << ".function," << *CurrentFnSym << "\n";
 
   switch (F->getLinkage()) {
   default: llvm_unreachable("Unknown linkage type!");
@@ -237,31 +212,22 @@
   case Function::WeakAnyLinkage:
   case Function::WeakODRLinkage:
     // TODO Use COMDAT groups for LinkOnceLinkage
-    O << MAI->getGlobalDirective();
-    CurrentFnSym->print(O, MAI);
-    O << "\n";
-    O << MAI->getWeakDefDirective();
-    CurrentFnSym->print(O, MAI);
-    O << "\n";
+    O << MAI->getGlobalDirective() << *CurrentFnSym << "\n";
+    O << MAI->getWeakDefDirective() << *CurrentFnSym << "\n";
     break;
   }
   // (1 << 1) byte aligned
   EmitAlignment(MF.getAlignment(), F, 1);
-  if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.type ";
-    CurrentFnSym->print(O, MAI);
-    O << ",@function\n";
-  }
-  CurrentFnSym->print(O, MAI);
-  O  << ":\n";
+  if (MAI->hasDotTypeDotSizeDirective())
+    O << "\t.type " << *CurrentFnSym << ",@function\n";
+
+  O << *CurrentFnSym << ":\n";
 }
 
 /// Emit the directives on the end of functions
 void XCoreAsmPrinter::emitFunctionEnd(MachineFunction &MF) {
   // Mark the end of the function
-  O << "\t.cc_bottom ";
-  CurrentFnSym->print(O, MAI);
-  O << ".function\n";
+  O << "\t.cc_bottom " << *CurrentFnSym << ".function\n";
 }
 
 /// runOnMachineFunction - This uses the printMachineInstruction()
@@ -336,10 +302,10 @@
     O << MO.getImm();
     break;
   case MachineOperand::MO_MachineBasicBlock:
-    GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+    O << *GetMBBSymbol(MO.getMBB()->getNumber());
     break;
   case MachineOperand::MO_GlobalAddress:
-    GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+    O << *GetGlobalValueSymbol(MO.getGlobal());
     break;
   case MachineOperand::MO_ExternalSymbol:
     O << MO.getSymbolName();
@@ -352,7 +318,7 @@
     O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
       << '_' << MO.getIndex();
   case MachineOperand::MO_BlockAddress:
-    GetBlockAddressSymbol(MO.getBlockAddress())->print(O, MAI);
+    O << *GetBlockAddressSymbol(MO.getBlockAddress());
     break;
   default:
     llvm_unreachable("not implemented");