Momentous day: remove the "O" member from AsmPrinter. Now all
authorChris Lattner <sabre@nondot.org>
Sun, 4 Apr 2010 08:18:47 +0000 (08:18 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 4 Apr 2010 08:18:47 +0000 (08:18 +0000)
"asm printering" happens through MCStreamer.  This also
Streamerizes PIC16 debug info, which escaped my attention.

This removes a leak from LLVMTargetMachine of the 'legacy'
output stream.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100327 91177308-0d34-0410-b5e6-96231b3b80d8

21 files changed:
include/llvm/CodeGen/AsmPrinter.h
include/llvm/Target/TargetRegistry.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/LLVMTargetMachine.cpp
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
lib/Target/MBlaze/AsmPrinter/MBlazeAsmPrinter.cpp
lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h
lib/Target/PIC16/PIC16DebugInfo.cpp
lib/Target/PIC16/PIC16DebugInfo.h
lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86AsmPrinter.h
lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp

index 415871ce27e4b6c45d5beb9a4f6cfdcd40ec50b0..080dc16e211689db2384b50ce10b7f527223e349 100644 (file)
@@ -54,7 +54,6 @@ namespace llvm {
   class TargetLoweringObjectFile;
   class Twine;
   class Type;
-  class formatted_raw_ostream;
 
   /// AsmPrinter - This class is intended to be used as a driving class for all
   /// asm writers.
@@ -80,10 +79,6 @@ namespace llvm {
 
   public:
 
-    /// Output stream on which we're printing assembly code.
-    ///
-    formatted_raw_ostream &O;
-
     /// Target machine description.
     ///
     TargetMachine &TM;
@@ -138,8 +133,7 @@ namespace llvm {
     mutable unsigned SetCounter;
     
   protected:
-    explicit AsmPrinter(formatted_raw_ostream &o, TargetMachine &TM,
-                        MCStreamer &Streamer);
+    explicit AsmPrinter(TargetMachine &TM, MCStreamer &Streamer);
     
   public:
     virtual ~AsmPrinter();
index 272205ab12eccc49bf7212672ccb95201d9bbae3..36bbe000025c8390d5e127ba61a9e05c57e71cef 100644 (file)
@@ -38,7 +38,6 @@ namespace llvm {
   class TargetAsmLexer;
   class TargetAsmParser;
   class TargetMachine;
-  class formatted_raw_ostream;
   class raw_ostream;
 
   /// Target - Wrapper for Target specific information.
@@ -60,8 +59,7 @@ namespace llvm {
     typedef TargetMachine *(*TargetMachineCtorTy)(const Target &T,
                                                   const std::string &TT,
                                                   const std::string &Features);
-    typedef AsmPrinter *(*AsmPrinterCtorTy)(formatted_raw_ostream &OS,
-                                            TargetMachine &TM,
+    typedef AsmPrinter *(*AsmPrinterCtorTy)(TargetMachine &TM,
                                             MCStreamer &Streamer);
     typedef TargetAsmBackend *(*AsmBackendCtorTy)(const Target &T,
                                                   const std::string &TT);
@@ -233,11 +231,10 @@ namespace llvm {
 
     /// createAsmPrinter - Create a target specific assembly printer pass.  This
     /// takes ownership of the MCStreamer object.
-    AsmPrinter *createAsmPrinter(formatted_raw_ostream &OS, TargetMachine &TM,
-                                 MCStreamer &Streamer) const {
+    AsmPrinter *createAsmPrinter(TargetMachine &TM, MCStreamer &Streamer) const{
       if (!AsmPrinterCtorFn)
         return 0;
-      return AsmPrinterCtorFn(OS, TM, Streamer);
+      return AsmPrinterCtorFn(TM, Streamer);
     }
 
     MCDisassembler *createMCDisassembler() const {
@@ -644,9 +641,8 @@ namespace llvm {
     }
 
   private:
-    static AsmPrinter *Allocator(formatted_raw_ostream &OS, TargetMachine &TM,
-                                 MCStreamer &Streamer) {
-      return new AsmPrinterImpl(OS, TM, Streamer);
+    static AsmPrinter *Allocator(TargetMachine &TM, MCStreamer &Streamer) {
+      return new AsmPrinterImpl(TM, Streamer);
     }
   };
 
index 0ad1365a53339d3787f8d6fd15c7ff65ab28f5ac..34dc9cd1f4ea8d40ddb4dc424b8428370613fea3 100644 (file)
@@ -48,7 +48,6 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Format.h"
-#include "llvm/Support/FormattedStream.h"
 #include <cerrno>
 using namespace llvm;
 
@@ -56,9 +55,8 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed");
 
 char AsmPrinter::ID = 0;
 
-AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm,
-                       MCStreamer &Streamer)
-  : MachineFunctionPass(&ID), O(o),
+AsmPrinter::AsmPrinter(TargetMachine &tm, MCStreamer &Streamer)
+  : MachineFunctionPass(&ID), 
     TM(tm), MAI(tm.getMCAsmInfo()), TRI(tm.getRegisterInfo()),
     OutContext(Streamer.getContext()),
     OutStreamer(Streamer),
index 4b9095494dad0d6b0239b42f936a38da47bcb094..ed57f4cb101f0afd44eb245a14fa82727ff5b73a 100644 (file)
@@ -123,7 +123,6 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
   const MCAsmInfo &MAI = *getMCAsmInfo();
   OwningPtr<MCStreamer> AsmStreamer;
 
-  formatted_raw_ostream *LegacyOutput;
   switch (FileType) {
   default: return true;
   case CGFT_AssemblyFile: {
@@ -133,8 +132,6 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
                                         getTargetData()->isLittleEndian(),
                                         getVerboseAsm(), InstPrinter,
                                         /*codeemitter*/0));
-    // Set the AsmPrinter's "O" to the output file.
-    LegacyOutput = &Out;
     break;
   }
   case CGFT_ObjectFile: {
@@ -146,29 +143,17 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
       return true;
     
     AsmStreamer.reset(createMachOStreamer(*Context, *TAB, Out, MCE));
-    
-    // Any output to the asmprinter's "O" stream is bad and needs to be fixed,
-    // force it to come out stderr.
-    // FIXME: this is horrible and leaks, eventually remove the raw_ostream from
-    // asmprinter.
-    LegacyOutput = new formatted_raw_ostream(errs());
     break;
   }
   case CGFT_Null:
     // The Null output is intended for use for performance analysis and testing,
     // not real users.
     AsmStreamer.reset(createNullStreamer(*Context));
-    // Any output to the asmprinter's "O" stream is bad and needs to be fixed,
-    // force it to come out stderr.
-    // FIXME: this is horrible and leaks, eventually remove the raw_ostream from
-    // asmprinter.
-    LegacyOutput = new formatted_raw_ostream(errs());
     break;
   }
   
   // Create the AsmPrinter, which takes ownership of AsmStreamer if successful.
-  FunctionPass *Printer =
-    getTarget().createAsmPrinter(*LegacyOutput, *this, *AsmStreamer);
+  FunctionPass *Printer = getTarget().createAsmPrinter(*this, *AsmStreamer);
   if (Printer == 0)
     return true;
   
index 78db795fc0785b2c63dec390dea9f866c5fc6188..def4ac18e36b22fe9ff3134ea486c6ada788d946 100644 (file)
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/StringSet.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
-#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/raw_ostream.h"
 #include <cctype>
 using namespace llvm;
 
@@ -74,9 +72,8 @@ namespace {
     const MachineConstantPool *MCP;
 
   public:
-    explicit ARMAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                           MCStreamer &Streamer)
-      : AsmPrinter(O, TM, Streamer), AFI(NULL), MCP(NULL) {
+    explicit ARMAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+      : AsmPrinter(TM, Streamer), AFI(NULL), MCP(NULL) {
       Subtarget = &TM.getSubtarget<ARMSubtarget>();
     }
 
index 21efafd20b54887a8bdf0ba579990d580e9ab481..85d7294ad975ce978844d540e1ab3fabdefa3bc6 100644 (file)
@@ -29,8 +29,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 namespace {
@@ -38,9 +37,8 @@ namespace {
     /// Unique incrementer for label values for referencing Global values.
     ///
 
-    explicit AlphaAsmPrinter(formatted_raw_ostream &o, TargetMachine &tm,
-                             MCStreamer &Streamer)
-      : AsmPrinter(o, tm, Streamer) {}
+    explicit AlphaAsmPrinter(TargetMachine &tm, MCStreamer &Streamer)
+      : AsmPrinter(tm, Streamer) {}
 
     virtual const char *getPassName() const {
       return "Alpha Assembly Printer";
index f25ab3986b17ddebe5b5d80e789ae1944a14443c..d5e77d4c25fe432c4ebb07104141674c5fc5c6bf 100644 (file)
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 namespace {
   class BlackfinAsmPrinter : public AsmPrinter {
   public:
-    BlackfinAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                       MCStreamer &Streamer)
-      : AsmPrinter(O, TM, Streamer) {}
+    BlackfinAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+      : AsmPrinter(TM, Streamer) {}
 
     virtual const char *getPassName() const {
       return "Blackfin Assembly Printer";
index 0e3d6208afb7576caab5facabd8aae32dadd5ba2..0ef36e550d0376037bd16dfecd836fc2be3d874c 100644 (file)
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 namespace {
   class SPUAsmPrinter : public AsmPrinter {
   public:
-    explicit SPUAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                           MCStreamer &Streamer) :
-      AsmPrinter(O, TM, Streamer) {}
+    explicit SPUAsmPrinter(TargetMachine &TM, MCStreamer &Streamer) :
+      AsmPrinter(TM, Streamer) {}
 
     virtual const char *getPassName() const {
       return "STI CBEA SPU Assembly Printer";
index b865592a3148b1098c535331f5e2c1906249bca6..b1df926864e678b4478343b5660444cb6b92dc7b 100644 (file)
@@ -23,7 +23,6 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
 #include "llvm/CodeGen/AsmPrinter.h"
-#include "llvm/CodeGen/DwarfWriter.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
-#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/raw_ostream.h"
 #include <cctype>
 
 using namespace llvm;
@@ -53,9 +48,8 @@ namespace {
   class MBlazeAsmPrinter : public AsmPrinter {
     const MBlazeSubtarget *Subtarget;
   public:
-    explicit MBlazeAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                              MCStreamer &Streamer)
-      : AsmPrinter(O, TM, Streamer) {
+    explicit MBlazeAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+      : AsmPrinter(TM, Streamer) {
       Subtarget = &TM.getSubtarget<MBlazeSubtarget>();
     }
 
index 0fb12a6a0dd5f9f4219e21343e54c190d2d066f7..72aeb1120073e593c331882bb8e9d8e94d8fab02 100644 (file)
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Target/TargetRegistry.h"
-#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 namespace {
   class MSP430AsmPrinter : public AsmPrinter {
   public:
-    MSP430AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                     MCStreamer &Streamer)
-      : AsmPrinter(O, TM, Streamer) {}
+    MSP430AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+      : AsmPrinter(TM, Streamer) {}
 
     virtual const char *getPassName() const {
       return "MSP430 Assembly Printer";
index 02d340b663c42bf2a772a1a226dbad7fa1f7914a..5da669b9d27f280d7e77482bf1dc24395f976aa6 100644 (file)
@@ -19,9 +19,6 @@
 #include "MipsInstrInfo.h"
 #include "MipsTargetMachine.h"
 #include "MipsMachineFunction.h"
-#include "llvm/Constants.h"
-#include "llvm/DerivedTypes.h"
-#include "llvm/Module.h"
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/CodeGen/DwarfWriter.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
-#include "llvm/Support/MathExtras.h"
-#include <cctype>
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 namespace {
   class MipsAsmPrinter : public AsmPrinter {
     const MipsSubtarget *Subtarget;
   public:
-    explicit MipsAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, 
-                            MCStreamer &Streamer)
-      : AsmPrinter(O, TM, Streamer) {
+    explicit MipsAsmPrinter(TargetMachine &TM,  MCStreamer &Streamer)
+      : AsmPrinter(TM, Streamer) {
       Subtarget = &TM.getSubtarget<MipsSubtarget>();
     }
 
index 12372f9f30089f2e3b6a3eb16a16a5b028aeef6d..f388d969b9746e65070334a4e62ea6d347f0c452 100644 (file)
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/ADT/SmallString.h"
 #include <cstring>
 using namespace llvm;
 
 #include "PIC16GenAsmWriter.inc"
 
-PIC16AsmPrinter::PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                                 MCStreamer &Streamer)
-: AsmPrinter(O, TM, Streamer), DbgInfo(O, TM.getMCAsmInfo()) {
+PIC16AsmPrinter::PIC16AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+: AsmPrinter(TM, Streamer), DbgInfo(Streamer, TM.getMCAsmInfo()) {
   PTLI = static_cast<PIC16TargetLowering*>(TM.getTargetLowering());
   PMAI = static_cast<const PIC16MCAsmInfo*>(TM.getMCAsmInfo());
   PTOF = (PIC16TargetObjectFile *)&PTLI->getObjFileLowering();
index 312c54e56fbe61f45096cc4f1a08c95652fd8e57..e27778fbb0700d77b11af151d379f7051fc4398d 100644 (file)
@@ -31,8 +31,7 @@
 namespace llvm {
   class VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter {
   public:
-    explicit PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                             MCStreamer &Streamer);
+    explicit PIC16AsmPrinter(TargetMachine &TM, MCStreamer &Streamer);
   private:
     virtual const char *getPassName() const {
       return "PIC16 Assembly Printer";
index a223540170a78c1b7dd51e75abcc0a3c41de26f9..5d86329e9b9b3a7efff357d02c987f69c48498e5 100644 (file)
 #include "llvm/GlobalVariable.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/MC/MCAsmInfo.h"
+#include "llvm/MC/MCStreamer.h"
 #include "llvm/Support/DebugLoc.h"
-#include "llvm/Support/FormattedStream.h"
 #include "llvm/ADT/SmallString.h"
-
+#include "llvm/ADT/StringExtras.h"
 using namespace llvm;
 
 /// PopulateDebugInfo - Populate the TypeNo, Aux[] and TagName from Ty.
@@ -267,7 +267,8 @@ void PIC16DbgInfo::ChangeDebugLoc(const MachineFunction &MF,
 ///
 void PIC16DbgInfo::SwitchToLine(unsigned Line, bool IsInBeginFunction) {
   if (CurLine == Line) return;
-  if (!IsInBeginFunction)  O << "\n\t.line " << Line << "\n";
+  if (!IsInBeginFunction)
+    OS.EmitRawText("\n\t.line " + Twine(Line));
   CurLine = Line;
 }
 
@@ -286,7 +287,7 @@ void PIC16DbgInfo::EndFunction(const MachineFunction &MF) {
 void PIC16DbgInfo::EndModule(Module &M) {
   if (! EmitDebugDirectives) return;
   EmitVarDebugInfo(M);
-  if (CurFile != "") O << "\n\t.eof";
+  if (CurFile != "") OS.EmitRawText(StringRef("\n\t.eof"));
 }
  
 /// EmitCompositeTypeElements - Emit debug information for members of a 
@@ -410,22 +411,26 @@ void PIC16DbgInfo::EmitFunctEndDI(const Function *F, unsigned Line) {
 ///
 void PIC16DbgInfo::EmitAuxEntry(const std::string VarName, int Aux[], int Num,
                                 std::string TagName) {
-  O << "\n\t.dim " << VarName << ", 1" ;
+  std::string Tmp;
   // TagName is emitted in case of structure/union objects.
-  if (TagName != "")
-    O << ", " << TagName;
+  if (!TagName.empty()) Tmp += ", " + TagName;
+  
   for (int i = 0; i<Num; i++)
-    O << "," << (Aux[i] && 0xff);
+    Tmp += "," + utostr(Aux[i] && 0xff);
+  
+  OS.EmitRawText("\n\t.dim " + Twine(VarName) + ", 1" + Tmp);
 }
 
 /// EmitSymbol - Emit .def for a symbol. Value is offset for the member.
 ///
-void PIC16DbgInfo::EmitSymbol(std::string Name, short Class, unsigned short
-                              Type, unsigned long Value) {
-  O << "\n\t" << ".def "<< Name << ", type = " << Type << ", class = " 
-    << Class;
+void PIC16DbgInfo::EmitSymbol(std::string Name, short Class,
+                              unsigned short Type, unsigned long Value) {
+  std::string Tmp;
   if (Value > 0)
-    O  << ", value = " << Value;
+    Tmp = ", value = " + utostr(Value);
+  
+  OS.EmitRawText("\n\t.def " + Twine(Name) + ", type = " + utostr(Type) +
+                 ", class = " + utostr(Class) + Tmp);
 }
 
 /// EmitVarDebugInfo - Emit debug information for all variables.
@@ -447,14 +452,13 @@ void PIC16DbgInfo::EmitVarDebugInfo(Module &M) {
     PopulateDebugInfo(Ty, TypeNo, HasAux, Aux, TagName);
     // Emit debug info only if type information is availaible.
     if (TypeNo != PIC16Dbg::T_NULL) {
-      O << "\n\t.type " << VarName << ", " << TypeNo;
+      OS.EmitRawText("\t.type " + Twine(VarName) + ", " + Twine(TypeNo));
       short ClassNo = getStorageClass(DIGV);
-      O << "\n\t.class " << VarName << ", " << ClassNo;
-      if (HasAux) 
+      OS.EmitRawText("\t.class " + Twine(VarName) + ", " + Twine(ClassNo));
+      if (HasAux)
         EmitAuxEntry(VarName, Aux, PIC16Dbg::AuxSize, TagName);
     }
   }
-  O << "\n";
 }
 
 /// SwitchToCU - Switch to a new compilation unit.
@@ -470,8 +474,9 @@ void PIC16DbgInfo::SwitchToCU(MDNode *CU) {
   if ( FilePath == CurFile ) return;
 
   // Else, close the current one and start a new.
-  if (CurFile != "") O << "\n\t.eof";
-  O << "\n\t.file\t\"" << FilePath << "\"\n" ;
+  if (CurFile != "")
+    OS.EmitRawText(StringRef("\t.eof"));
+  OS.EmitRawText("\n\t.file\t\"" + Twine(FilePath) + "\"");
   CurFile = FilePath;
   CurLine = 0;
 }
@@ -480,6 +485,6 @@ void PIC16DbgInfo::SwitchToCU(MDNode *CU) {
 ///
 void PIC16DbgInfo::EmitEOF() {
   if (CurFile != "")
-    O << "\n\t.EOF";
+    OS.EmitRawText(StringRef("\t.EOF"));
 }
 
index 54e27c7c33771e146679ce19d90bc6672b91ff89..031dcf092f047ed6e7726af233c9e2c84f85e3ee 100644 (file)
@@ -20,6 +20,8 @@
 namespace llvm {
   class MachineFunction;
   class DebugLoc;
+  class MCStreamer;
+  
   namespace PIC16Dbg {
     enum VarType {
       T_NULL,
@@ -88,10 +90,8 @@ namespace llvm {
     };
   }
 
-  class formatted_raw_ostream;
-
   class PIC16DbgInfo {
-    formatted_raw_ostream &O;
+    MCStreamer &OS;
     const MCAsmInfo *MAI;
     std::string CurFile;
     unsigned CurLine;
@@ -101,8 +101,7 @@ namespace llvm {
     bool EmitDebugDirectives;
 
   public:
-    PIC16DbgInfo(formatted_raw_ostream &o, const MCAsmInfo *T)
-      : O(o), MAI(T) {
+    PIC16DbgInfo(MCStreamer &os, const MCAsmInfo *T) : OS(os), MAI(T) {
       CurFile = "";
       CurLine = 0;
       EmitDebugDirectives = false; 
index e31e490e8d221d33c98c13542f176c85af24472b..b973acd404a62621bda3783d5e0c3e01b663f678 100644 (file)
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/Support/MathExtras.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/SmallString.h"
@@ -60,9 +58,8 @@ namespace {
     const PPCSubtarget &Subtarget;
     uint64_t LabelID;
   public:
-    explicit PPCAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                           MCStreamer &Streamer)
-      : AsmPrinter(O, TM, Streamer),
+    explicit PPCAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+      : AsmPrinter(TM, Streamer),
         Subtarget(TM.getSubtarget<PPCSubtarget>()), LabelID(0) {}
 
     virtual const char *getPassName() const {
@@ -335,9 +332,8 @@ namespace {
   /// PPCLinuxAsmPrinter - PowerPC assembly printer, customized for Linux
   class PPCLinuxAsmPrinter : public PPCAsmPrinter {
   public:
-    explicit PPCLinuxAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                                MCStreamer &Streamer)
-      : PPCAsmPrinter(O, TM, Streamer) {}
+    explicit PPCLinuxAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+      : PPCAsmPrinter(TM, Streamer) {}
 
     virtual const char *getPassName() const {
       return "Linux PPC Assembly Printer";
@@ -358,11 +354,9 @@ namespace {
   /// PPCDarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac
   /// OS X
   class PPCDarwinAsmPrinter : public PPCAsmPrinter {
-    formatted_raw_ostream &OS;
   public:
-    explicit PPCDarwinAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                                 MCStreamer &Streamer)
-      : PPCAsmPrinter(O, TM, Streamer), OS(O) {}
+    explicit PPCDarwinAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+      : PPCAsmPrinter(TM, Streamer) {}
 
     virtual const char *getPassName() const {
       return "Darwin PPC Assembly Printer";
@@ -895,14 +889,13 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
 /// for a MachineFunction to the given output stream, in a format that the
 /// Darwin assembler can deal with.
 ///
-static AsmPrinter *createPPCAsmPrinterPass(formatted_raw_ostream &o,
-                                           TargetMachine &tm,
+static AsmPrinter *createPPCAsmPrinterPass(TargetMachine &tm,
                                            MCStreamer &Streamer) {
   const PPCSubtarget *Subtarget = &tm.getSubtarget<PPCSubtarget>();
 
   if (Subtarget->isDarwin())
-    return new PPCDarwinAsmPrinter(o, tm, Streamer);
-  return new PPCLinuxAsmPrinter(o, tm, Streamer);
+    return new PPCDarwinAsmPrinter(tm, Streamer);
+  return new PPCLinuxAsmPrinter(tm, Streamer);
 }
 
 // Force static initialization.
index b561d1319c55cf2593eb2d6f9a81fbf16d742cc5..ab948bb37ff29d86edf03aba785e0f39d5ff5f5f 100644 (file)
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 namespace {
   class SparcAsmPrinter : public AsmPrinter {
   public:
-    explicit SparcAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                             MCStreamer &Streamer)
-      : AsmPrinter(O, TM, Streamer) {}
+    explicit SparcAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+      : AsmPrinter(TM, Streamer) {}
 
     virtual const char *getPassName() const {
       return "Sparc Assembly Printer";
index 1a18d7439d0939bbb6f9fcd749ced4e3316ed21f..17271e62461a228d876e4af13910ca0150ba856e 100644 (file)
@@ -25,7 +25,6 @@
 #include "llvm/CodeGen/MachineModuleInfo.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
-#include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 namespace {
   class SystemZAsmPrinter : public AsmPrinter {
   public:
-    SystemZAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                      MCStreamer &Streamer)
-      : AsmPrinter(O, TM, Streamer) {}
+    SystemZAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+      : AsmPrinter(TM, Streamer) {}
 
     virtual const char *getPassName() const {
       return "SystemZ Assembly Printer";
@@ -172,8 +169,7 @@ void SystemZAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
   }
 
   switch (MO.getTargetFlags()) {
-  default:
-    llvm_unreachable("Unknown target flag on GV operand");
+  default: assert(0 && "Unknown target flag on GV operand");
   case SystemZII::MO_NO_FLAG:
     break;
   case SystemZII::MO_GOTENT:    O << "@GOTENT";    break;
index c706b5f09914a212323cfdf65ef63d7c755b0bcd..f5923969361db80300101f33ae2f64cb5ad7759c 100644 (file)
@@ -36,7 +36,6 @@
 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
 #include "llvm/Target/Mangler.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/TargetRegistry.h"
index b98ad44069d98d139fa42116291d1fa755d73d9b..8763ac43fa5ad3fc66e6dfdaaf9f72e4f70c772d 100644 (file)
@@ -35,9 +35,8 @@ class MCSymbol;
 class VISIBILITY_HIDDEN X86AsmPrinter : public AsmPrinter {
   const X86Subtarget *Subtarget;
  public:
-  explicit X86AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                         MCStreamer &Streamer)
-    : AsmPrinter(O, TM, Streamer) {
+  explicit X86AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+    : AsmPrinter(TM, Streamer) {
     Subtarget = &TM.getSubtarget<X86Subtarget>();
   }
 
index 0514f5645252982951259977a8659528b069d3cc..1be4885c94a868747ff2505911adac1aa2e88047 100644 (file)
@@ -38,8 +38,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
-#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <cctype>
 using namespace llvm;
@@ -54,10 +53,8 @@ namespace {
   class XCoreAsmPrinter : public AsmPrinter {
     const XCoreSubtarget &Subtarget;
   public:
-    explicit XCoreAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
-                             MCStreamer &Streamer)
-      : AsmPrinter(O, TM, Streamer),
-      Subtarget(TM.getSubtarget<XCoreSubtarget>()) {}
+    explicit XCoreAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
+      : AsmPrinter(TM, Streamer), Subtarget(TM.getSubtarget<XCoreSubtarget>()){}
 
     virtual const char *getPassName() const {
       return "XCore Assembly Printer";