Change Pass::print to take a raw ostream instead of std::ostream,
authorChris Lattner <sabre@nondot.org>
Sun, 23 Aug 2009 06:03:38 +0000 (06:03 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 23 Aug 2009 06:03:38 +0000 (06:03 +0000)
update all code that this affects.

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

50 files changed:
include/llvm/Analysis/CallGraph.h
include/llvm/Analysis/Dominators.h
include/llvm/Analysis/FindUsedTypes.h
include/llvm/Analysis/Interval.h
include/llvm/Analysis/IntervalPartition.h
include/llvm/Analysis/LoopInfo.h
include/llvm/Analysis/LoopVR.h
include/llvm/Analysis/PostDominators.h
include/llvm/Analysis/ScalarEvolution.h
include/llvm/CodeGen/LiveIntervalAnalysis.h
include/llvm/CodeGen/LiveStackAnalysis.h
include/llvm/CodeGen/MachineDominators.h
include/llvm/Pass.h
include/llvm/Support/ConstantRange.h
include/llvm/Support/PassNameParser.h
include/llvm/Support/raw_ostream.h
lib/Analysis/CFGPrinter.cpp
lib/Analysis/IPA/Andersens.cpp
lib/Analysis/IPA/CallGraph.cpp
lib/Analysis/IPA/CallGraphSCCPass.cpp
lib/Analysis/IPA/FindUsedTypes.cpp
lib/Analysis/InstCount.cpp
lib/Analysis/Interval.cpp
lib/Analysis/IntervalPartition.cpp
lib/Analysis/LoopInfo.cpp
lib/Analysis/LoopVR.cpp
lib/Analysis/PostDominators.cpp
lib/Analysis/ScalarEvolution.cpp
lib/CodeGen/GCMetadata.cpp
lib/CodeGen/GCStrategy.cpp
lib/CodeGen/IntrinsicLowering.cpp
lib/CodeGen/LiveIntervalAnalysis.cpp
lib/CodeGen/LiveStackAnalysis.cpp
lib/CodeGen/MachineDominators.cpp
lib/CodeGen/PreAllocSplitting.cpp
lib/CodeGen/SelectionDAG/CallingConvLower.cpp
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/CodeGen/SimpleRegisterCoalescing.cpp
lib/CodeGen/SimpleRegisterCoalescing.h
lib/Support/ConstantRange.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Transforms/Utils/AddrModeMatcher.cpp
lib/VMCore/Dominators.cpp
lib/VMCore/Pass.cpp
tools/opt/AnalysisWrappers.cpp
tools/opt/GraphPrinters.cpp
tools/opt/PrintSCC.cpp
tools/opt/opt.cpp
utils/TableGen/DAGISelEmitter.cpp

index de839694dc8a3d812635c6321eeab54683856d45..c36cb22780e295c90a08bce34557fc6fc46fc1a4 100644 (file)
@@ -155,9 +155,7 @@ public:
   ///
   void initialize(Module &M);
 
-  virtual void print(std::ostream &o, const Module *M) const;
-  void print(std::ostream *o, const Module *M) const { if (o) print(*o, M); }
-  void dump() const;
+  void print(raw_ostream &o, Module *) const;
 
 protected:
   // destroy - Release memory for the call graph
@@ -202,8 +200,7 @@ public:
   /// dump - Print out this call graph node.
   ///
   void dump() const;
-  void print(std::ostream &OS) const;
-  void print(std::ostream *OS) const { if (OS) print(*OS); }
+  void print(raw_ostream &OS) const;
 
   //===---------------------------------------------------------------------
   // Methods to keep a call graph up to date with a function that has been
index 094fecf107d1f6efe4d320a4f8c5ba12090b89cd..412f8ccf6da9845622088bae42f383809aabbc56 100644 (file)
@@ -22,7 +22,6 @@
 #define LLVM_ANALYSIS_DOMINATORS_H
 
 #include "llvm/Pass.h"
-#include "llvm/BasicBlock.h"
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
 #include "llvm/ADT/DenseMap.h"
@@ -830,7 +829,7 @@ public:
     DT->releaseMemory();
   }
   
-  virtual void print(std::ostream &OS, const Module* M= 0) const;
+  virtual void print(raw_ostream &OS, const Module* M= 0) const;
 };
 
 //===-------------------------------------
@@ -978,7 +977,7 @@ public:
 
   /// print - Convert to human readable form
   ///
-  virtual void print(std::ostream &OS, const Module* = 0) const;
+  virtual void print(raw_ostream &OS, const Module* = 0) const;
 };
 
 
index c897af3a58a63a902af8173e38ffc4b999fcc467..1337385848ed3e107d8c1951f283acfc19f7b9d3 100644 (file)
@@ -37,8 +37,7 @@ public:
   /// passed in, then the types are printed symbolically if possible, using the
   /// symbol table from the module.
   ///
-  void print(std::ostream &o, const Module *M) const;
-  void print(std::ostream *o, const Module *M) const { if (o) print(*o, M); }
+  void print(raw_ostream &o, const Module *M) const;
 
 private:
   /// IncorporateType - Incorporate one type and all of its subtypes into the
index 1da2022f69617caa13d389634f7bd60ffdc0a330..ca8ad73131a9d9169ccd573421c02916877a1976 100644 (file)
 
 #include "llvm/ADT/GraphTraits.h"
 #include <vector>
-#include <iosfwd>
 
 namespace llvm {
 
 class BasicBlock;
+class raw_ostream;
 
 //===----------------------------------------------------------------------===//
 //
@@ -98,8 +98,7 @@ public:
   bool isLoop() const;
 
   /// print - Show contents in human readable format...
-  void print(std::ostream &O) const;
-  void print(std::ostream *O) const { if (O) print(*O); }
+  void print(raw_ostream &O) const;
 };
 
 /// succ_begin/succ_end - define methods so that Intervals may be used
