[llvm-commits] [llvm] r93695 - in /llvm/trunk: include/llvm/MC/ lib/CodeGen/AsmPrinter/ lib/MC/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPrinter/ lib/Target/Blackfin/AsmPrinter/ lib/Target/CellSPU/AsmPrinter/ lib/Target/MSP430/AsmPrinter/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/AsmPrinter/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/AsmPrinter/ lib/Target/SystemZ/AsmPrinter/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/AsmPrinter/

Chris Lattner sabre at nondot.org
Sun Jan 17 13:43:44 PST 2010


Author: lattner
Date: Sun Jan 17 15:43:43 2010
New Revision: 93695

URL: http://llvm.org/viewvc/llvm-project?rev=93695&view=rev
Log:
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.


Modified:
    llvm/trunk/include/llvm/MC/MCSymbol.h
    llvm/trunk/include/llvm/MC/MCValue.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
    llvm/trunk/lib/MC/MCAsmStreamer.cpp
    llvm/trunk/lib/MC/MCExpr.cpp
    llvm/trunk/lib/MC/MCSymbol.cpp
    llvm/trunk/lib/MC/MCValue.cpp
    llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
    llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
    llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
    llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
    llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
    llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
    llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
    llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
    llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
    llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
    llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
    llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp

Modified: llvm/trunk/include/llvm/MC/MCSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCSymbol.h (original)
+++ llvm/trunk/include/llvm/MC/MCSymbol.h Sun Jan 17 15:43:43 2010
@@ -19,7 +19,6 @@
 #include "llvm/System/DataTypes.h"
 
 namespace llvm {
-  class MCAsmInfo;
   class MCExpr;
   class MCSection;
   class MCContext;
@@ -133,12 +132,16 @@
     /// @}
 
     /// print - Print the value to the stream \arg OS.
-    void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
+    void print(raw_ostream &OS) const;
 
     /// dump - Print the value to stderr.
     void dump() const;
   };
 
+  inline raw_ostream &operator<<(raw_ostream &OS, const MCSymbol &Sym) {
+    Sym.print(OS);
+    return OS;
+  }
 } // end namespace llvm
 
 #endif

Modified: llvm/trunk/include/llvm/MC/MCValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCValue.h?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCValue.h (original)
+++ llvm/trunk/include/llvm/MC/MCValue.h Sun Jan 17 15:43:43 2010
@@ -20,6 +20,7 @@
 
 namespace llvm {
 class MCSymbol;
+class MCAsmInfo;
 class raw_ostream;
 
 /// MCValue - This represents an "assembler immediate".  In its most general

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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';
   }
 }
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Sun Jan 17 15:43:43 2010
@@ -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";
     }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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();
 }
 

Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Sun Jan 17 15:43:43 2010
@@ -101,8 +101,7 @@
   assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
   assert(CurSection && "Cannot emit before setting section!");
 
-  Symbol->print(OS, &MAI);
-  OS << ":\n";
+  OS << *Symbol << ":\n";
   Symbol->setSection(*CurSection);
 }
 
@@ -119,8 +118,7 @@
   assert((Symbol->isUndefined() || Symbol->isAbsolute()) &&
          "Cannot define a symbol twice!");
 
-  Symbol->print(OS, &MAI);
-  OS << " = ";
+  OS << *Symbol << " = ";
   Value->print(OS, &MAI);
   OS << '\n';
 
@@ -146,22 +144,16 @@
   case WeakReference:  OS << ".weak_reference";  break;
   }
 
-  OS << ' ';
-  Symbol->print(OS, &MAI);
-  OS << '\n';
+  OS << ' ' << *Symbol << '\n';
 }
 
 void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
-  OS << ".desc" << ' ';
-  Symbol->print(OS, &MAI);
-  OS << ',' << DescValue << '\n';
+  OS << ".desc" << ' ' << *Symbol << ',' << DescValue << '\n';
 }
 
 void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
                                      unsigned ByteAlignment) {
-  OS << ".comm ";
-  Symbol->print(OS, &MAI);
-  OS << ',' << Size;
+  OS << ".comm " << *Symbol << ',' << Size;
   if (ByteAlignment != 0)
     OS << ',' << Log2_32(ByteAlignment);
   OS << '\n';
@@ -177,9 +169,7 @@
   OS << MOSection->getSegmentName() << "," << MOSection->getSectionName();
   
   if (Symbol != NULL) {
-    OS << ',';
-    Symbol->print(OS, &MAI);
-    OS << ',' << Size;
+    OS << ',' << *Symbol << ',' << Size;
     if (ByteAlignment != 0)
       OS << ',' << Log2_32(ByteAlignment);
   }

Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Sun Jan 17 15:43:43 2010
@@ -26,13 +26,10 @@
     
     // Parenthesize names that start with $ so that they don't look like
     // absolute names.
-    if (Sym.getName()[0] == '$') {
-      OS << '(';
-      Sym.print(OS, MAI);
-      OS << ')';
-    } else {
-      Sym.print(OS, MAI);
-    }
+    if (Sym.getName()[0] == '$')
+      OS << '(' << Sym << ')';
+    else
+      OS << Sym;
     return;
   }
 

