[llvm-commits] [llvm] r74742 - /llvm/trunk/utils/TableGen/

Daniel Dunbar daniel at zuster.org
Thu Jul 2 17:10:30 PDT 2009


Author: ddunbar
Date: Thu Jul  2 19:10:29 2009
New Revision: 74742

URL: http://llvm.org/viewvc/llvm-project?rev=74742&view=rev
Log:
Replace std::iostreams with raw_ostream in TableGen.
 - Sorry, I can't help myself.

 - No intended functionality change.

Modified:
    llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
    llvm/trunk/utils/TableGen/AsmWriterEmitter.h
    llvm/trunk/utils/TableGen/CallingConvEmitter.cpp
    llvm/trunk/utils/TableGen/CallingConvEmitter.h
    llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
    llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.h
    llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
    llvm/trunk/utils/TableGen/CodeEmitterGen.h
    llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
    llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h
    llvm/trunk/utils/TableGen/CodeGenTarget.cpp
    llvm/trunk/utils/TableGen/CodeGenTarget.h
    llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
    llvm/trunk/utils/TableGen/DAGISelEmitter.h
    llvm/trunk/utils/TableGen/FastISelEmitter.cpp
    llvm/trunk/utils/TableGen/FastISelEmitter.h
    llvm/trunk/utils/TableGen/InstrEnumEmitter.cpp
    llvm/trunk/utils/TableGen/InstrEnumEmitter.h
    llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp
    llvm/trunk/utils/TableGen/InstrInfoEmitter.h
    llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
    llvm/trunk/utils/TableGen/IntrinsicEmitter.h
    llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
    llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.h
    llvm/trunk/utils/TableGen/Record.cpp
    llvm/trunk/utils/TableGen/Record.h
    llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
    llvm/trunk/utils/TableGen/RegisterInfoEmitter.h
    llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
    llvm/trunk/utils/TableGen/SubtargetEmitter.h
    llvm/trunk/utils/TableGen/TGLexer.cpp
    llvm/trunk/utils/TableGen/TGParser.cpp
    llvm/trunk/utils/TableGen/TGValueTypes.cpp
    llvm/trunk/utils/TableGen/TableGen.cpp
    llvm/trunk/utils/TableGen/TableGenBackend.cpp
    llvm/trunk/utils/TableGen/TableGenBackend.h

Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Thu Jul  2 19:10:29 2009
@@ -19,6 +19,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
 #include <algorithm>