index feae6d82f82f5a3cfc10d891321f74ed3d92ee9a..c1214e7427a4a4b2a9205992d06e9a3374157482 100644 (file)
@@ -60,10 +60,7 @@ public:
   IntervalPartition(IntervalPartition &I, bool);
 
   // print - Show contents in human readable format...
-  virtual void print(std::ostream &O, const Module* = 0) const;
-  void print(std::ostream *O, const Module* M = 0) const {
-    if (O) print(*O, M);
-  }
+  virtual void print(raw_ostream &O, const Module* = 0) const;
 
   // getRootInterval() - Return the root interval that contains the starting
   // block of the function.
index 54352262830a29c8c29f763617f8e3e3f44ba7dd..3a09e7b058586ecd8b546a6d6d6d76ec82d6b201 100644 (file)
@@ -938,7 +938,7 @@ public:
 
   virtual void releaseMemory() { LI.releaseMemory(); }
 
-  virtual void print(std::ostream &O, const Module* M = 0) const;
+  virtual void print(raw_ostream &O, const Module* M = 0) const;
   
   virtual void getAnalysisUsage(AnalysisUsage &AU) const;
 
index a9f6636d79b07440f0aec5069b9dc68ac311683d..3b098e6ca10b5b972eac8673985955922856c835 100644 (file)
@@ -17,7 +17,6 @@
 #include "llvm/Pass.h"
 #include "llvm/Analysis/ScalarEvolution.h"
 #include "llvm/Support/ConstantRange.h"
-#include <iosfwd>
 #include <map>
 
 namespace llvm {
@@ -33,7 +32,7 @@ public:
   LoopVR() : FunctionPass(&ID) {}
 
   bool runOnFunction(Function &F);
-  virtual void print(std::ostream &os, const Module *) const;
+  virtual void print(raw_ostream &os, const Module *) const;
   void releaseMemory();
 
   void getAnalysisUsage(AnalysisUsage &AU) const;
index ff579e3c4a31162b0094da8d96ba78c667c82b5c..6c9e05fd4b25f5b8fdabc59f8af4619a5d1a0a14 100644 (file)
@@ -57,7 +57,7 @@ struct PostDominatorTree : public FunctionPass {
     return DT->properlyDominates(A, B);
   }
 
-  virtual void print(std::ostream &OS, const Module*) const;
+  virtual void print(raw_ostream &OS, const Module*) const;
 };
 
 FunctionPass* createPostDomTree();
index 558cd011f5e5ed42bce3978b5386ee9dc0446d29..ea25853edaaca2519f3622191f0ec996ca450739 100644 (file)
@@ -601,11 +601,7 @@ namespace llvm {
     virtual bool runOnFunction(Function &F);
     virtual void releaseMemory();
     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
-    void print(raw_ostream &OS, const Module* = 0) const;
-    virtual void print(std::ostream &OS, const Module* = 0) const;
-    void print(std::ostream *OS, const Module* M = 0) const {
-      if (OS) print(*OS, M);
-    }
+    virtual void print(raw_ostream &OS, const Module* = 0) const;
 
   private:
     FoldingSet<SCEV> UniqueSCEVs;
index b20cc6e2121a29f12535e64c1dea08d98eafac08..da9ff30edfbd46d01aad04e1dede3415b8c39e31 100644 (file)
@@ -347,7 +347,7 @@ namespace llvm {
     virtual bool runOnMachineFunction(MachineFunction&);
 
     /// print - Implement the dump method.
-    virtual void print(std::ostream &O, const Module* = 0) const;
+    virtual void print(raw_ostream &O, const Module* = 0) const;
 
     /// addIntervalsForSpills - Create new intervals for spilled defs / uses of
     /// the given interval. FIXME: It also returns the weight of the spill slot
index 3d4dbf937075436c30485b82cff32788c21cf2cf..d63a222475c6728667689b7d072c5ec609bc8bc7 100644 (file)
@@ -102,7 +102,7 @@ namespace llvm {
     virtual bool runOnMachineFunction(MachineFunction&);
 
     /// print - Implement the dump method.
-    virtual void print(std::ostream &O, const Module* = 0) const;
+    virtual void print(raw_ostream &O, const Module* = 0) const;
   };
 }
 
index 1439b1bdfe5988006f4e1cdd66709a77baeed667..e56776b1440c8bf8e030ee6dcc773cf9c123379c 100644 (file)
@@ -162,7 +162,7 @@ public:
   
   virtual void releaseMemory();
   
-  virtual void print(std::ostream &OS, const Module*) const;
+  virtual void print(raw_ostream &OS, const Module*) const;
 };
 
 //===-------------------------------------
index 374b933095bb22f090cd889736c31ccd7f62d7da..a214e4fcdd02feddba16fdf0c4ade387beab3655 100644 (file)
@@ -30,9 +30,7 @@
 #define LLVM_PASS_H
 
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/Streams.h"
 #include <cassert>
-#include <iosfwd>
 #include <utility>
 #include <vector>
 
@@ -47,6 +45,7 @@ class ImmutablePass;
 class PMStack;
 class AnalysisResolver;
 class PMDataManager;
+class raw_ostream;
 
 // AnalysisID - Use the PassInfo to identify a pass...
 typedef const PassInfo* AnalysisID;
@@ -103,8 +102,7 @@ public:
   /// provide the Module* in case the analysis doesn't need it it can just be
   /// ignored.
   ///
-  virtual void print(std::ostream &O, const Module *M) const;
-  void print(std::ostream *O, const Module *M) const { if (O) print(*O, M); }
+  virtual void print(raw_ostream &O, const Module *M) const;
   void dump() const; // dump - Print to stderr.
 
   /// Each pass is responsible for assigning a pass manager to itself.
@@ -202,9 +200,6 @@ public:
   AnalysisType &getAnalysisID(const PassInfo *PI, Function &F);
 };
 