Modified: llvm/trunk/lib/MC/MCSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSymbol.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCSymbol.cpp (original)
+++ llvm/trunk/lib/MC/MCSymbol.cpp Sun Jan 17 15:43:43 2010
@@ -8,7 +8,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/MC/MCSymbol.h"
-#include "llvm/MC/MCAsmInfo.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
@@ -39,7 +38,7 @@
   return false;
 }
 
-void MCSymbol::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
+void MCSymbol::print(raw_ostream &OS) const {
   // The name for this MCSymbol is required to be a valid target name.  However,
   // some targets support quoting names with funny characters.  If the name
   // contains a funny character, then print it quoted.
@@ -52,5 +51,5 @@
 }
 
 void MCSymbol::dump() const {
-  print(dbgs(), 0);
+  print(dbgs());
 }

Modified: llvm/trunk/lib/MC/MCValue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCValue.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCValue.cpp (original)
+++ llvm/trunk/lib/MC/MCValue.cpp Sun Jan 17 15:43:43 2010
@@ -19,12 +19,10 @@
     return;
   }
 
-  getSymA()->print(OS, MAI);
+  OS << *getSymA();
 
-  if (getSymB()) {
-    OS << " - "; 
-    getSymB()->print(OS, MAI);
-  }
+  if (getSymB())
+    OS << " - " << *getSymB();
 
   if (getConstant())
     OS << " + " << getConstant();

Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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

Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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';

Modified: llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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() << "_"

Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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";
 

Modified: llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -106,9 +106,7 @@
 
   printVisibility(GVarSym, GVar->getVisibility());
 
-  O << "\t.type\t";
-  GVarSym->print(O, MAI);
-  O << ", at object\n";
+  O << "\t.type\t" << *GVarSym << ", at 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 << ", at function\n";
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << "\t.type\t" << *CurrentFnSym << ", at 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 << ')';

Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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';
-      }
-
-      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 << ',' << (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 << ", at object\n";
-    O << "\t.size ";
-    GVarSym->print(O, MAI);
-    O << ',' << Size << '\n';
+    O << "\t.type " << *GVarSym << ", at object\n";
+    O << "\t.size " << *GVarSym << ',' << Size << '\n';
   }
 
-  GVarSym->print(O, MAI);
-  O << ":\n";
+  O << *GVarSym << ":\n";
   EmitGlobalConstant(C);
 }
 

Modified: llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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";
     }
 }
 

Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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. at tocbase\n";
+    O << *CurrentFnSym << ":\n";
+    O << "\t.quad .L." << *CurrentFnSym << ",.TOC. at 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';
     }
   }
 

Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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);
 }
 

Modified: llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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 << ", at function\n";
-  CurrentFnSym->print(O, MAI);
-  O << ":\n";
+  O << "\t.type\t" << *CurrentFnSym << ", at 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 << ", at object\n";
+  O << "\t.type\t" << *GVarSym << ", at 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);
 }

Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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 << ", at function\n";
+    O << "\t.type\t" << *CurrentFnSym << ", at 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 << ", at object\n";
-  }
-
+  if (Subtarget->isTargetELF())
+    O << "\t.type\t" << *GVSym << ", at 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";
       }
     }
   }

Modified: llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp?rev=93695&r1=93694&r2=93695&view=diff

==============================================================================
--- llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp Sun Jan 17 15:43:43 2010
@@ -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 << ", at object\n";
-    O << "\t.size ";
-    GVSym->print(O, MAI);
-    O << "," << Size << "\n";
+    O << "\t.type " << *GVSym << ", at 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 << ", at function\n";
-  }
-  CurrentFnSym->print(O, MAI);
-  O  << ":\n";
+  if (MAI->hasDotTypeDotSizeDirective())
+    O << "\t.type " << *CurrentFnSym << ", at 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");





More information about the llvm-commits mailing list