+#include <iostream>
 using namespace llvm;
 
 static bool isIdentChar(char C) {
@@ -282,7 +283,7 @@
 }
 
 static void PrintCases(std::vector<std::pair<std::string,
-                       AsmWriterOperand> > &OpsToPrint, std::ostream &O) {
+                       AsmWriterOperand> > &OpsToPrint, raw_ostream &O) {
   O << "    case " << OpsToPrint.back().first << ": ";
   AsmWriterOperand TheOp = OpsToPrint.back().second;
   OpsToPrint.pop_back();
@@ -304,7 +305,7 @@
 /// EmitInstructions - Emit the last instruction in the vector and any other
 /// instructions that are suitably similar to it.
 static void EmitInstructions(std::vector<AsmWriterInst> &Insts,
-                             std::ostream &O) {
+                             raw_ostream &O) {
   AsmWriterInst FirstInst = Insts.back();
   Insts.pop_back();
 
@@ -475,7 +476,7 @@
 
 
 
-void AsmWriterEmitter::run(std::ostream &O) {
+void AsmWriterEmitter::run(raw_ostream &O) {
   EmitSourceFileHeader("Assembly Writer Source Fragment", O);
 
   CodeGenTarget Target;

Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/AsmWriterEmitter.h (original)
+++ llvm/trunk/utils/TableGen/AsmWriterEmitter.h Thu Jul  2 19:10:29 2009
@@ -32,7 +32,7 @@
     AsmWriterEmitter(RecordKeeper &R) : Records(R) {}
 
     // run - Output the asmwriter, returning true on failure.
-    void run(std::ostream &o);
+    void run(raw_ostream &o);
 
 private:
     AsmWriterInst *getAsmWriterInstByID(unsigned ID) const {

Modified: llvm/trunk/utils/TableGen/CallingConvEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CallingConvEmitter.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CallingConvEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/CallingConvEmitter.cpp Thu Jul  2 19:10:29 2009
@@ -17,7 +17,7 @@
 #include "CodeGenTarget.h"
 using namespace llvm;
 
-void CallingConvEmitter::run(std::ostream &O) {
+void CallingConvEmitter::run(raw_ostream &O) {
   EmitSourceFileHeader("Calling Convention Implementation Fragment", O);
 
   std::vector<Record*> CCs = Records.getAllDerivedDefinitions("CallingConv");
@@ -39,7 +39,7 @@
 }
 
 
-void CallingConvEmitter::EmitCallingConv(Record *CC, std::ostream &O) {
+void CallingConvEmitter::EmitCallingConv(Record *CC, raw_ostream &O) {
   ListInit *CCActions = CC->getValueAsListInit("Actions");
   Counter = 0;
 
@@ -60,7 +60,7 @@
 }
 
 void CallingConvEmitter::EmitAction(Record *Action,
-                                    unsigned Indent, std::ostream &O) {
+                                    unsigned Indent, raw_ostream &O) {
   std::string IndentStr = std::string(Indent, ' ');
   
   if (Action->isSubClassOf("CCPredicateAction")) {

Modified: llvm/trunk/utils/TableGen/CallingConvEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CallingConvEmitter.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CallingConvEmitter.h (original)
+++ llvm/trunk/utils/TableGen/CallingConvEmitter.h Thu Jul  2 19:10:29 2009
@@ -27,11 +27,11 @@
     explicit CallingConvEmitter(RecordKeeper &R) : Records(R) {}
 
     // run - Output the asmwriter, returning true on failure.
-    void run(std::ostream &o);
+    void run(raw_ostream &o);
     
   private:
-    void EmitCallingConv(Record *CC, std::ostream &O);
-    void EmitAction(Record *Action, unsigned Indent, std::ostream &O);
+    void EmitCallingConv(Record *CC, raw_ostream &O);
+    void EmitAction(Record *Action, unsigned Indent, raw_ostream &O);
     unsigned Counter;
   };
 }

Modified: llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp Thu Jul  2 19:10:29 2009
@@ -15,7 +15,6 @@
 #include "Record.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Compiler.h"
-#include "llvm/Support/Streams.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/VectorExtras.h"
@@ -27,7 +26,7 @@
 // Warning Tables (.inc file) generation.
 //===----------------------------------------------------------------------===//
 
-void ClangDiagsDefsEmitter::run(std::ostream &OS) {
+void ClangDiagsDefsEmitter::run(raw_ostream &OS) {
   // Write the #if guard
   if (!Component.empty()) {
     std::string ComponentName = UppercaseString(Component);
@@ -85,7 +84,7 @@
   unsigned IDNo;
 };
 
-void ClangDiagGroupsEmitter::run(std::ostream &OS) {
+void ClangDiagGroupsEmitter::run(raw_ostream &OS) {
   // Invert the 1-[0/1] mapping of diags to group into a one to many mapping of
   // groups to diags in the group.
   std::map<std::string, GroupInfo> DiagsInGroup;

Modified: llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.h (original)
+++ llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.h Thu Jul  2 19:10:29 2009
@@ -29,7 +29,7 @@
     : Records(R), Component(component) {}
 
   // run - Output the .def file contents
-  void run(std::ostream &OS);
+  void run(raw_ostream &OS);
 };
 
 class ClangDiagGroupsEmitter : public TableGenBackend {
@@ -37,7 +37,7 @@
 public:
   explicit ClangDiagGroupsEmitter(RecordKeeper &R) : Records(R) {}
     
-  void run(std::ostream &OS);
+  void run(raw_ostream &OS);
 };
 
   

Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CodeEmitterGen.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Thu Jul  2 19:10:29 2009
@@ -75,7 +75,7 @@
 } 
 
 
-void CodeEmitterGen::run(std::ostream &o) {
+void CodeEmitterGen::run(raw_ostream &o) {
   CodeGenTarget Target;
   std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
   

Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CodeEmitterGen.h (original)
+++ llvm/trunk/utils/TableGen/CodeEmitterGen.h Thu Jul  2 19:10:29 2009
@@ -30,10 +30,10 @@
   CodeEmitterGen(RecordKeeper &R) : Records(R) {}
 
   // run - Output the code emitter
-  void run(std::ostream &o);
+  void run(raw_ostream &o);
 private:
-  void emitMachineOpEmitter(std::ostream &o, const std::string &Namespace);
-  void emitGetValueBit(std::ostream &o, const std::string &Namespace);
+  void emitMachineOpEmitter(raw_ostream &o, const std::string &Namespace);
+  void emitGetValueBit(raw_ostream &o, const std::string &Namespace);
   void reverseBits(std::vector<Record*> &Insts);
   int getVariableBit(const std::string &VarName, BitsInit *BI, int bit);
 };

Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Thu Jul  2 19:10:29 2009
@@ -16,9 +16,9 @@
 #include "Record.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/Streams.h"
 #include <set>
 #include <algorithm>
+#include <iostream>
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
@@ -199,7 +199,7 @@
     x.SDTCisEltOfVec_Info.OtherOperandNum =
       R->getValueAsInt("OtherOpNum");
   } else {
-    cerr << "Unrecognized SDTypeConstraint '" << R->getName() << "'!\n";
+    errs() << "Unrecognized SDTypeConstraint '" << R->getName() << "'!\n";
     exit(1);
   }
 }
@@ -213,9 +213,9 @@
          "We only work with nodes with zero or one result so far!");
   
   if (OpNo >= (NumResults + N->getNumChildren())) {
-    cerr << "Invalid operand number " << OpNo << " ";
+    errs() << "Invalid operand number " << OpNo << " ";
     N->dump();
-    cerr << '\n';
+    errs() << '\n';
     exit(1);
   }
 
@@ -413,8 +413,8 @@
     } else if (PropList[i]->getName() == "SDNPMemOperand") {
       Properties |= 1 << SDNPMemOperand;
     } else {
-      cerr << "Unknown SD Node property '" << PropList[i]->getName()
-           << "' on node '" << R->getName() << "'!\n";
+      errs() << "Unknown SD Node property '" << PropList[i]->getName()
+             << "' on node '" << R->getName() << "'!\n";
       exit(1);
     }
   }
@@ -516,7 +516,7 @@
 
   if (isLeaf()) {
     dump();
-    cerr << " ";
+    errs() << " ";
     TP.error("Type inference contradiction found in node!");
   } else {
     TP.error("Type inference contradiction found in node " + 
@@ -526,7 +526,7 @@
 }
 
 
-void TreePatternNode::print(std::ostream &OS) const {
+void TreePatternNode::print(raw_ostream &OS) const {
   if (isLeaf()) {
     OS << *getLeafValue();
   } else {
@@ -573,7 +573,7 @@
 
 }
 void TreePatternNode::dump() const {
-  print(*cerr.stream());
+  print(errs());
 }
 
 /// isIsomorphicTo - Return true if this node is recursively
@@ -1194,9 +1194,9 @@
         error("Constant int argument should not have a name!");
       Children.push_back(Node);
     } else {
-      cerr << '"';
+      errs() << '"';
       Arg->dump();
-      cerr << "\": ";
+      errs() << "\": ";
       error("Unknown leaf value for tree pattern!");
     }
   }
@@ -1246,7 +1246,7 @@
   return !HasUnresolvedTypes;
 }
 
-void TreePattern::print(std::ostream &OS) const {
+void TreePattern::print(raw_ostream &OS) const {
   OS << getRecord()->getName();
   if (!Args.empty()) {
     OS << "(" << Args[0];
@@ -1268,7 +1268,7 @@
     OS << "]\n";
 }
 
-void TreePattern::dump() const { print(*cerr.stream()); }
+void TreePattern::dump() const { print(errs()); }
 
 //===----------------------------------------------------------------------===//
 // CodeGenDAGPatterns implementation
@@ -1306,7 +1306,7 @@
 Record *CodeGenDAGPatterns::getSDNodeNamed(const std::string &Name) const {
   Record *N = Records.getDef(Name);
   if (!N || !N->isSubClassOf("SDNode")) {
-    cerr << "Error getting SDNode '" << Name << "'!\n";
+    errs() << "Error getting SDNode '" << Name << "'!\n";
     exit(1);
   }
   return N;
@@ -2012,15 +2012,15 @@
         Values.push_back(Tree->getArg(j));
         TypedInit *TArg = dynamic_cast<TypedInit*>(Tree->getArg(j));
         if (TArg == 0) {
-          cerr << "In dag: " << Tree->getAsString();
-          cerr << " --  Untyped argument in pattern\n";
+          errs() << "In dag: " << Tree->getAsString();
+          errs() << " --  Untyped argument in pattern\n";
           assert(0 && "Untyped argument in pattern");
         }
         if (ListTy != 0) {
           ListTy = resolveTypes(ListTy, TArg->getType());
           if (ListTy == 0) {
-            cerr << "In dag: " << Tree->getAsString();
-            cerr << " --  Incompatible types in pattern arguments\n";
+            errs() << "In dag: " << Tree->getAsString();
+            errs() << " --  Incompatible types in pattern arguments\n";
             assert(0 && "Incompatible types in pattern arguments");
           }
         }
@@ -2138,11 +2138,11 @@
   do {
 #ifndef NDEBUG
     if (DebugFlag && !Idxs.empty()) {
-      cerr << Orig->getOperator()->getName() << ": Idxs = [ ";
+      errs() << Orig->getOperator()->getName() << ": Idxs = [ ";
         for (unsigned i = 0; i < Idxs.size(); ++i) {
-          cerr << Idxs[i] << " ";
+          errs() << Idxs[i] << " ";
       }
-      cerr << "]\n";
+      errs() << "]\n";
     }
 #endif
     // Create the variant and add it to the output list.

Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h Thu Jul  2 19:10:29 2009
@@ -236,7 +236,7 @@
   /// marked isCommutative.
   bool isCommutativeIntrinsic(const CodeGenDAGPatterns &CDP) const;
   
-  void print(std::ostream &OS) const;
+  void print(raw_ostream &OS) const;
   void dump() const;
   
 public:   // Higher level manipulation routines.
@@ -370,7 +370,7 @@
   /// pattern.
   void error(const std::string &Msg) const;
   
-  void print(std::ostream &OS) const;
+  void print(raw_ostream &OS) const;
   void dump() const;
   
 private:

Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Thu Jul  2 19:10:29 2009
@@ -19,7 +19,6 @@
 #include "Record.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Streams.h"
 #include <algorithm>
 using namespace llvm;
 
@@ -423,8 +422,8 @@
     } else if (PropList[i]->getName() == "SDNPMemOperand") {
       Properties |= 1 << SDNPMemOperand;
     } else {
-      cerr << "Unsupported SD Node property '" << PropList[i]->getName()
-           << "' on ComplexPattern '" << R->getName() << "'!\n";
+      errs() << "Unsupported SD Node property '" << PropList[i]->getName()
+             << "' on ComplexPattern '" << R->getName() << "'!\n";
       exit(1);
     }
   
@@ -435,8 +434,8 @@
     if (PropList[i]->getName() == "CPAttrParentAsRoot") {
       Attributes |= 1 << CPAttrParentAsRoot;
     } else {
-      cerr << "Unsupported pattern attribute '" << PropList[i]->getName()
-           << "' on ComplexPattern '" << R->getName() << "'!\n";
+      errs() << "Unsupported pattern attribute '" << PropList[i]->getName()
+             << "' on ComplexPattern '" << R->getName() << "'!\n";
       exit(1);
     }
 }

Modified: llvm/trunk/utils/TableGen/CodeGenTarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.h (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.h Thu Jul  2 19:10:29 2009
@@ -17,10 +17,10 @@
 #ifndef CODEGEN_TARGET_H
 #define CODEGEN_TARGET_H
 
+#include "llvm/Support/raw_ostream.h"
 #include "CodeGenRegisters.h"
 #include "CodeGenInstruction.h"
 #include <algorithm>
-#include <iosfwd>
 #include <map>
 
 namespace llvm {

Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Thu Jul  2 19:10:29 2009
@@ -18,9 +18,9 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/Streams.h"
 #include <algorithm>
 #include <deque>
+#include <iostream>
 using namespace llvm;
 
 namespace {
@@ -269,7 +269,7 @@
 //===----------------------------------------------------------------------===//
 // Node Transformation emitter implementation.
 //
-void DAGISelEmitter::EmitNodeTransforms(std::ostream &OS) {
+void DAGISelEmitter::EmitNodeTransforms(raw_ostream &OS) {
   // Walk the pattern fragments, adding them to a map, which sorts them by
   // name.
   typedef std::map<std::string, CodeGenDAGPatterns::NodeXForm> NXsByNameTy;
@@ -303,7 +303,7 @@
 // Predicate emitter implementation.
 //
 
-void DAGISelEmitter::EmitPredicateFunctions(std::ostream &OS) {
+void DAGISelEmitter::EmitPredicateFunctions(raw_ostream &OS) {
   OS << "\n// Predicate functions.\n";
 
   // Walk the pattern fragments, adding them to a map, which sorts them by
@@ -751,7 +751,7 @@
         } else {
 #ifndef NDEBUG
           Child->dump();
-          cerr << " ";
+          errs() << " ";
 #endif
           assert(0 && "Unknown leaf type!");
         }
@@ -795,7 +795,7 @@
       std::string Val = VariableMap[VarName];
       bool ModifiedVal = false;
       if (Val.empty()) {
-        cerr << "Variable '" << VarName << " referenced but not defined "
+        errs() << "Variable '" << VarName << " referenced but not defined "
              << "and not caught earlier!\n";
         abort();
       }
@@ -813,7 +813,7 @@
         std::string TmpVar =  "Tmp" + utostr(ResNo);
         switch (N->getTypeNum(0)) {
         default:
-          cerr << "Cannot handle " << getEnumName(N->getTypeNum(0))
+          errs() << "Cannot handle " << getEnumName(N->getTypeNum(0))
                << " type as an immediate constant. Aborting\n";
           abort();
         case MVT::i1:  CastType = "bool"; break;
@@ -1351,7 +1351,7 @@
     }
 
     N->dump();
-    cerr << "\n";
+    errs() << "\n";
     throw std::string("Unknown node in result pattern!");
   }
 
@@ -1537,7 +1537,7 @@
 void DAGISelEmitter::EmitPatterns(std::vector<std::pair<const PatternToMatch*, 
                               std::vector<std::pair<unsigned, std::string> > > >
                                   &Patterns, unsigned Indent,
-                                  std::ostream &OS) {
+                                  raw_ostream &OS) {
   typedef std::pair<unsigned, std::string> CodeLine;
   typedef std::vector<CodeLine> CodeList;
   typedef std::vector<std::pair<const PatternToMatch*, CodeList> > PatternList;
@@ -1652,7 +1652,7 @@
   return OpName;
 }
 
-void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
+void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
   const CodeGenTarget &Target = CGP.getTargetInfo();
   
   // Get the namespace to insert instructions into.
@@ -1684,10 +1684,10 @@
                     &Pattern);
         }
       } else {
-        cerr << "Unrecognized opcode '";
+        errs() << "Unrecognized opcode '";
         Node->dump();
-        cerr << "' on tree pattern '";
-        cerr << Pattern.getDstPattern()->getOperator()->getName() << "'!\n";
+        errs() << "' on tree pattern '";
+        errs() << Pattern.getDstPattern()->getOperator()->getName() << "'!\n";
         exit(1);
       }
     }
@@ -1884,9 +1884,9 @@
         // If this pattern definitely matches, and if it isn't the last one, the
         // patterns after it CANNOT ever match.  Error out.
         if (mightNotMatch == false && i != CodeForPatterns.size()-1) {
-          cerr << "Pattern '";
-          CodeForPatterns[i].first->getSrcPattern()->print(*cerr.stream());
-          cerr << "' is impossible to select!\n";
+          errs() << "Pattern '";
+          CodeForPatterns[i].first->getSrcPattern()->print(errs());
+          errs() << "' is impossible to select!\n";
           exit(1);
         }
       }
@@ -2100,7 +2100,7 @@
      << "}\n\n";
 }
 
-void DAGISelEmitter::run(std::ostream &OS) {
+void DAGISelEmitter::run(raw_ostream &OS) {
   EmitSourceFileHeader("DAG Instruction Selector for the " +
                        CGP.getTargetInfo().getName() + " target", OS);
   

Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelEmitter.h (original)
+++ llvm/trunk/utils/TableGen/DAGISelEmitter.h Thu Jul  2 19:10:29 2009
@@ -30,12 +30,12 @@
   explicit DAGISelEmitter(RecordKeeper &R) : Records(R), CGP(R) {}
 
   // run - Output the isel, returning true on failure.
-  void run(std::ostream &OS);
+  void run(raw_ostream &OS);
   
   
 private:
-  void EmitNodeTransforms(std::ostream &OS);
-  void EmitPredicateFunctions(std::ostream &OS);
+  void EmitNodeTransforms(raw_ostream &OS);
+  void EmitPredicateFunctions(raw_ostream &OS);
   
   void GenerateCodeForPattern(const PatternToMatch &Pattern,
                   std::vector<std::pair<unsigned, std::string> > &GeneratedCode,
@@ -46,9 +46,9 @@
                               unsigned &NumInputRootOps);
   void EmitPatterns(std::vector<std::pair<const PatternToMatch*, 
                   std::vector<std::pair<unsigned, std::string> > > > &Patterns, 
-                    unsigned Indent, std::ostream &OS);
+                    unsigned Indent, raw_ostream &OS);
   
-  void EmitInstructionSelector(std::ostream &OS);
+  void EmitInstructionSelector(raw_ostream &OS);
 };
 
 } // End llvm namespace

Modified: llvm/trunk/utils/TableGen/FastISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FastISelEmitter.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/FastISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/FastISelEmitter.cpp Thu Jul  2 19:10:29 2009
@@ -20,7 +20,6 @@
 #include "FastISelEmitter.h"
 #include "Record.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/Streams.h"
 #include "llvm/ADT/VectorExtras.h"
 using namespace llvm;
 
@@ -119,7 +118,7 @@
     return true;
   }
 
-  void PrintParameters(std::ostream &OS) const {
+  void PrintParameters(raw_ostream &OS) const {
     for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
       if (Operands[i] == "r") {
         OS << "unsigned Op" << i;
@@ -136,7 +135,7 @@
     }
   }
 
-  void PrintArguments(std::ostream &OS,
+  void PrintArguments(raw_ostream &OS,
                       const std::vector<std::string>& PR) const {
     assert(PR.size() == Operands.size());
     bool PrintedArg = false;
@@ -163,7 +162,7 @@
     }
   }
 
-  void PrintArguments(std::ostream &OS) const {
+  void PrintArguments(raw_ostream &OS) const {
     for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
       if (Operands[i] == "r") {
         OS << "Op" << i;
@@ -181,7 +180,7 @@
   }
 
 
-  void PrintManglingSuffix(std::ostream &OS,
+  void PrintManglingSuffix(raw_ostream &OS,
                            const std::vector<std::string>& PR) const {
     for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
       if (PR[i] != "")
@@ -195,7 +194,7 @@
     }
   }
 
-  void PrintManglingSuffix(std::ostream &OS) const {
+  void PrintManglingSuffix(raw_ostream &OS) const {
     for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
       OS << Operands[i];
     }
@@ -217,8 +216,8 @@
   explicit FastISelMap(std::string InstNS);
 
   void CollectPatterns(CodeGenDAGPatterns &CGP);
-  void PrintClass(std::ostream &OS);
-  void PrintFunctionDefinitions(std::ostream &OS);
+  void PrintClass(raw_ostream &OS);
+  void PrintFunctionDefinitions(raw_ostream &OS);
 };
 
 }
@@ -368,7 +367,7 @@
   }
 }
 
-void FastISelMap::PrintFunctionDefinitions(std::ostream &OS) {
+void FastISelMap::PrintFunctionDefinitions(raw_ostream &OS) {
   // Now emit code for all the patterns that we collected.
   for (OperandsOpcodeTypeRetPredMap::const_iterator OI = SimplePatterns.begin(),
        OE = SimplePatterns.end(); OI != OE; ++OI) {
@@ -614,7 +613,7 @@
   }
 }
 
-void FastISelEmitter::run(std::ostream &OS) {
+void FastISelEmitter::run(raw_ostream &OS) {
   const CodeGenTarget &Target = CGP.getTargetInfo();
 
   // Determine the target's namespace name.

Modified: llvm/trunk/utils/TableGen/FastISelEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FastISelEmitter.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/FastISelEmitter.h (original)
+++ llvm/trunk/utils/TableGen/FastISelEmitter.h Thu Jul  2 19:10:29 2009
@@ -31,7 +31,7 @@
   explicit FastISelEmitter(RecordKeeper &R);
 
   // run - Output the isel, returning true on failure.
-  void run(std::ostream &OS);
+  void run(raw_ostream &OS);
 };
 
 } // End llvm namespace

Modified: llvm/trunk/utils/TableGen/InstrEnumEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrEnumEmitter.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/InstrEnumEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/InstrEnumEmitter.cpp Thu Jul  2 19:10:29 2009
@@ -19,7 +19,7 @@
 using namespace llvm;
 
 // runEnums - Print out enum values for all of the instructions.
-void InstrEnumEmitter::run(std::ostream &OS) {
+void InstrEnumEmitter::run(raw_ostream &OS) {
   EmitSourceFileHeader("Target Instruction Enum Values", OS);
   OS << "namespace llvm {\n\n";
 

Modified: llvm/trunk/utils/TableGen/InstrEnumEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrEnumEmitter.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/InstrEnumEmitter.h (original)
+++ llvm/trunk/utils/TableGen/InstrEnumEmitter.h Thu Jul  2 19:10:29 2009
@@ -25,7 +25,7 @@
   InstrEnumEmitter(RecordKeeper &R) : Records(R) {}
 
   // run - Output the instruction set description, returning true on failure.
-  void run(std::ostream &OS);
+  void run(raw_ostream &OS);
 };
 
 } // End llvm namespace

Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Thu Jul  2 19:10:29 2009
@@ -16,11 +16,10 @@
 #include "CodeGenTarget.h"
 #include "Record.h"
 #include <algorithm>
-#include <iostream>
 using namespace llvm;
 
 static void PrintDefList(const std::vector<Record*> &Uses,
-                         unsigned Num, std::ostream &OS) {
+                         unsigned Num, raw_ostream &OS) {
   OS << "static const unsigned ImplicitList" << Num << "[] = { ";
   for (unsigned i = 0, e = Uses.size(); i != e; ++i)
     OS << getQualifiedName(Uses[i]) << ", ";
@@ -28,7 +27,7 @@
 }
 
 static void PrintBarriers(std::vector<Record*> &Barriers,
-                          unsigned Num, std::ostream &OS) {
+                          unsigned Num, raw_ostream &OS) {
   OS << "static const TargetRegisterClass* Barriers" << Num << "[] = { ";
   for (unsigned i = 0, e = Barriers.size(); i != e; ++i)
     OS << "&" << getQualifiedName(Barriers[i]) << "RegClass, ";
@@ -123,7 +122,7 @@
   return Result;
 }
 
-void InstrInfoEmitter::EmitOperandInfo(std::ostream &OS, 
+void InstrInfoEmitter::EmitOperandInfo(raw_ostream &OS, 
                                        OperandInfoMapTy &OperandInfoIDs) {
   // ID #0 is for no operand info.
   unsigned OperandListNum = 0;
@@ -177,7 +176,7 @@
 //===----------------------------------------------------------------------===//
 
 // run - Emit the main instruction description records for the target...
-void InstrInfoEmitter::run(std::ostream &OS) {
+void InstrInfoEmitter::run(raw_ostream &OS) {
   GatherItinClasses();
 
   EmitSourceFileHeader("Target Instruction Descriptors", OS);
@@ -243,7 +242,7 @@
                          std::map<std::vector<Record*>, unsigned> &EmittedLists,
                                   std::map<Record*, unsigned> &BarriersMap,
                                   const OperandInfoMapTy &OpInfo,
-                                  std::ostream &OS) {
+                                  raw_ostream &OS) {
   int MinOperands = 0;
   if (!Inst.OperandList.empty())
     // Each logical operand can be multiple MI operands.
@@ -323,7 +322,7 @@
 
 
 void InstrInfoEmitter::emitShiftedValue(Record *R, StringInit *Val,
-                                        IntInit *ShiftInt, std::ostream &OS) {
+                                        IntInit *ShiftInt, raw_ostream &OS) {
   if (Val == 0 || ShiftInt == 0)
     throw std::string("Illegal value or shift amount in TargetInfo*!");
   RecordVal *RV = R->getValue(Val->getValue());
@@ -375,7 +374,7 @@
     return;
   }
 
-  std::cerr << "Unhandled initializer: " << *Val << "\n";
+  errs() << "Unhandled initializer: " << *Val << "\n";
   throw "In record '" + R->getName() + "' for TSFlag emission.";
 }
 

Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/InstrInfoEmitter.h (original)
+++ llvm/trunk/utils/TableGen/InstrInfoEmitter.h Thu Jul  2 19:10:29 2009
@@ -36,7 +36,7 @@
   InstrInfoEmitter(RecordKeeper &R) : Records(R), CDP(R) { }
 
   // run - Output the instruction set description, returning true on failure.
-  void run(std::ostream &OS);
+  void run(raw_ostream &OS);
 
 private:
   typedef std::map<std::vector<std::string>, unsigned> OperandInfoMapTy;
@@ -46,16 +46,16 @@
                   std::map<std::vector<Record*>, unsigned> &EL,
                   std::map<Record*, unsigned> &BM,
                   const OperandInfoMapTy &OpInfo,
-                  std::ostream &OS);
+                  raw_ostream &OS);
   void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
-                        std::ostream &OS);
+                        raw_ostream &OS);
 
   // Itinerary information.
   void GatherItinClasses();
   unsigned getItinClassNumber(const Record *InstRec);
   
   // Operand information.
-  void EmitOperandInfo(std::ostream &OS, OperandInfoMapTy &OperandInfoIDs);
+  void EmitOperandInfo(raw_ostream &OS, OperandInfoMapTy &OperandInfoIDs);
   std::vector<std::string> GetOperandInfo(const CodeGenInstruction &Inst);
 
   void DetectRegisterClassBarriers(std::vector<Record*> &Defs,

Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Thu Jul  2 19:10:29 2009
@@ -22,7 +22,7 @@
 // IntrinsicEmitter Implementation
 //===----------------------------------------------------------------------===//
 
-void IntrinsicEmitter::run(std::ostream &OS) {
+void IntrinsicEmitter::run(raw_ostream &OS) {
   EmitSourceFileHeader("Intrinsic Function Source Fragment", OS);
   
   std::vector<CodeGenIntrinsic> Ints = LoadIntrinsics(Records, TargetOnly);
@@ -62,7 +62,7 @@
 }
 
 void IntrinsicEmitter::EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints,
-                                    std::ostream &OS) {
+                                    raw_ostream &OS) {
   OS << "// Enum values for Intrinsics.h\n";
   OS << "#ifdef GET_INTRINSIC_ENUM_VALUES\n";
   for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
@@ -76,7 +76,7 @@
 
 void IntrinsicEmitter::
 EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints, 
-                     std::ostream &OS) {
+                     raw_ostream &OS) {
   // Build a function name -> intrinsic name mapping.
   std::map<std::string, unsigned> IntMapping;
   for (unsigned i = 0, e = Ints.size(); i != e; ++i)
@@ -114,7 +114,7 @@
 
 void IntrinsicEmitter::
 EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints, 
-                         std::ostream &OS) {
+                         raw_ostream &OS) {
   OS << "// Intrinsic ID to name table\n";
   OS << "#ifdef GET_INTRINSIC_NAME_TABLE\n";
   OS << "  // Note that entry #0 is the invalid intrinsic!\n";
@@ -125,7 +125,7 @@
 
 void IntrinsicEmitter::
 EmitIntrinsicToOverloadTable(const std::vector<CodeGenIntrinsic> &Ints, 
-                         std::ostream &OS) {
+                         raw_ostream &OS) {
   OS << "// Intrinsic ID to overload table\n";
   OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n";
   OS << "  // Note that entry #0 is the invalid intrinsic!\n";
@@ -140,7 +140,7 @@
   OS << "#endif\n\n";
 }
 
-static void EmitTypeForValueType(std::ostream &OS, MVT::SimpleValueType VT) {
+static void EmitTypeForValueType(raw_ostream &OS, MVT::SimpleValueType VT) {
   if (MVT(VT).isInteger()) {
     unsigned BitWidth = MVT(VT).getSizeInBits();
     OS << "IntegerType::get(" << BitWidth << ")";
@@ -164,10 +164,10 @@
   }
 }
 
-static void EmitTypeGenerate(std::ostream &OS, const Record *ArgType,
+static void EmitTypeGenerate(raw_ostream &OS, const Record *ArgType,
                              unsigned &ArgNo);
 
-static void EmitTypeGenerate(std::ostream &OS,
+static void EmitTypeGenerate(raw_ostream &OS,
                              const std::vector<Record*> &ArgTypes,
                              unsigned &ArgNo) {
   if (ArgTypes.size() == 1) {
@@ -186,7 +186,7 @@
   OS << " NULL)";
 }
 
-static void EmitTypeGenerate(std::ostream &OS, const Record *ArgType,
+static void EmitTypeGenerate(raw_ostream &OS, const Record *ArgType,
                              unsigned &ArgNo) {
   MVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT"));
 
@@ -275,7 +275,7 @@
 }
 
 void IntrinsicEmitter::EmitVerifier(const std::vector<CodeGenIntrinsic> &Ints, 
-                                    std::ostream &OS) {
+                                    raw_ostream &OS) {
   OS << "// Verifier::visitIntrinsicFunctionCall code.\n";
   OS << "#ifdef GET_INTRINSIC_VERIFIER\n";
   OS << "  switch (ID) {\n";
@@ -358,7 +358,7 @@
 }
 
 void IntrinsicEmitter::EmitGenerator(const std::vector<CodeGenIntrinsic> &Ints, 
-                                     std::ostream &OS) {
+                                     raw_ostream &OS) {
   OS << "// Code for generating Intrinsic function declarations.\n";
   OS << "#ifdef GET_INTRINSIC_GENERATOR\n";
   OS << "  switch (id) {\n";
@@ -415,7 +415,7 @@
 
 /// EmitAttributes - This emits the Intrinsic::getAttributes method.
 void IntrinsicEmitter::
-EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS) {
+EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
   OS << "// Add parameter attributes that are not common to all intrinsics.\n";
   OS << "#ifdef GET_INTRINSIC_ATTRIBUTES\n";
   if (TargetOnly)
@@ -504,7 +504,7 @@
 
 /// EmitModRefBehavior - Determine intrinsic alias analysis mod/ref behavior.
 void IntrinsicEmitter::
-EmitModRefBehavior(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS){
+EmitModRefBehavior(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS){
   OS << "// Determine intrinsic alias analysis mod/ref behavior.\n";
   OS << "#ifdef GET_INTRINSIC_MODREF_BEHAVIOR\n";
   OS << "switch (id) {\n";
@@ -534,7 +534,7 @@
 }
 
 void IntrinsicEmitter::
-EmitGCCBuiltinList(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS){
+EmitGCCBuiltinList(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS){
   OS << "// Get the GCC builtin that corresponds to an LLVM intrinsic.\n";
   OS << "#ifdef GET_GCC_BUILTIN_NAME\n";
   OS << "  switch (F->getIntrinsicID()) {\n";
@@ -559,7 +559,7 @@
 typedef std::map<std::string, std::string>::const_iterator StrMapIterator;
 static void EmitBuiltinComparisons(StrMapIterator Start, StrMapIterator End,
                                    unsigned CharStart, unsigned Indent,
-                                   std::string TargetPrefix, std::ostream &OS) {
+                                   std::string TargetPrefix, raw_ostream &OS) {
   if (Start == End) return; // empty range.
   
   // Determine what, if anything, is the same about all these strings.
@@ -633,7 +633,7 @@
 /// same target, and we already checked it.
 static void EmitTargetBuiltins(const std::map<std::string, std::string> &BIM,
                                const std::string &TargetPrefix,
-                               std::ostream &OS) {
+                               raw_ostream &OS) {
   // Rearrange the builtins by length.
   std::vector<std::map<std::string, std::string> > BuiltinsByLen;
   BuiltinsByLen.reserve(100);
@@ -660,7 +660,7 @@
         
 void IntrinsicEmitter::
 EmitIntrinsicToGCCBuiltinMap(const std::vector<CodeGenIntrinsic> &Ints, 
-                             std::ostream &OS) {
+                             raw_ostream &OS) {
   typedef std::map<std::string, std::map<std::string, std::string> > BIMTy;
   BIMTy BuiltinMap;
   for (unsigned i = 0, e = Ints.size(); i != e; ++i) {

Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/IntrinsicEmitter.h (original)
+++ llvm/trunk/utils/TableGen/IntrinsicEmitter.h Thu Jul  2 19:10:29 2009
@@ -27,29 +27,29 @@
     IntrinsicEmitter(RecordKeeper &R, bool T = false) 
       : Records(R), TargetOnly(T) {}
 
-    void run(std::ostream &OS);
+    void run(raw_ostream &OS);
     
     void EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints, 
-                      std::ostream &OS);
+                      raw_ostream &OS);
 
     void EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints, 
-                              std::ostream &OS);
+                              raw_ostream &OS);
     void EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints, 
-                                  std::ostream &OS);
+                                  raw_ostream &OS);
     void EmitIntrinsicToOverloadTable(const std::vector<CodeGenIntrinsic> &Ints, 
-                                      std::ostream &OS);
+                                      raw_ostream &OS);
     void EmitVerifier(const std::vector<CodeGenIntrinsic> &Ints, 
-                      std::ostream &OS);
+                      raw_ostream &OS);
     void EmitGenerator(const std::vector<CodeGenIntrinsic> &Ints, 
-                       std::ostream &OS);
+                       raw_ostream &OS);
     void EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints,
-                        std::ostream &OS);
+                        raw_ostream &OS);
     void EmitModRefBehavior(const std::vector<CodeGenIntrinsic> &Ints,
-                            std::ostream &OS);
+                            raw_ostream &OS);
     void EmitGCCBuiltinList(const std::vector<CodeGenIntrinsic> &Ints, 
-                            std::ostream &OS);
+                            raw_ostream &OS);
     void EmitIntrinsicToGCCBuiltinMap(const std::vector<CodeGenIntrinsic> &Ints, 
-                                      std::ostream &OS);
+                                      raw_ostream &OS);
   };
 
 } // End llvm namespace

Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Thu Jul  2 19:10:29 2009
@@ -19,8 +19,6 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringSet.h"
-#include "llvm/Support/Streams.h"
-
 #include <algorithm>
 #include <cassert>
 #include <functional>
@@ -241,7 +239,7 @@
   if (Help == other.Help || Help == DefaultHelpString)
     Help = other.Help;
   else if (other.Help != DefaultHelpString) {
-    llvm::cerr << "Warning: several different help strings"
+    llvm::errs() << "Warning: several different help strings"
       " defined for option " + Name + "\n";
   }
 
@@ -489,7 +487,7 @@
       throw std::string("Only one of (required), (zero_or_one) or "
                         "(one_or_more) properties is allowed!");
     if (!OptionType::IsList(optDesc_.Type))
-      llvm::cerr << "Warning: specifying the 'one_or_more' property "
+      llvm::errs() << "Warning: specifying the 'one_or_more' property "
         "on a non-list option will have no effect.\n";
     optDesc_.setOneOrMore();
   }
@@ -500,7 +498,7 @@
       throw std::string("Only one of (required), (zero_or_one) or "
                         "(one_or_more) properties is allowed!");
     if (!OptionType::IsList(optDesc_.Type))
-      llvm::cerr << "Warning: specifying the 'zero_or_one' property"
+      llvm::errs() << "Warning: specifying the 'zero_or_one' property"
         "on a non-list option will have no effect.\n";
     optDesc_.setZeroOrOne();
   }
@@ -947,7 +945,7 @@
     const OptionDescription& Val = B->second;
     if (!nonSuperfluousOptions.count(Val.Name)
         && Val.Type != OptionType::Alias)
-      llvm::cerr << "Warning: option '-" << Val.Name << "' has no effect! "
+      llvm::errs() << "Warning: option '-" << Val.Name << "' has no effect! "
         "Probable cause: this option is specified only in the OptionList.\n";
   }
 }