-inline std::ostream &operator<<(std::ostream &OS, const Pass &P) {
-  P.print(OS, 0); return OS;
-}
 
 //===----------------------------------------------------------------------===//
 /// ModulePass class - This class is used to implement unstructured
index 3b72b0430fb3ae934e09d0a98c5a2acf2bc7d0b9..e9c8c7cb2e14e9357a45d552f2b7abf6df4a0326 100644 (file)
@@ -223,8 +223,6 @@ inline raw_ostream &operator<<(raw_ostream &OS, const ConstantRange &CR) {
   return OS;
 }
 
-std::ostream &operator<<(std::ostream &OS, const ConstantRange &CR);
-
 } // End llvm namespace
 
 #endif
index a437e2048ec7e184955a20971b2366bafa06ccaa..66ce3f2e2085c1c67e6c9d38946371431911a177 100644 (file)
@@ -66,7 +66,7 @@ public:
   virtual void passRegistered(const PassInfo *P) {
     if (ignorablePass(P) || !Opt) return;
     if (findOption(P->getPassArgument()) != getNumOptions()) {
-      cerr << "Two passes with the same argument (-"
+      errs() << "Two passes with the same argument (-"
            << P->getPassArgument() << ") attempted to be registered!\n";
       llvm_unreachable(0);
     }
index d9d023cc27350e95cea8f9ebab74ebc657c65897..c2252dcb04e3ca41707732ba62220eaeb7d40d98 100644 (file)
@@ -196,7 +196,6 @@ public:
 
   raw_ostream &operator<<(const std::string &Str) {
     // Avoid the fast path, it would only increase code size for a marginal win.
-
     write(Str.data(), Str.length());
     return *this;
   }
@@ -220,6 +219,7 @@ public:
     this->operator<<(ftostr(N));
     return *this;
   }
+  
 
   /// write_hex - Output \arg N in hexadecimal, without any prefix or padding.
   raw_ostream &write_hex(unsigned long long N);
index 2364d984f9279b24a3f954fcea27dbed7183d6a5..f6ecfc596f55000eb069133e29701c03c6c7ace2 100644 (file)
@@ -26,9 +26,6 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/GraphWriter.h"
 #include "llvm/Config/config.h"
-#include <iosfwd>
-#include <sstream>
-#include <fstream>
 using namespace llvm;
 
 namespace llvm {
@@ -96,7 +93,7 @@ namespace {
       return false;
     }
 
-    void print(std::ostream &OS, const Module* = 0) const {}
+    void print(raw_ostream &OS, const Module* = 0) const {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
@@ -118,7 +115,7 @@ namespace {
       return false;
     }
 
-    void print(std::ostream &OS, const Module* = 0) const {}
+    void print(raw_ostream &OS, const Module* = 0) const {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
@@ -150,7 +147,7 @@ namespace {
       return false;
     }
 
-    void print(std::ostream &OS, const Module* = 0) const {}
+    void print(raw_ostream &OS, const Module* = 0) const {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
@@ -179,7 +176,7 @@ namespace {
       cerr << "\n";
       return false;
     }
-    void print(std::ostream &OS, const Module* = 0) const {}
+    void print(raw_ostream &OS, const Module* = 0) const {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
index 02b4c9ac6fcf896576d188d439e59ecfe76b3530..966e87c4cb28e3f1a40c1379287b07db44c5f577 100644 (file)
@@ -607,7 +607,7 @@ namespace {
     //===------------------------------------------------------------------===//
     // Implement Analyize interface
     //
-    void print(std::ostream &O, const Module* M) const {
+    void print(raw_ostream &O, const Module*) const {
       PrintPointsToGraph();
     }
   };
index 4d15a48d4e18baa1a1098a129a5e867d86a46b7a..f03e4b2ba24639fef15aa5139c1a6558b9702b1e 100644 (file)
@@ -18,8 +18,7 @@
 #include "llvm/IntrinsicInst.h"
 #include "llvm/Support/CallSite.h"
 #include "llvm/Support/Compiler.h"
-#include "llvm/Support/Streams.h"
-#include <ostream>
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 namespace {
@@ -68,30 +67,21 @@ public:
     AU.setPreservesAll();
   }
 
-  void print(std::ostream *o, const Module *M) const {
-    if (o) print(*o, M);
-  }
-
-  virtual void print(std::ostream &o, const Module *M) const {
-    o << "CallGraph Root is: ";
+  virtual void print(raw_ostream &OS, const Module *) const {
+    OS << "CallGraph Root is: ";
     if (Function *F = getRoot()->getFunction())
-      o << F->getNameStr() << "\n";
-    else
-      o << "<<null function: 0x" << getRoot() << ">>\n";
+      OS << F->getName() << "\n";
+    else {
+      OS << "<<null function: 0x" << getRoot() << ">>\n";
+    }
     
-    CallGraph::print(o, M);
+    CallGraph::print(OS, 0);
   }
 
   virtual void releaseMemory() {
     destroy();
   }
   
-  /// dump - Print out this call graph.
-  ///
-  inline void dump() const {
-    print(cerr, Mod);
-  }
-
   CallGraphNode* getExternalCallingNode() const { return ExternalCallingNode; }
   CallGraphNode* getCallsExternalNode()   const { return CallsExternalNode; }
 
@@ -187,15 +177,11 @@ void CallGraph::destroy() {
   }
 }
 
-void CallGraph::print(std::ostream &OS, const Module *M) const {
+void CallGraph::print(raw_ostream &OS, Module*) const {
   for (CallGraph::const_iterator I = begin(), E = end(); I != E; ++I)
     I->second->print(OS);
 }
 
-void CallGraph::dump() const {
-  print(cerr, 0);
-}
-
 //===----------------------------------------------------------------------===//
 // Implementations of public modification methods
 //
@@ -242,21 +228,21 @@ CallGraphNode *CallGraph::getOrInsertFunction(const Function *F) {
   return CGN = new CallGraphNode(const_cast<Function*>(F));
 }
 
-void CallGraphNode::print(std::ostream &OS) const {
+void CallGraphNode::print(raw_ostream &OS) const {
   if (Function *F = getFunction())
-    OS << "Call graph node for function: '" << F->getNameStr() <<"'\n";
+    OS << "Call graph node for function: '" << F->getName() <<"'\n";
   else
     OS << "Call graph node <<null function: 0x" << this << ">>:\n";
 
   for (const_iterator I = begin(), E = end(); I != E; ++I)
     if (Function *FI = I->second->getFunction())
-      OS << "  Calls function '" << FI->getNameStr() <<"'\n";
+      OS << "  Calls function '" << FI->getName() <<"'\n";
   else
     OS << "  Calls external node\n";
   OS << "\n";
 }
 
-void CallGraphNode::dump() const { print(cerr); }
+void CallGraphNode::dump() const { print(errs()); }
 
 /// removeCallEdgeFor - This method removes the edge in the node for the
 /// specified call site.  Note that this method takes linear time, so it
index df2f0f8bd6954afe1b1a6f552962763065d002bc..00eddc4de870e2626706a9bec3c295b408eeda5c 100644 (file)
@@ -20,6 +20,7 @@
 #include "llvm/ADT/SCCIterator.h"
 #include "llvm/PassManagers.h"
 #include "llvm/Function.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
@@ -56,7 +57,7 @@ public:
 
   // Print passes managed by this manager
   void dumpPassStructure(unsigned Offset) {
-    llvm::cerr << std::string(Offset*2, ' ') << "Call Graph SCC Pass Manager\n";
+    errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n";
     for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
       Pass *P = getContainedPass(Index);
       P->dumpPassStructure(Offset + 1);
@@ -65,9 +66,8 @@ public:
   }
 
   Pass *getContainedPass(unsigned N) {
-    assert ( N < PassVector.size() && "Pass number out of range!");
-    Pass *FP = static_cast<Pass *>(PassVector[N]);
-    return FP;
+    assert(N < PassVector.size() && "Pass number out of range!");
+    return static_cast<Pass *>(PassVector[N]);
   }
 
   virtual PassManagerType getPassManagerType() const { 
index 920ee374555f7cf6027eff25f5a42c2853f3598a..c4fb0b9a4e3ddc8fee591159df4ed6ebe93d9012 100644 (file)
@@ -92,13 +92,12 @@ bool FindUsedTypes::runOnModule(Module &m) {
 // passed in, then the types are printed symbolically if possible, using the
 // symbol table from the module.
 //
-void FindUsedTypes::print(std::ostream &OS, const Module *M) const {
-  raw_os_ostream RO(OS);
-  RO << "Types in use by this module:\n";
+void FindUsedTypes::print(raw_ostream &OS, const Module *M) const {
+  OS << "Types in use by this module:\n";
   for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
        E = UsedTypes.end(); I != E; ++I) {
-    RO << "   ";
-    WriteTypeSymbolic(RO, *I, M);
-    RO << '\n';
+    OS << "   ";
+    WriteTypeSymbolic(OS, *I, M);
+    OS << '\n';
   }
 }
index b0db671724c7b2f42908e3444f98d217a60847d1..83724caf521060b3f26edb1c6f9b274601a4d9e2 100644 (file)
@@ -59,7 +59,7 @@ namespace {
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
     }
-    virtual void print(std::ostream &O, const Module *M) const {}
+    virtual void print(raw_ostream &O, const Module *M) const {}
 
   };
 }
index 6a6b1b2048eac284a369503bb3f66f0d51da5362..ca9cdcaf246484c302d6b53345426b88c152771d 100644 (file)
@@ -37,8 +37,7 @@ bool Interval::isLoop() const {
 }
 
 
-void Interval::print(std::ostream &O) const {
-  raw_os_ostream OS(O);
+void Interval::print(raw_ostream &OS) const {
   OS << "-------------------------------------------------------------\n"
        << "Interval Contents:\n";
 
index cb8a85da552a39d93ab9ca777e75cc113f923def..1f17b77a5b96f91649cfa64c5f9dc4f09bd8bc68 100644 (file)
@@ -32,7 +32,7 @@ void IntervalPartition::releaseMemory() {
   RootInterval = 0;
 }
 
-void IntervalPartition::print(std::ostream &O, const Module*) const {
+void IntervalPartition::print(raw_ostream &O, const Module*) const {
   for(unsigned i = 0, e = Intervals.size(); i != e; ++i)
     Intervals[i]->print(O);
 }
index 75d89af2a59a13727b235503017adca3dcde5016..5939dea4c0de3f44cb02b711b92e8744eaae6ba5 100644 (file)
@@ -309,8 +309,7 @@ void LoopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addRequired<DominatorTree>();
 }
 
-void LoopInfo::print(std::ostream &OS, const Module*) const {
-  raw_os_ostream OSS(OS);
-  LI.print(OSS);
+void LoopInfo::print(raw_ostream &OS, const Module*) const {
+  LI.print(OS);
 }
 
index bae02015c65ffe846a8caf160b1d31a1cd2cc466..573bd3ea01620ca6df2425e9a26a956eea88ffce 100644 (file)
@@ -228,8 +228,7 @@ void LoopVR::getAnalysisUsage(AnalysisUsage &AU) const {
 
 bool LoopVR::runOnFunction(Function &F) { Map.clear(); return false; }
 
-void LoopVR::print(std::ostream &os, const Module *) const {
-  raw_os_ostream OS(os);
+void LoopVR::print(raw_ostream &OS, const Module *) const {
   for (std::map<Value *, ConstantRange *>::const_iterator I = Map.begin(),
        E = Map.end(); I != E; ++I) {
     OS << *I->first << ": " << *I->second << '\n';
index 69522e8a39dd68dae5defd23f08ac754d8740f91..69d6b47bbee49cd42264edce511ea2680e2a94e6 100644 (file)
@@ -41,9 +41,8 @@ PostDominatorTree::~PostDominatorTree() {
   delete DT;
 }
 
-void PostDominatorTree::print(std::ostream &OS, const Module *) const {
-  raw_os_ostream OSS(OS);
-  DT->print(OSS);
+void PostDominatorTree::print(raw_ostream &OS, const Module *) const {
+  DT->print(OS);
 }
 
 
index d2c3f58e9cfd40e6b5f6f6f0d66e6e426852fdd0..d5849b0e1d86151ec232ff3b97e2e77919d94ee2 100644 (file)
@@ -5193,7 +5193,3 @@ void ScalarEvolution::print(raw_ostream &OS, const Module* ) const {
     PrintLoopInfo(OS, &SE, *I);
 }
 
-void ScalarEvolution::print(std::ostream &o, const Module *M) const {
-  raw_os_ostream OS(o);
-  print(OS, M);
-}
index a2a7fa192c883b50f3cd268ce83c11d333d08140..a57296c2a67f4cca2e76daef7b2db556fcdb72e6 100644 (file)
@@ -93,7 +93,7 @@ GCStrategy *GCModuleInfo::getOrCreateStrategy(const Module *M,
     }
   }
  
-  cerr << "unsupported GC: " << Name << "\n";
+  errs() << "unsupported GC: " << Name << "\n";
   llvm_unreachable(0);
 }
 
index af5abad537bfd2406528bf758996d640c0095609..2529e4f1f3d644b4129fa011a1b482d13f30dcc6 100644 (file)
@@ -29,6 +29,7 @@
 #include "llvm/Target/TargetRegisterInfo.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
 
 using namespace llvm;
 
@@ -108,7 +109,7 @@ GCStrategy::~GCStrategy() {
 bool GCStrategy::initializeCustomLowering(Module &M) { return false; }
  
 bool GCStrategy::performCustomLowering(Function &F) {
-  cerr << "gc " << getName() << " must override performCustomLowering.\n";
+  errs() << "gc " << getName() << " must override performCustomLowering.\n";
   llvm_unreachable(0);
   return 0;
 }
index cf855f0e896a6d37018dc4d58d7bea7beb215d0e..e3bbdb26eaf765460e65f68f35ca9e945b53fb93 100644 (file)
@@ -16,8 +16,9 @@
 #include "llvm/Module.h"
 #include "llvm/Type.h"
 #include "llvm/CodeGen/IntrinsicLowering.h"
-#include "llvm/Support/IRBuilder.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/IRBuilder.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/ADT/SmallVector.h"
 using namespace llvm;
@@ -396,8 +397,8 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
   case Intrinsic::stacksave:
   case Intrinsic::stackrestore: {
     if (!Warned)
-      cerr << "WARNING: this target does not support the llvm.stack"
-           << (Callee->getIntrinsicID() == Intrinsic::stacksave ?
+      errs() << "WARNING: this target does not support the llvm.stack"
+             << (Callee->getIntrinsicID() == Intrinsic::stacksave ?
                "save" : "restore") << " intrinsic.\n";
     Warned = true;
     if (Callee->getIntrinsicID() == Intrinsic::stacksave)
@@ -407,8 +408,8 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
     
   case Intrinsic::returnaddress:
   case Intrinsic::frameaddress:
-    cerr << "WARNING: this target does not support the llvm."
-         << (Callee->getIntrinsicID() == Intrinsic::returnaddress ?
+    errs() << "WARNING: this target does not support the llvm."
+           << (Callee->getIntrinsicID() == Intrinsic::returnaddress ?
              "return" : "frame") << "address intrinsic.\n";
     CI->replaceAllUsesWith(ConstantPointerNull::get(
                                             cast<PointerType>(CI->getType())));
@@ -420,8 +421,8 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
   case Intrinsic::pcmarker:
     break;    // Simply strip out pcmarker on unsupported architectures
   case Intrinsic::readcyclecounter: {
-    cerr << "WARNING: this target does not support the llvm.readcyclecoun"
-         << "ter intrinsic.  It is being lowered to a constant 0\n";
+    errs() << "WARNING: this target does not support the llvm.readcyclecoun"
+           << "ter intrinsic.  It is being lowered to a constant 0\n";
     CI->replaceAllUsesWith(ConstantInt::get(Type::getInt64Ty(Context), 0));
     break;
   }
index edd9536e2c374e3925f90cd4c4c4d01dbb217fa3..96afda47d53b22d2d5fd8ba10026d885e634107a 100644 (file)
@@ -516,8 +516,7 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
 }
 
 /// print - Implement the dump method.
-void LiveIntervals::print(std::ostream &O, const Module* ) const {
-  raw_os_ostream OS(O);
+void LiveIntervals::print(raw_ostream &OS, const Module* ) const {
   OS << "********** INTERVALS **********\n";
   for (const_iterator I = begin(), E = end(); I != E; ++I) {
     I->second->print(OS, tri_);
index c89b70893f18db180a3d41794d22d751a124059f..a7bea1fd4f986af9f63896056db99f223648c7f1 100644 (file)
@@ -53,8 +53,7 @@ bool LiveStacks::runOnMachineFunction(MachineFunction &) {
 }
 
 /// print - Implement the dump method.
-void LiveStacks::print(std::ostream &O, const Module*) const {
-  raw_os_ostream OS(O);
+void LiveStacks::print(raw_ostream &OS, const Module*) const {
 
   OS << "********** INTERVALS **********\n";
   for (const_iterator I = begin(), E = end(); I != E; ++I) {
index 78de02abc1b42c15386f79bb34c23393427c7a47..0f796f3952c31402ef9edcffdb69715e8a9a062f 100644 (file)
@@ -52,7 +52,6 @@ void MachineDominatorTree::releaseMemory() {
   DT->releaseMemory();
 }
 
-void MachineDominatorTree::print(std::ostream &OS, const Module*) const {
-  raw_os_ostream OSS(OS);
-  DT->print(OSS);
+void MachineDominatorTree::print(raw_ostream &OS, const Module*) const {
+  DT->print(OS);
 }
index fbab7e8be7552f8352709f4add6da9d80587aeb9..f12ad77eeaf494dcc67da12e63c394b8027dbf4c 100644 (file)
@@ -121,13 +121,10 @@ namespace {
     }
 
     /// print - Implement the dump method.
-    virtual void print(std::ostream &O, const Module* M = 0) const {
+    virtual void print(raw_ostream &O, const Module* M = 0) const {
       LIs->print(O, M);
     }
 
-    void print(std::ostream *O, const Module* M = 0) const {
-      if (O) print(*O, M);
-    }
 
   private:
     MachineBasicBlock::iterator
index 7a1eeb23d20629a2ca452f542eec23d4ea72009c..60c3056902421aa3e561a46f10346736551361ca 100644 (file)
@@ -69,8 +69,8 @@ CCState::AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
     ISD::ArgFlagsTy ArgFlags = Ins[i].Flags;
     if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
 #ifndef NDEBUG
-      cerr << "Formal argument #" << i << " has unhandled type "
-           << ArgVT.getEVTString();
+      errs() << "Formal argument #" << i << " has unhandled type "
+             << ArgVT.getEVTString();
 #endif
       llvm_unreachable(0);
     }
@@ -87,8 +87,8 @@ void CCState::AnalyzeReturn(const SmallVectorImpl<ISD::OutputArg> &Outs,
     ISD::ArgFlagsTy ArgFlags = Outs[i].Flags;
     if (Fn(i, VT, VT, CCValAssign::Full, ArgFlags, *this)) {
 #ifndef NDEBUG
-      cerr << "Return operand #" << i << " has unhandled type "
-           << VT.getEVTString();
+      errs() << "Return operand #" << i << " has unhandled type "
+             << VT.getEVTString();
 #endif
       llvm_unreachable(0);
     }
@@ -106,8 +106,8 @@ void CCState::AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
     ISD::ArgFlagsTy ArgFlags = Outs[i].Flags;
     if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
 #ifndef NDEBUG
-      cerr << "Call operand #" << i << " has unhandled type "
-           << ArgVT.getEVTString();
+      errs() << "Call operand #" << i << " has unhandled type "
+             << ArgVT.getEVTString();
 #endif
       llvm_unreachable(0);
     }
@@ -125,8 +125,8 @@ void CCState::AnalyzeCallOperands(SmallVectorImpl<EVT> &ArgVTs,
     ISD::ArgFlagsTy ArgFlags = Flags[i];
     if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
 #ifndef NDEBUG
-      cerr << "Call operand #" << i << " has unhandled type "
-           << ArgVT.getEVTString();
+      errs() << "Call operand #" << i << " has unhandled type "
+             << ArgVT.getEVTString();
 #endif
       llvm_unreachable(0);
     }
@@ -142,8 +142,8 @@ void CCState::AnalyzeCallResult(const SmallVectorImpl<ISD::InputArg> &Ins,
     ISD::ArgFlagsTy Flags = Ins[i].Flags;
     if (Fn(i, VT, VT, CCValAssign::Full, Flags, *this)) {
 #ifndef NDEBUG
-      cerr << "Call result #" << i << " has unhandled type "
-           << VT.getEVTString();
+      errs() << "Call result #" << i << " has unhandled type "
+             << VT.getEVTString();
 #endif
       llvm_unreachable(0);
     }
@@ -155,8 +155,8 @@ void CCState::AnalyzeCallResult(const SmallVectorImpl<ISD::InputArg> &Ins,
 void CCState::AnalyzeCallResult(EVT VT, CCAssignFn Fn) {
   if (Fn(0, VT, VT, CCValAssign::Full, ISD::ArgFlagsTy(), *this)) {
 #ifndef NDEBUG
-    cerr << "Call result has unhandled type "
-         << VT.getEVTString();
+    errs() << "Call result has unhandled type "
+           << VT.getEVTString();
 #endif
     llvm_unreachable(0);
   }
index 934121249559ee69e6eac82540d608c4cbf8898f..10f7b3206b743cc93c57927fc7dad3e4a07521c4 100644 (file)
@@ -35,6 +35,7 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -950,7 +951,9 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
   switch (Node->getOpcode()) {
   default:
 #ifndef NDEBUG
-    cerr << "NODE: "; Node->dump(&DAG); cerr << "\n";
+    errs() << "NODE: ";
+    Node->dump(&DAG);
+    errs() << "\n";
 #endif
     llvm_unreachable("Do not know how to legalize this operator!");
 
index cc8d5657686b1f6ce5ed74834aef428a55d0c4ea..ded913ba6e4ab6531ff354006bae308b8d75db3c 100644 (file)
@@ -659,7 +659,7 @@ bool SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
   if (!Erased && N->getValueType(N->getNumValues()-1) != MVT::Flag &&
       !N->isMachineOpcode() && !doNotCSE(N)) {
     N->dump(this);
-    cerr << "\n";
+    errs() << "\n";
     llvm_unreachable("Node is not in map!");
   }
 #endif
@@ -5644,16 +5644,17 @@ static void DumpNodes(const SDNode *N, unsigned indent, const SelectionDAG *G) {
     if (N->getOperand(i).getNode()->hasOneUse())
       DumpNodes(N->getOperand(i).getNode(), indent+2, G);
     else
-      cerr << "\n" << std::string(indent+2, ' ')
-           << (void*)N->getOperand(i).getNode() << ": <multiple use>";
+      errs() << "\n" << std::string(indent+2, ' ')
+             << (void*)N->getOperand(i).getNode() << ": <multiple use>";
 
 
-  cerr << "\n" << std::string(indent, ' ');
+  errs() << "\n";
+  errs().indent(indent);
   N->dump(G);
 }
 
 void SelectionDAG::dump() const {
-  cerr << "SelectionDAG has " << AllNodes.size() << " nodes:";
+  errs() << "SelectionDAG has " << AllNodes.size() << " nodes:";
 
   for (allnodes_const_iterator I = allnodes_begin(), E = allnodes_end();
        I != E; ++I) {
@@ -5664,7 +5665,7 @@ void SelectionDAG::dump() const {
 
   if (getRoot().getNode()) DumpNodes(getRoot().getNode(), 2, this);
 
-  cerr << "\n\n";
+  errs() << "\n\n";
 }
 
 void SDNode::printr(raw_ostream &OS, const SelectionDAG *G) const {
index 84e3c32023944e6d173f105dd9d77057dd4146e1..2956e34a33d4fbec9ecdf2475f57bcd321332bb1 100644 (file)
@@ -2792,7 +2792,7 @@ bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) {
 }
 
 /// print - Implement the dump method.
-void SimpleRegisterCoalescing::print(std::ostream &O, const Module* m) const {
+void SimpleRegisterCoalescing::print(raw_ostream &O, const Module* m) const {
    li_->print(O, m);
 }
 
index c7a5df4cb8e7d0090b18eb55bfe78b63a6a2ec74..1830353615cd8a35809f1ba851f0d0d18ce7ffea 100644 (file)
@@ -137,10 +137,7 @@ namespace llvm {
     }
 
     /// print - Implement the dump method.
-    virtual void print(std::ostream &O, const Module* = 0) const;
-    void print(std::ostream *O, const Module* M = 0) const {
-      if (O) print(*O, M);
-    }
+    virtual void print(raw_ostream &O, const Module* = 0) const;
 
   private:
     /// joinIntervals - join compatible live intervals
index 2a3da453712a0d31ca7a56cb2e34a1226b177bcf..423e90d993527e818dae72259aa65f0b297965fc 100644 (file)
@@ -597,9 +597,4 @@ void ConstantRange::dump() const {
   print(errs());
 }
 
-std::ostream &llvm::operator<<(std::ostream &o,
-                               const ConstantRange &CR) {
-  raw_os_ostream OS(o);
-  OS << CR;
-  return o;
-}
+
index b77a35f6294707182cf160760a9163f028bf1095..ad9bbe1d311fbe500f892ace72d27148139e1d35 100644 (file)
@@ -2635,7 +2635,7 @@ PPCTargetLowering::LowerCall_SVR4(SDValue Chain, SDValue Callee,
       
       if (Result) {
 #ifndef NDEBUG
-        cerr << "Call operand #" << i << " has unhandled type "
+        errs() << "Call operand #" << i << " has unhandled type "
              << ArgVT.getEVTString() << "\n";
 #endif
         llvm_unreachable(0);
index c47e0ff50b1b8f68a7dfa9dc360be6ef51948a00..135a621f5d96a0a03632c42e6bbd703d3ad3e76c 100644 (file)
@@ -55,7 +55,7 @@ void ExtAddrMode::print(raw_ostream &OS) const {
 
 void ExtAddrMode::dump() const {
   print(errs());
-  cerr << '\n';
+  errs() << '\n';
 }
 
 
index e3bcbb754240ef7ac30a65efb945e9ca42e13bcb..bb73aaf705d57dd5416eb61c6f28a5abda271891 100644 (file)
@@ -48,9 +48,8 @@ bool DominatorTree::runOnFunction(Function &F) {
   return false;
 }
 
-void DominatorTree::print(std::ostream &OS, const Module *) const {
-  raw_os_ostream OSS(OS);
-  DT->print(OSS);
+void DominatorTree::print(raw_ostream &OS, const Module *) const {
+  DT->print(OS);
 }
 
 
@@ -264,8 +263,7 @@ DominanceFrontier::calculate(const DominatorTree &DT,
   return *Result;
 }
 
-void DominanceFrontierBase::print(std::ostream &O, const Module* ) const {
-  raw_os_ostream OS(O);
+void DominanceFrontierBase::print(raw_ostream &OS, const Module* ) const {
   for (const_iterator I = begin(), E = end(); I != E; ++I) {
     OS << "  DomFrontier for BB";
     if (I->first)
index d82389d99d94fa277b284ecb148aa2604d33c29e..e2a8d744e395af1ba2e1bc13fe03c87a5d4e6f10 100644 (file)
@@ -19,6 +19,7 @@
 #include "llvm/ModuleProvider.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/System/Atomic.h"
 #include "llvm/System/Mutex.h"
 #include "llvm/System/Threading.h"
@@ -45,7 +46,7 @@ bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {
 
 // dumpPassStructure - Implement the -debug-passes=Structure option
 void Pass::dumpPassStructure(unsigned Offset) {
-  cerr << std::string(Offset*2, ' ') << getPassName() << "\n";
+  errs().indent(Offset*2) << getPassName() << "\n";
 }
 
 /// getPassName - Return a nice clean name for a pass.  This usually
@@ -62,13 +63,13 @@ const char *Pass::getPassName() const {
 // to print out the contents of an analysis.  Otherwise it is not necessary to
 // implement this method.
 //
-void Pass::print(std::ostream &O,const Module*) const {
+void Pass::print(raw_ostream &O,const Module*) const {
   O << "Pass::print not implemented for pass: '" << getPassName() << "'!\n";
 }
 
 // dump - call print(cerr);
 void Pass::dump() const {
-  print(*cerr.stream(), 0);
+  print(errs(), 0);
 }
 
 //===----------------------------------------------------------------------===//
index 2ab69ea61e744a08a28acda13142d0cd2877847d..18360f837e93a40cb12c57f548bac8423a48df80 100644 (file)
@@ -34,27 +34,31 @@ namespace {
     static char ID; // Pass ID, replacement for typeid
     ExternalFunctionsPassedConstants() : ModulePass(&ID) {}
     virtual bool runOnModule(Module &M) {
-      for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
-        if (I->isDeclaration()) {
-          bool PrintedFn = false;
-          for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
-               UI != E; ++UI)
-            if (Instruction *User = dyn_cast<Instruction>(*UI)) {
-              CallSite CS = CallSite::get(User);
-              if (CS.getInstruction()) {
-                for (CallSite::arg_iterator AI = CS.arg_begin(),
-                       E = CS.arg_end(); AI != E; ++AI)
-                  if (isa<Constant>(*AI)) {
-                    if (!PrintedFn) {
-                      errs() << "Function '" << I->getName() << "':\n";
-                      PrintedFn = true;
-                    }
-                    errs() << *User;
-                    break;
-                  }
-              }
+      for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
+        if (!I->isDeclaration()) continue;
+        
+        bool PrintedFn = false;
+        for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
+             UI != E; ++UI) {
+          Instruction *User = dyn_cast<Instruction>(*UI);
+          if (!User) continue;
+          
+          CallSite CS = CallSite::get(User);
+          if (!CS.getInstruction()) continue;
+          
+          for (CallSite::arg_iterator AI = CS.arg_begin(),
+               E = CS.arg_end(); AI != E; ++AI) {
+            if (!isa<Constant>(*AI)) continue;
+
+            if (!PrintedFn) {
+              errs() << "Function '" << I->getName() << "':\n";
+              PrintedFn = true;
             }
+            errs() << *User;
+            break;
+          }
         }
+      }
 
       return false;
     }
@@ -78,7 +82,7 @@ namespace {
       AU.addRequiredTransitive<CallGraph>();
     }
     virtual bool runOnModule(Module &M) {
-      getAnalysis<CallGraph>().print(std::cerr, &M);
+      getAnalysis<CallGraph>().print(errs(), &M);
       return false;
     }
   };
index 5d581e4af0a2dffc8c941e4be22728c1bf68321f..6bd0a6e9f760e3db3bba458107af8308b201beb8 100644 (file)
@@ -70,8 +70,7 @@ namespace {
       return false;
     }
 
-    void print(std::ostream &OS) const {}
-    void print(std::ostream &OS, const llvm::Module*) const {}
+    void print(raw_ostream &OS, const llvm::Module*) const {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<CallGraph>();
index a0aa4e90e7f9fd1faa234d9cda371d6e9bb44064..66709ffa196a9f5d00fb3f1e00a1abfb5bb60f38 100644 (file)
@@ -39,7 +39,7 @@ namespace {
     CFGSCC() : FunctionPass(&ID) {}
     bool runOnFunction(Function& func);
 
-    void print(std::ostream &O, const Module* = 0) const { }
+    void print(raw_ostream &O, const Module* = 0) const { }
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
@@ -53,7 +53,7 @@ namespace {
     // run - Print out SCCs in the call graph for the specified module.
     bool runOnModule(Module &M);
 
-    void print(std::ostream &O, const Module* = 0) const { }
+    void print(raw_ostream &O, const Module* = 0) const { }
 
     // getAnalysisUsage - This pass requires the CallGraph.
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
index 4f241986401729f6839c13b8a6b1c282d76fb8bd..f41b20234906740bd8be297ed08db30193039b4d 100644 (file)
@@ -140,7 +140,7 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass {
         Function *F = SCC[i]->getFunction();
         if (F) {
           outs().flush();
-          getAnalysisID<Pass>(PassToPrint).print(cout, F->getParent());
+          getAnalysisID<Pass>(PassToPrint).print(outs(), F->getParent());
           cout << std::flush;
         }
       }
@@ -169,7 +169,7 @@ struct ModulePassPrinter : public ModulePass {
     if (!Quiet) {
       outs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
       outs().flush();
-      getAnalysisID<Pass>(PassToPrint).print(cout, &M);
+      getAnalysisID<Pass>(PassToPrint).print(outs(), &M);
       cout << std::flush;
     }
 
@@ -199,7 +199,7 @@ struct FunctionPassPrinter : public FunctionPass {
     }
     // Get and print pass...
     outs().flush();
-    getAnalysisID<Pass>(PassToPrint).print(cout, F.getParent());
+    getAnalysisID<Pass>(PassToPrint).print(outs(), F.getParent());
     cout << std::flush;
     return false;
   }
@@ -224,7 +224,7 @@ struct LoopPassPrinter : public LoopPass {
     if (!Quiet) {
       outs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
       outs().flush();
-      getAnalysisID<Pass>(PassToPrint).print(cout,
+      getAnalysisID<Pass>(PassToPrint).print(outs(),
                                   L->getHeader()->getParent()->getParent());
       cout << std::flush;
     }
@@ -256,7 +256,7 @@ struct BasicBlockPassPrinter : public BasicBlockPass {
 
     // Get and print pass...
     outs().flush();
-    getAnalysisID<Pass>(PassToPrint).print(cout, BB.getParent()->getParent());
+    getAnalysisID<Pass>(PassToPrint).print(outs(), BB.getParent()->getParent());
     cout << std::flush;
     return false;
   }
index 119c991f5aef8e39ffc2b89567b27fed57d86ae7..95df746aecd9788e140f8e8c1732de54b9cdc19a 100644 (file)
@@ -2071,7 +2071,7 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
      << "}\n\n";
 
   OS << "void CannotYetSelectIntrinsic(SDValue N) DISABLE_INLINE {\n"
-     << "  cerr << \"Cannot yet select: \";\n"
+     << "  errs() << \"Cannot yet select: \";\n"
      << "  unsigned iid = cast<ConstantSDNode>(N.getOperand("
      << "N.getOperand(0).getValueType() == MVT::Other))->getZExtValue();\n"
      << " llvm_report_error(\"Cannot yet select: intrinsic %\" +\n"