@@ -957,7 +955,7 @@
 bool EmitCaseTest1Arg(const std::string& TestName,
                       const DagInit& d,
                       const OptionDescriptions& OptDescs,
-                      std::ostream& O) {
+                      raw_ostream& O) {
   checkNumberOfArguments(&d, 1);
   const std::string& OptName = InitPtrToString(d.getArg(0));
 
@@ -1003,7 +1001,7 @@
                        const DagInit& d,
                        const char* IndentLevel,
                        const OptionDescriptions& OptDescs,
-                       std::ostream& O) {
+                       raw_ostream& O) {
   checkNumberOfArguments(&d, 2);
   const std::string& OptName = InitPtrToString(d.getArg(0));
   const std::string& OptArg = InitPtrToString(d.getArg(1));
@@ -1032,14 +1030,14 @@
 // EmitLogicalOperationTest and EmitCaseTest are mutually recursive.
 void EmitCaseTest(const DagInit& d, const char* IndentLevel,
                   const OptionDescriptions& OptDescs,
-                  std::ostream& O);
+                  raw_ostream& O);
 
 /// EmitLogicalOperationTest - Helper function used by
 /// EmitCaseConstructHandler.
 void EmitLogicalOperationTest(const DagInit& d, const char* LogicOp,
                               const char* IndentLevel,
                               const OptionDescriptions& OptDescs,
-                              std::ostream& O) {
+                              raw_ostream& O) {
   O << '(';
   for (unsigned j = 0, NumArgs = d.getNumArgs(); j < NumArgs; ++j) {
     const DagInit& InnerTest = InitPtrToDag(d.getArg(j));
@@ -1054,7 +1052,7 @@
 /// EmitCaseTest - Helper function used by EmitCaseConstructHandler.
 void EmitCaseTest(const DagInit& d, const char* IndentLevel,
                   const OptionDescriptions& OptDescs,
-                  std::ostream& O) {
+                  raw_ostream& O) {
   const std::string& TestName = d.getOperator()->getAsString();
 
   if (TestName == "and")
@@ -1072,12 +1070,12 @@
 // Emit code that handles the 'case' construct.
 // Takes a function object that should emit code for every case clause.
 // Callback's type is
-// void F(Init* Statement, const char* IndentLevel, std::ostream& O).
+// void F(Init* Statement, const char* IndentLevel, raw_ostream& O).
 template <typename F>
 void EmitCaseConstructHandler(const Init* Dag, const char* IndentLevel,
                               F Callback, bool EmitElseIf,
                               const OptionDescriptions& OptDescs,
-                              std::ostream& O) {
+                              raw_ostream& O) {
   const DagInit* d = &InitPtrToDag(Dag);
   if (d->getOperator()->getAsString() != "case")
     throw std::string("EmitCaseConstructHandler should be invoked"
@@ -1210,7 +1208,7 @@
 /// SubstituteSpecialCommands - Perform string substitution for $CALL
 /// and $ENV. Helper function used by EmitCmdLineVecFill().
 StrVector::const_iterator SubstituteSpecialCommands
-(StrVector::const_iterator Pos, StrVector::const_iterator End, std::ostream& O)
+(StrVector::const_iterator Pos, StrVector::const_iterator End, raw_ostream& O)
 {
 
   const std::string& cmd = *Pos;
@@ -1275,7 +1273,7 @@
 /// vector. Helper function used by EmitGenerateActionMethod().
 void EmitCmdLineVecFill(const Init* CmdLine, const std::string& ToolName,
                         bool IsJoin, const char* IndentLevel,
-                        std::ostream& O) {
+                        raw_ostream& O) {
   StrVector StrVec;
   TokenizeCmdline(InitPtrToString(CmdLine), StrVec);
 
@@ -1344,7 +1342,7 @@
     : IsJoin(J), ToolName(TN) {}
 
   void operator()(const Init* Statement, const char* IndentLevel,
-                  std::ostream& O) const
+                  raw_ostream& O) const
   {
     EmitCmdLineVecFill(Statement, ToolName, IsJoin,
                        IndentLevel, O);
@@ -1357,7 +1355,7 @@
 void EmitForwardOptionPropertyHandlingCode (const OptionDescription& D,
                                             const char* Indent,
                                             const std::string& NewName,
-                                            std::ostream& O) {
+                                            raw_ostream& O) {
   const std::string& Name = NewName.empty()
     ? ("-" + D.Name)
     : NewName;
@@ -1416,7 +1414,7 @@
   const OptionDescriptions& OptDescs;
 
   void processActionDag(const Init* Statement, const char* IndentLevel,
-                        std::ostream& O) const
+                        raw_ostream& O) const
   {
     const DagInit& Dag = InitPtrToDag(Statement);
     const std::string& ActionName = Dag.getOperator()->getAsString();
@@ -1491,7 +1489,7 @@
     : OptDescs(OD) {}
 
   void operator()(const Init* Statement, const char* IndentLevel,
-                  std::ostream& O) const
+                  raw_ostream& O) const
   {
     if (typeid(*Statement) == typeid(ListInit)) {
       const ListInit& DagList = *static_cast<const ListInit*>(Statement);
@@ -1509,7 +1507,7 @@
 // Tool::GenerateAction() method.
 void EmitGenerateActionMethod (const ToolDescription& D,
                                const OptionDescriptions& OptDescs,
-                               bool IsJoin, std::ostream& O) {
+                               bool IsJoin, raw_ostream& O) {
   if (IsJoin)
     O << Indent1 << "Action GenerateAction(const PathVector& inFiles,\n";
   else
@@ -1561,7 +1559,7 @@
 /// a given Tool class.
 void EmitGenerateActionMethods (const ToolDescription& ToolDesc,
                                 const OptionDescriptions& OptDescs,
-                                std::ostream& O) {
+                                raw_ostream& O) {
   if (!ToolDesc.isJoin())
     O << Indent1 << "Action GenerateAction(const PathVector& inFiles,\n"
       << Indent2 << "bool HasChildren,\n"
@@ -1580,7 +1578,7 @@
 
 /// EmitInOutLanguageMethods - Emit the [Input,Output]Language()
 /// methods for a given Tool class.
-void EmitInOutLanguageMethods (const ToolDescription& D, std::ostream& O) {
+void EmitInOutLanguageMethods (const ToolDescription& D, raw_ostream& O) {
   O << Indent1 << "const char** InputLanguages() const {\n"
     << Indent2 << "return InputLanguages_;\n"
     << Indent1 << "}\n\n";
@@ -1594,7 +1592,7 @@
 }
 
 /// EmitNameMethod - Emit the Name() method for a given Tool class.
-void EmitNameMethod (const ToolDescription& D, std::ostream& O) {
+void EmitNameMethod (const ToolDescription& D, raw_ostream& O) {
   O << Indent1 << "const char* Name() const {\n"
     << Indent2 << "return \"" << D.Name << "\";\n"
     << Indent1 << "}\n\n";
@@ -1602,7 +1600,7 @@
 
 /// EmitIsJoinMethod - Emit the IsJoin() method for a given Tool
 /// class.
-void EmitIsJoinMethod (const ToolDescription& D, std::ostream& O) {
+void EmitIsJoinMethod (const ToolDescription& D, raw_ostream& O) {
   O << Indent1 << "bool IsJoin() const {\n";
   if (D.isJoin())
     O << Indent2 << "return true;\n";
@@ -1613,7 +1611,7 @@
 
 /// EmitStaticMemberDefinitions - Emit static member definitions for a
 /// given Tool class.
-void EmitStaticMemberDefinitions(const ToolDescription& D, std::ostream& O) {
+void EmitStaticMemberDefinitions(const ToolDescription& D, raw_ostream& O) {
   if (D.InLanguage.empty())
     throw "Tool " + D.Name + " has no 'in_language' property!";
 
@@ -1627,7 +1625,7 @@
 /// EmitToolClassDefinition - Emit a Tool class definition.
 void EmitToolClassDefinition (const ToolDescription& D,
                               const OptionDescriptions& OptDescs,
-                              std::ostream& O) {
+                              raw_ostream& O) {
   if (D.Name == "root")
     return;
 
@@ -1658,7 +1656,7 @@
 /// and emit registration code.
 void EmitOptionDefinitions (const OptionDescriptions& descs,
                             bool HasSink, bool HasExterns,
-                            std::ostream& O)
+                            raw_ostream& O)
 {
   std::vector<OptionDescription> Aliases;
 
@@ -1742,7 +1740,7 @@
 }
 
 /// EmitPopulateLanguageMap - Emit the PopulateLanguageMap() function.
-void EmitPopulateLanguageMap (const RecordKeeper& Records, std::ostream& O)
+void EmitPopulateLanguageMap (const RecordKeeper& Records, raw_ostream& O)
 {
   // Generate code
   O << "void PopulateLanguageMapLocal(LanguageMap& langMap) {\n";
@@ -1776,7 +1774,7 @@
 /// IncDecWeight - Helper function passed to EmitCaseConstructHandler()
 /// by EmitEdgeClass().
 void IncDecWeight (const Init* i, const char* IndentLevel,
-                   std::ostream& O) {
+                   raw_ostream& O) {
   const DagInit& d = InitPtrToDag(i);
   const std::string& OpName = d.getOperator()->getAsString();
 
@@ -1808,7 +1806,7 @@
 /// EmitEdgeClass - Emit a single Edge# class.
 void EmitEdgeClass (unsigned N, const std::string& Target,
                     DagInit* Case, const OptionDescriptions& OptDescs,
-                    std::ostream& O) {
+                    raw_ostream& O) {
 
   // Class constructor.
   O << "class Edge" << N << ": public Edge {\n"
@@ -1830,7 +1828,7 @@
 /// EmitEdgeClasses - Emit Edge* classes that represent graph edges.
 void EmitEdgeClasses (const RecordVector& EdgeVector,
                       const OptionDescriptions& OptDescs,
-                      std::ostream& O) {
+                      raw_ostream& O) {
   int i = 0;
   for (RecordVector::const_iterator B = EdgeVector.begin(),
          E = EdgeVector.end(); B != E; ++B) {
@@ -1848,7 +1846,7 @@
 /// function.
 void EmitPopulateCompilationGraph (const RecordVector& EdgeVector,
                                    const ToolDescriptions& ToolDescs,
-                                   std::ostream& O)
+                                   raw_ostream& O)
 {
   O << "void PopulateCompilationGraphLocal(CompilationGraph& G) {\n";
 
@@ -1947,7 +1945,7 @@
 /// EmitHookDeclarations - Parse CmdLine fields of all the tool
 /// property records and emit hook function declaration for each
 /// instance of $CALL(HookName).
-void EmitHookDeclarations(const ToolDescriptions& ToolDescs, std::ostream& O) {
+void EmitHookDeclarations(const ToolDescriptions& ToolDescs, raw_ostream& O) {
   llvm::StringMap<unsigned> HookNames;
 
   FillInHookNames(ToolDescs, HookNames);
@@ -1969,7 +1967,7 @@
 }
 
 /// EmitRegisterPlugin - Emit code to register this plugin.
-void EmitRegisterPlugin(int Priority, std::ostream& O) {
+void EmitRegisterPlugin(int Priority, raw_ostream& O) {
   O << "struct Plugin : public llvmc::BasePlugin {\n\n"
     << Indent1 << "int Priority() const { return " << Priority << "; }\n\n"
     << Indent1 << "void PopulateLanguageMap(LanguageMap& langMap) const\n"
@@ -1984,7 +1982,7 @@
 
 /// EmitIncludes - Emit necessary #include directives and some
 /// additional declarations.
-void EmitIncludes(std::ostream& O) {
+void EmitIncludes(raw_ostream& O) {
   O << "#include \"llvm/CompilerDriver/CompilationGraph.h\"\n"
     << "#include \"llvm/CompilerDriver/ForceLinkageMacros.h\"\n"
     << "#include \"llvm/CompilerDriver/Plugin.h\"\n"
@@ -2079,7 +2077,7 @@
 
 }
 
-void EmitPluginCode(const PluginData& Data, std::ostream& O) {
+void EmitPluginCode(const PluginData& Data, raw_ostream& O) {
   // Emit file header.
   EmitIncludes(O);
 
@@ -2124,7 +2122,7 @@
 }
 
 /// run - The back-end entry point.
-void LLVMCConfigurationEmitter::run (std::ostream &O) {
+void LLVMCConfigurationEmitter::run (raw_ostream &O) {
   try {
   PluginData Data;
 

Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.h (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.h Thu Jul  2 19:10:29 2009
@@ -26,7 +26,7 @@
     explicit LLVMCConfigurationEmitter(RecordKeeper &R) : Records(R) {}
 
     // run - Output the asmwriter, returning true on failure.
-    void run(std::ostream &o);
+    void run(raw_ostream &o);
   };
 }
 

Modified: llvm/trunk/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/Record.cpp (original)
+++ llvm/trunk/utils/TableGen/Record.cpp Thu Jul  2 19:10:29 2009
@@ -13,9 +13,8 @@
 
 #include "Record.h"
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/Streams.h"
+#include "llvm/Support/Format.h"
 #include "llvm/ADT/StringExtras.h"
-#include <ios>
 
 using namespace llvm;
 
@@ -23,7 +22,7 @@
 //    Type implementations
 //===----------------------------------------------------------------------===//
 
-void RecTy::dump() const { print(*cerr.stream()); }
+void RecTy::dump() const { print(errs()); }
 
 Init *BitRecTy::convertValue(BitsInit *BI) {
   if (BI->getNumBits() != 1) return 0; // Only accept if just one bit!
@@ -330,7 +329,7 @@
 //    Initializer implementations
 //===----------------------------------------------------------------------===//
 
-void Init::dump() const { return print(*cerr.stream()); }
+void Init::dump() const { return print(errs()); }
 
 Init *BitsInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) {
   BitsInit *BI = new BitsInit(Bits.size());
@@ -360,7 +359,7 @@
   return Result + " }";
 }
 
-bool BitsInit::printInHex(std::ostream &OS) const {
+bool BitsInit::printInHex(raw_ostream &OS) const {
   // First, attempt to convert the value into an integer value...
   int64_t Result = 0;
   for (unsigned i = 0, e = getNumBits(); i != e; ++i)
@@ -370,11 +369,11 @@
       return true;
     }
 
-  OS << "0x" << std::hex << Result << std::dec;
+  OS << format("0x%x", Result);
   return false;
 }
 
-bool BitsInit::printAsVariable(std::ostream &OS) const {
+bool BitsInit::printAsVariable(raw_ostream &OS) const {
   // Get the variable that we may be set equal to...
   assert(getNumBits() != 0);
   VarBitInit *FirstBit = dynamic_cast<VarBitInit*>(getBit(0));
@@ -397,7 +396,7 @@
   return false;
 }
 
-bool BitsInit::printAsUnset(std::ostream &OS) const {
+bool BitsInit::printAsUnset(raw_ostream &OS) const {
   for (unsigned i = 0, e = getNumBits(); i != e; ++i)
     if (!dynamic_cast<UnsetInit*>(getBit(i)))
       return true;
@@ -592,7 +591,7 @@
         if (Record *D = Records.getDef(Name))
           return new DefInit(D);
 
-        cerr << "Variable not defined: '" + Name + "'\n";
+        errs() << "Variable not defined: '" + Name + "'\n";
         assert(0 && "Variable not found");
         return 0;
       }
@@ -771,7 +770,7 @@
       if (Record *D = Records.getDef(Name))
         return new DefInit(D);
 
-      cerr << "Variable not defined in !nameconcat: '" + Name + "'\n";
+      errs() << "Variable not defined in !nameconcat: '" + Name + "'\n";
       assert(0 && "Variable not found in !nameconcat");
       return 0;
     }
@@ -886,14 +885,14 @@
   OpInit *RHSo = dynamic_cast<OpInit*>(RHS);
 
   if (!RHSo) {
-    cerr << "!foreach requires an operator\n";
+    errs() << "!foreach requires an operator\n";
     assert(0 && "No operator for !foreach");
   }
 
   TypedInit *LHSt = dynamic_cast<TypedInit*>(LHS);
 
   if (!LHSt) {
-    cerr << "!foreach requires typed variable\n";
+    errs() << "!foreach requires typed variable\n";
     assert(0 && "No typed variable for !foreach");
   }
 
@@ -1308,9 +1307,9 @@
   assert(Value && "Cannot create unset value for current type!");
 }
 
-void RecordVal::dump() const { cerr << *this; }
+void RecordVal::dump() const { errs() << *this; }
 
-void RecordVal::print(std::ostream &OS, bool PrintSem) const {
+void RecordVal::print(raw_ostream &OS, bool PrintSem) const {
   if (getPrefix()) OS << "field ";
   OS << *getType() << " " << getName();
 
@@ -1343,9 +1342,9 @@
 }
 
 
-void Record::dump() const { cerr << *this; }
+void Record::dump() const { errs() << *this; }
 
-std::ostream &llvm::operator<<(std::ostream &OS, const Record &R) {
+raw_ostream &llvm::operator<<(raw_ostream &OS, const Record &R) {
   OS << R.getName();
 
   const std::vector<std::string> &TArgs = R.getTemplateArgs();
@@ -1556,10 +1555,10 @@
 
 
 void MultiClass::dump() const {
-  cerr << "Record:\n";
+  errs() << "Record:\n";
   Rec.dump();
   
-  cerr << "Defs:\n";
+  errs() << "Defs:\n";
   for (RecordVector::const_iterator r = DefPrototypes.begin(),
          rend = DefPrototypes.end();
        r != rend;
@@ -1569,9 +1568,9 @@
 }
 
 
-void RecordKeeper::dump() const { cerr << *this; }
+void RecordKeeper::dump() const { errs() << *this; }
 
-std::ostream &llvm::operator<<(std::ostream &OS, const RecordKeeper &RK) {
+raw_ostream &llvm::operator<<(raw_ostream &OS, const RecordKeeper &RK) {
   OS << "------------- Classes -----------------\n";
   const std::map<std::string, Record*> &Classes = RK.getClasses();
   for (std::map<std::string, Record*>::const_iterator I = Classes.begin(),

Modified: llvm/trunk/utils/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/Record.h (original)
+++ llvm/trunk/utils/TableGen/Record.h Thu Jul  2 19:10:29 2009
@@ -17,10 +17,11 @@
 
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/DataTypes.h"
+#include "llvm/Support/raw_ostream.h"
 #include <map>
-#include <ostream>
 
 namespace llvm {
+class raw_ostream;
   
 // RecTy subclasses.
 class BitRecTy;
@@ -65,7 +66,7 @@
   virtual ~RecTy() {}
 
   virtual std::string getAsString() const = 0;
-  void print(std::ostream &OS) const { OS << getAsString(); }
+  void print(raw_ostream &OS) const { OS << getAsString(); }
   void dump() const;
 
   /// typeIsConvertibleTo - Return true if all values of 'this' type can be
@@ -113,7 +114,7 @@
   virtual bool baseClassOf(const RecordRecTy *RHS) const { return false; }
 };
 
-inline std::ostream &operator<<(std::ostream &OS, const RecTy &Ty) {
+inline raw_ostream &operator<<(raw_ostream &OS, const RecTy &Ty) {
   Ty.print(OS);
   return OS;
 }
@@ -459,13 +460,13 @@
   virtual bool isComplete() const { return true; }
 
   /// print - Print out this value.
-  void print(std::ostream &OS) const { OS << getAsString(); }
+  void print(raw_ostream &OS) const { OS << getAsString(); }
 
   /// getAsString - Convert this value to a string form.
   virtual std::string getAsString() const = 0;
 
   /// dump - Debugging method that may be called through a debugger, just
-  /// invokes print on cerr.
+  /// invokes print on stderr.
   void dump() const;
 
   /// convertInitializerTo - This virtual function is a simple call-back
@@ -516,7 +517,7 @@
   }
 };
 
-inline std::ostream &operator<<(std::ostream &OS, const Init &I) {
+inline raw_ostream &operator<<(raw_ostream &OS, const Init &I) {
   I.print(OS); return OS;
 }
 
@@ -613,9 +614,9 @@
 
   // printXX - Print this bitstream with the specified format, returning true if
   // it is not possible.
-  bool printInHex(std::ostream &OS) const;
-  bool printAsVariable(std::ostream &OS) const;
-  bool printAsUnset(std::ostream &OS) const;
+  bool printInHex(raw_ostream &OS) const;
+  bool printAsVariable(raw_ostream &OS) const;
+  bool printAsUnset(raw_ostream &OS) const;
 };
 
 
@@ -1210,10 +1211,10 @@
   }
 
   void dump() const;
-  void print(std::ostream &OS, bool PrintSem = true) const;
+  void print(raw_ostream &OS, bool PrintSem = true) const;
 };
 
-inline std::ostream &operator<<(std::ostream &OS, const RecordVal &RV) {
+inline raw_ostream &operator<<(raw_ostream &OS, const RecordVal &RV) {
   RV.print(OS << "  ");
   return OS;
 }
@@ -1378,7 +1379,7 @@
   std::string getValueAsCode(const std::string &FieldName) const;
 };
 
-std::ostream &operator<<(std::ostream &OS, const Record &R);
+raw_ostream &operator<<(raw_ostream &OS, const Record &R);
 
 struct MultiClass {
   Record Rec;  // Placeholder for template args and Name.
@@ -1477,7 +1478,7 @@
 };
   
   
-std::ostream &operator<<(std::ostream &OS, const RecordKeeper &RK);
+raw_ostream &operator<<(raw_ostream &OS, const RecordKeeper &RK);
 
 extern RecordKeeper Records;
 

Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Thu Jul  2 19:10:29 2009
@@ -19,13 +19,12 @@
 #include "Record.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/Streams.h"
-#include <set>
 #include <algorithm>
+#include <set>
 using namespace llvm;
 
 // runEnums - Print out enum values for all of the registers.
-void RegisterInfoEmitter::runEnums(std::ostream &OS) {
+void RegisterInfoEmitter::runEnums(raw_ostream &OS) {
   CodeGenTarget Target;
   const std::vector<CodeGenRegister> &Registers = Target.getRegisters();
 
@@ -47,7 +46,7 @@
   OS << "} // End llvm namespace \n";
 }
 
-void RegisterInfoEmitter::runHeader(std::ostream &OS) {
+void RegisterInfoEmitter::runHeader(raw_ostream &OS) {
   EmitSourceFileHeader("Register Information Header Fragment", OS);
   CodeGenTarget Target;
   const std::string &TargetName = Target.getName();
@@ -118,9 +117,9 @@
                   std::map<Record*, std::set<Record*>, LessRecord> &SuperRegs,
                   std::map<Record*, std::set<Record*>, LessRecord> &Aliases) {
   if (R == S) {
-    cerr << "Error: recursive sub-register relationship between"
-         << " register " << getQualifiedName(R)
-         << " and its sub-registers?\n";
+    errs() << "Error: recursive sub-register relationship between"
+           << " register " << getQualifiedName(R)
+           << " and its sub-registers?\n";
     abort();
   }
   if (!SuperRegs[R].insert(S).second)
@@ -139,9 +138,9 @@
                    std::map<Record*, std::set<Record*>, LessRecord> &SuperRegs,
                    std::map<Record*, std::set<Record*>, LessRecord> &Aliases) {
   if (R == S) {
-    cerr << "Error: recursive sub-register relationship between"
-         << " register " << getQualifiedName(R)
-         << " and its sub-registers?\n";
+    errs() << "Error: recursive sub-register relationship between"
+           << " register " << getQualifiedName(R)
+           << " and its sub-registers?\n";
     abort();
   }
 
@@ -172,7 +171,7 @@
 
 // RegisterInfoEmitter::run - Main register file description emitter.
 //
-void RegisterInfoEmitter::run(std::ostream &OS) {
+void RegisterInfoEmitter::run(raw_ostream &OS) {
   CodeGenTarget Target;
   EmitSourceFileHeader("Register Information Source Fragment", OS);
 
@@ -450,15 +449,15 @@
     for (unsigned j = 0, e = LI.size(); j != e; ++j) {
       Record *Reg = LI[j];
       if (RegisterAliases[R].count(Reg))
-        cerr << "Warning: register alias between " << getQualifiedName(R)
-             << " and " << getQualifiedName(Reg)
-             << " specified multiple times!\n";
+        errs() << "Warning: register alias between " << getQualifiedName(R)
+               << " and " << getQualifiedName(Reg)
+               << " specified multiple times!\n";
       RegisterAliases[R].insert(Reg);
 
       if (RegisterAliases[Reg].count(R))
-        cerr << "Warning: register alias between " << getQualifiedName(R)
-             << " and " << getQualifiedName(Reg)
-             << " specified multiple times!\n";
+        errs() << "Warning: register alias between " << getQualifiedName(R)
+               << " and " << getQualifiedName(Reg)
+               << " specified multiple times!\n";
       RegisterAliases[Reg].insert(R);
     }
   }
@@ -471,9 +470,9 @@
     for (unsigned j = 0, e = LI.size(); j != e; ++j) {
       Record *SubReg = LI[j];
       if (RegisterSubRegs[R].count(SubReg))
-        cerr << "Warning: register " << getQualifiedName(SubReg)
-             << " specified as a sub-register of " << getQualifiedName(R)
-             << " multiple times!\n";
+        errs() << "Warning: register " << getQualifiedName(SubReg)
+               << " specified as a sub-register of " << getQualifiedName(R)
+               << " multiple times!\n";
       addSubSuperReg(R, SubReg, RegisterSubRegs, RegisterSuperRegs,
                      RegisterAliases);
     }
@@ -808,8 +807,8 @@
     std::vector<Record*> To   = SubRegs[i]->getValueAsListOfDefs("To");
     
     if (From.size() != To.size()) {
-      cerr << "Error: register list and sub-register list not of equal length"
-           << " in SubRegSet\n";
+      errs() << "Error: register list and sub-register list not of equal length"
+             << " in SubRegSet\n";
       exit(1);
     }
     
@@ -858,8 +857,8 @@
     std::vector<int64_t> RegNums = Reg->getValueAsListOfInts("DwarfNumbers");
     maxLength = std::max((size_t)maxLength, RegNums.size());
     if (DwarfRegNums.count(Reg))
-      cerr << "Warning: DWARF numbers for register " << getQualifiedName(Reg)
-           << "specified multiple times\n";
+      errs() << "Warning: DWARF numbers for register " << getQualifiedName(Reg)
+             << "specified multiple times\n";
     DwarfRegNums[Reg] = RegNums;
   }
 

Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/RegisterInfoEmitter.h (original)
+++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.h Thu Jul  2 19:10:29 2009
@@ -26,13 +26,13 @@
   RegisterInfoEmitter(RecordKeeper &R) : Records(R) {}
 
   // run - Output the register file description, returning true on failure.
-  void run(std::ostream &o);
+  void run(raw_ostream &o);
 
   // runHeader - Emit a header fragment for the register info emitter.
-  void runHeader(std::ostream &o);
+  void runHeader(raw_ostream &o);
 
   // runEnums - Print out enum values for all of the registers.
-  void runEnums(std::ostream &o);
+  void runEnums(raw_ostream &o);
 };
 
 } // End llvm namespace

Modified: llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SubtargetEmitter.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/SubtargetEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/SubtargetEmitter.cpp Thu Jul  2 19:10:29 2009
@@ -22,7 +22,7 @@
 //
 // Enumeration - Emit the specified class as an enumeration.
 //
-void SubtargetEmitter::Enumeration(std::ostream &OS,
+void SubtargetEmitter::Enumeration(raw_ostream &OS,
                                    const char *ClassName,
                                    bool isBits) {
   // Get all records of class and sort
@@ -57,7 +57,7 @@
 // FeatureKeyValues - Emit data of all the subtarget features.  Used by the
 // command line.
 //
-void SubtargetEmitter::FeatureKeyValues(std::ostream &OS) {
+void SubtargetEmitter::FeatureKeyValues(raw_ostream &OS) {
   // Gather and sort all the features
   std::vector<Record*> FeatureList =
                            Records.getAllDerivedDefinitions("SubtargetFeature");
@@ -117,7 +117,7 @@
 // CPUKeyValues - Emit data of all the subtarget processors.  Used by command
 // line.
 //
-void SubtargetEmitter::CPUKeyValues(std::ostream &OS) {
+void SubtargetEmitter::CPUKeyValues(raw_ostream &OS) {
   // Gather and sort processor information
   std::vector<Record*> ProcessorList =
                           Records.getAllDerivedDefinitions("Processor");
@@ -172,7 +172,7 @@
 // CollectAllItinClasses - Gathers and enumerates all the itinerary classes.
 // Returns itinerary class count.
 //
-unsigned SubtargetEmitter::CollectAllItinClasses(std::ostream &OS,
+unsigned SubtargetEmitter::CollectAllItinClasses(raw_ostream &OS,
                               std::map<std::string, unsigned> &ItinClassesMap) {
   // Gather and sort all itinerary classes
   std::vector<Record*> ItinClassList =
@@ -239,7 +239,7 @@
 // EmitStageData - Generate unique itinerary stages.  Record itineraries for 
 // processors.
 //
-void SubtargetEmitter::EmitStageData(std::ostream &OS,
+void SubtargetEmitter::EmitStageData(raw_ostream &OS,
        unsigned NItinClasses,
        std::map<std::string, unsigned> &ItinClassesMap, 
        std::vector<std::vector<InstrItinerary> > &ProcList) {
@@ -326,7 +326,7 @@
 //
 // EmitProcessorData - Generate data for processor itineraries.
 //
-void SubtargetEmitter::EmitProcessorData(std::ostream &OS,
+void SubtargetEmitter::EmitProcessorData(raw_ostream &OS,
       std::vector<std::vector<InstrItinerary> > &ProcList) {
   // Get an iterator for processor itinerary stages
   std::vector<std::vector<InstrItinerary> >::iterator
@@ -375,7 +375,7 @@
 //
 // EmitProcessorLookup - generate cpu name to itinerary lookup table.
 //
-void SubtargetEmitter::EmitProcessorLookup(std::ostream &OS) {
+void SubtargetEmitter::EmitProcessorLookup(raw_ostream &OS) {
   // Gather and sort processor information
   std::vector<Record*> ProcessorList =
                           Records.getAllDerivedDefinitions("Processor");
@@ -421,7 +421,7 @@
 //
 // EmitData - Emits all stages and itineries, folding common patterns.
 //
-void SubtargetEmitter::EmitData(std::ostream &OS) {
+void SubtargetEmitter::EmitData(raw_ostream &OS) {
   std::map<std::string, unsigned> ItinClassesMap;
   std::vector<std::vector<InstrItinerary> > ProcList;
   
@@ -444,7 +444,7 @@
 // ParseFeaturesFunction - Produces a subtarget specific function for parsing
 // the subtarget features string.
 //
-void SubtargetEmitter::ParseFeaturesFunction(std::ostream &OS) {
+void SubtargetEmitter::ParseFeaturesFunction(raw_ostream &OS) {
   std::vector<Record*> Features =
                        Records.getAllDerivedDefinitions("SubtargetFeature");
   std::sort(Features.begin(), Features.end(), LessRecord());
@@ -489,7 +489,7 @@
 //
 // SubtargetEmitter::run - Main subtarget enumeration emitter.
 //
-void SubtargetEmitter::run(std::ostream &OS) {
+void SubtargetEmitter::run(raw_ostream &OS) {
   Target = CodeGenTarget().getName();
 
   EmitSourceFileHeader("Subtarget Enumeration Source Fragment", OS);

Modified: llvm/trunk/utils/TableGen/SubtargetEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SubtargetEmitter.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/SubtargetEmitter.h (original)
+++ llvm/trunk/utils/TableGen/SubtargetEmitter.h Thu Jul  2 19:10:29 2009
@@ -29,27 +29,27 @@
   std::string Target;
   bool HasItineraries;
   
-  void Enumeration(std::ostream &OS, const char *ClassName, bool isBits);
-  void FeatureKeyValues(std::ostream &OS);
-  void CPUKeyValues(std::ostream &OS);
-  unsigned CollectAllItinClasses(std::ostream &OS,
+  void Enumeration(raw_ostream &OS, const char *ClassName, bool isBits);
+  void FeatureKeyValues(raw_ostream &OS);
+  void CPUKeyValues(raw_ostream &OS);
+  unsigned CollectAllItinClasses(raw_ostream &OS,
                                std::map<std::string, unsigned> &ItinClassesMap);
   void FormItineraryString(Record *ItinData, std::string &ItinString,
                            unsigned &NStages);
-  void EmitStageData(std::ostream &OS, unsigned NItinClasses,
+  void EmitStageData(raw_ostream &OS, unsigned NItinClasses,
                      std::map<std::string, unsigned> &ItinClassesMap,
                      std::vector<std::vector<InstrItinerary> > &ProcList);
-  void EmitProcessorData(std::ostream &OS,
+  void EmitProcessorData(raw_ostream &OS,
                        std::vector<std::vector<InstrItinerary> > &ProcList);
-  void EmitProcessorLookup(std::ostream &OS);
-  void EmitData(std::ostream &OS);
-  void ParseFeaturesFunction(std::ostream &OS);
+  void EmitProcessorLookup(raw_ostream &OS);
+  void EmitData(raw_ostream &OS);
+  void ParseFeaturesFunction(raw_ostream &OS);
   
 public:
   SubtargetEmitter(RecordKeeper &R) : Records(R), HasItineraries(false) {}
 
   // run - Output the subtarget enumerations, returning true on failure.
-  void run(std::ostream &o);
+  void run(raw_ostream &o);
 
 };
 

Modified: llvm/trunk/utils/TableGen/TGLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TGLexer.cpp (original)
+++ llvm/trunk/utils/TableGen/TGLexer.cpp Thu Jul  2 19:10:29 2009
@@ -13,7 +13,6 @@
 
 #include "TGLexer.h"
 #include "llvm/Support/SourceMgr.h"
-#include "llvm/Support/Streams.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Config/config.h"
 #include <cctype>

Modified: llvm/trunk/utils/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TGParser.cpp (original)
+++ llvm/trunk/utils/TableGen/TGParser.cpp Thu Jul  2 19:10:29 2009
@@ -11,13 +11,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include <algorithm>
-#include <sstream>
-
 #include "TGParser.h"
 #include "Record.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/Streams.h"
+#include <algorithm>
+#include <sstream>
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
@@ -45,11 +43,11 @@
 };
 
 void SubMultiClassReference::dump() const {
-  cerr << "Multiclass:\n";
+  errs() << "Multiclass:\n";
  
   MC->dump();
  
-  cerr << "Template args:\n";
+  errs() << "Template args:\n";
   for (std::vector<Init *>::const_iterator i = TemplateArgs.begin(),
          iend = TemplateArgs.end();
        i != iend;

Modified: llvm/trunk/utils/TableGen/TGValueTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGValueTypes.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TGValueTypes.cpp (original)
+++ llvm/trunk/utils/TableGen/TGValueTypes.cpp Thu Jul  2 19:10:29 2009
@@ -15,7 +15,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/CodeGen/ValueTypes.h"
-#include "llvm/Support/Streams.h"
 #include <map>
 #include <vector>
 using namespace llvm;

Modified: llvm/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TableGen.cpp (original)
+++ llvm/trunk/utils/TableGen/TableGen.cpp Thu Jul  2 19:10:29 2009
@@ -18,11 +18,11 @@
 #include "Record.h"
 #include "TGParser.h"
 #include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Streams.h"
 #include "llvm/System/Signals.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/raw_ostream.h"
 #include "CallingConvEmitter.h"
 #include "CodeEmitterGen.h"
 #include "RegisterInfoEmitter.h"
@@ -37,8 +37,6 @@
 #include "ClangDiagnosticsEmitter.h"
 #include <algorithm>
 #include <cstdio>
-#include <fstream>
-#include <ios>
 using namespace llvm;
 
 enum ActionType {
@@ -140,7 +138,8 @@
   std::string ErrorStr;
   MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), &ErrorStr);
   if (F == 0) {
-    cerr << "Could not open input file '" + Filename + "': " << ErrorStr <<"\n";
+    errs() << "Could not open input file '" + Filename + "': " 
+           << ErrorStr <<"\n";
     return true;
   }
   
@@ -166,12 +165,14 @@
   if (ParseFile(InputFilename, IncludeDirs, SrcMgr))
     return 1;
 
-  std::ostream *Out = cout.stream();
+  raw_ostream *Out = &outs();
   if (OutputFilename != "-") {
-    Out = new std::ofstream(OutputFilename.c_str());
+    std::string Error;
+    Out = new raw_fd_ostream(OutputFilename.c_str(), false, Error);
 
-    if (!Out->good()) {
-      cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
+    if (!Error.empty()) {
+      errs() << argv[0] << ": error opening " << OutputFilename 
+             << ":" << Error << "\n";
       return 1;
     }
 
@@ -246,23 +247,23 @@
       return 1;
     }
     
-    if (Out != cout.stream()) 
+    if (Out != &outs())
       delete Out;                               // Close the file
     return 0;
     
   } catch (const TGError &Error) {
-    cerr << argv[0] << ": error:\n";
+    errs() << argv[0] << ": error:\n";
     PrintError(Error.getLoc(), Error.getMessage());
     
   } catch (const std::string &Error) {
-    cerr << argv[0] << ": " << Error << "\n";
+    errs() << argv[0] << ": " << Error << "\n";
   } catch (const char *Error) {
-    cerr << argv[0] << ": " << Error << "\n";
+    errs() << argv[0] << ": " << Error << "\n";
   } catch (...) {
-    cerr << argv[0] << ": Unknown unexpected exception occurred.\n";
+    errs() << argv[0] << ": Unknown unexpected exception occurred.\n";
   }
   
-  if (Out != cout.stream()) {
+  if (Out != &outs()) {
     delete Out;                             // Close the file
     std::remove(OutputFilename.c_str());    // Remove the file, it's broken
   }

Modified: llvm/trunk/utils/TableGen/TableGenBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGenBackend.cpp?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TableGenBackend.cpp (original)
+++ llvm/trunk/utils/TableGen/TableGenBackend.cpp Thu Jul  2 19:10:29 2009
@@ -16,7 +16,7 @@
 using namespace llvm;
 
 void TableGenBackend::EmitSourceFileHeader(const std::string &Desc,
-                                           std::ostream &OS) const {
+                                           raw_ostream &OS) const {
   OS << "//===- TableGen'erated file -------------------------------------*-"
        " C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
        "d file, do not edit!\n//\n//===------------------------------------"

Modified: llvm/trunk/utils/TableGen/TableGenBackend.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGenBackend.h?rev=74742&r1=74741&r2=74742&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TableGenBackend.h (original)
+++ llvm/trunk/utils/TableGen/TableGenBackend.h Thu Jul  2 19:10:29 2009
@@ -15,8 +15,8 @@
 #ifndef TABLEGENBACKEND_H
 #define TABLEGENBACKEND_H
 
+#include "llvm/Support/raw_ostream.h"
 #include <string>
-#include <iosfwd>
 
 namespace llvm {
 
@@ -28,13 +28,13 @@
 
   // run - All TableGen backends should implement the run method, which should
   // be the main entry point.
-  virtual void run(std::ostream &OS) = 0;
+  virtual void run(raw_ostream &OS) = 0;
 
 
 public:   // Useful helper routines...
   /// EmitSourceFileHeader - Output a LLVM style file header to the specified
   /// ostream.
-  void EmitSourceFileHeader(const std::string &Desc, std::ostream &OS) const;
+  void EmitSourceFileHeader(const std::string &Desc, raw_ostream &OS) const;
 
 };
 





More information about the llvm-commits mailing list