瀏覽代碼

Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.


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

Bill Wendling 18 年之前
父節點
當前提交
e81561909d
共有 100 個文件被更改,包括 974 次插入749 次删除
  1. 1 1
      examples/ModuleMaker/ModuleMaker.cpp
  2. 6 4
      include/llvm/ADT/BitSetVector.h
  3. 2 2
      include/llvm/ADT/EquivalenceClasses.h
  4. 4 4
      include/llvm/Analysis/AliasSetTracker.h
  5. 2 2
      include/llvm/Analysis/CallGraph.h
  6. 2 2
      include/llvm/Analysis/DataStructure/DSGraph.h
  7. 1 1
      include/llvm/Analysis/DataStructure/DSNode.h
  8. 2 2
      include/llvm/Analysis/LoopInfo.h
  9. 4 4
      include/llvm/Analysis/ScalarEvolution.h
  10. 2 2
      include/llvm/Analysis/Trace.h
  11. 8 10
      include/llvm/Assembly/PrintModulePass.h
  12. 4 5
      include/llvm/Bytecode/WriteBytecodePass.h
  13. 3 2
      include/llvm/Bytecode/Writer.h
  14. 4 4
      include/llvm/CodeGen/LiveInterval.h
  15. 2 2
      include/llvm/CodeGen/MachineBasicBlock.h
  16. 4 4
      include/llvm/CodeGen/MachineConstantPool.h
  17. 3 3
      include/llvm/CodeGen/MachineInstr.h
  18. 5 5
      include/llvm/CodeGen/SchedGraphCommon.h
  19. 2 2
      include/llvm/Module.h
  20. 1 1
      include/llvm/Pass.h
  21. 2 2
      include/llvm/Support/Casting.h
  22. 1 1
      include/llvm/Support/ConstantRange.h
  23. 2 2
      include/llvm/Support/Debug.h
  24. 5 5
      include/llvm/Support/GraphWriter.h
  25. 2 2
      include/llvm/Support/PassNameParser.h
  26. 35 19
      include/llvm/Support/Streams.h
  27. 1 1
      include/llvm/Type.h
  28. 1 1
      include/llvm/Value.h
  29. 17 21
      lib/Analysis/AliasAnalysisCounter.cpp
  30. 26 26
      lib/Analysis/AliasAnalysisEvaluator.cpp
  31. 3 3
      lib/Analysis/AliasSetTracker.cpp
  32. 2 2
      lib/Analysis/BasicAliasAnalysis.cpp
  33. 3 3
      lib/Analysis/CFGPrinter.cpp
  34. 1 1
      lib/Analysis/ConstantRange.cpp
  35. 12 12
      lib/Analysis/DataStructure/BottomUpClosure.cpp
  36. 7 7
      lib/Analysis/DataStructure/CallTargets.cpp
  37. 1 2
      lib/Analysis/DataStructure/DataStructure.cpp
  38. 6 6
      lib/Analysis/DataStructure/DataStructureStats.cpp
  39. 1 1
      lib/Analysis/DataStructure/EquivClassGraphs.cpp
  40. 16 16
      lib/Analysis/DataStructure/GraphChecker.cpp
  41. 2 2
      lib/Analysis/DataStructure/Local.cpp
  42. 1 1
      lib/Analysis/DataStructure/Printer.cpp
  43. 1 1
      lib/Analysis/DataStructure/Steensgaard.cpp
  44. 24 24
      lib/Analysis/IPA/Andersens.cpp
  45. 4 4
      lib/Analysis/IPA/CallGraph.cpp
  46. 1 1
      lib/Analysis/InstCount.cpp
  47. 1 1
      lib/Analysis/LoopInfo.cpp
  48. 14 15
      lib/Analysis/ProfileInfoLoader.cpp
  49. 2 2
      lib/Analysis/ProfileInfoLoaderPass.cpp
  50. 17 17
      lib/Analysis/ScalarEvolution.cpp
  51. 2 3
      lib/Analysis/ScalarEvolutionExpander.cpp
  52. 2 3
      lib/Analysis/Trace.cpp
  53. 401 182
      lib/AsmParser/llvmAsmParser.cpp.cvs
  54. 25 15
      lib/AsmParser/llvmAsmParser.h.cvs
  55. 3 3
      lib/AsmParser/llvmAsmParser.y
  56. 3 3
      lib/AsmParser/llvmAsmParser.y.cvs
  57. 1 1
      lib/Bytecode/Writer/SlotCalculator.cpp
  58. 6 6
      lib/Bytecode/Writer/Writer.cpp
  59. 18 19
      lib/CodeGen/AsmPrinter.cpp
  60. 7 9
      lib/CodeGen/DwarfWriter.cpp
  61. 3 4
      lib/CodeGen/ELFWriter.cpp
  62. 12 12
      lib/CodeGen/IntrinsicLowering.cpp
  63. 3 4
      lib/CodeGen/LiveInterval.cpp
  64. 2 2
      lib/CodeGen/LiveIntervalAnalysis.cpp
  65. 1 2
      lib/CodeGen/MachineInstr.cpp
  66. 3 3
      lib/CodeGen/VirtRegMap.cpp
  67. 2 2
      lib/CodeGen/VirtRegMap.h
  68. 9 9
      lib/ExecutionEngine/ExecutionEngine.cpp
  69. 28 29
      lib/ExecutionEngine/Interpreter/Execution.cpp
  70. 7 7
      lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
  71. 8 9
      lib/Linker/LinkModules.cpp
  72. 3 3
      lib/Linker/Linker.cpp
  73. 2 2
      lib/Support/Allocator.cpp
  74. 47 47
      lib/Support/CommandLine.cpp
  75. 1 1
      lib/Support/ConstantRange.cpp
  76. 3 3
      lib/Support/Debug.cpp
  77. 8 8
      lib/Support/GraphWriter.cpp
  78. 2 2
      lib/Support/PluginLoader.cpp
  79. 4 4
      lib/Support/SlowOperationInformer.cpp
  80. 4 3
      lib/Support/Streams.cpp
  81. 4 4
      lib/Support/SystemUtils.cpp
  82. 2 2
      lib/Transforms/ExprTypeConvert.cpp
  83. 2 2
      lib/Transforms/Hello/Hello.cpp
  84. 18 18
      lib/Transforms/IPO/GlobalOpt.cpp
  85. 1 2
      lib/Transforms/IPO/Internalize.cpp
  86. 4 4
      lib/Transforms/Instrumentation/BlockProfiling.cpp
  87. 3 3
      lib/Transforms/Instrumentation/EdgeProfiling.cpp
  88. 3 3
      lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
  89. 2 2
      lib/Transforms/Scalar/InstructionCombining.cpp
  90. 4 4
      lib/Transforms/Scalar/LoopStrengthReduce.cpp
  91. 1 2
      lib/Transforms/Scalar/LowerPacked.cpp
  92. 3 3
      lib/Transforms/Scalar/SCCP.cpp
  93. 2 2
      lib/Transforms/Utils/CodeExtractor.cpp
  94. 1 2
      lib/Transforms/Utils/LowerSwitch.cpp
  95. 5 5
      lib/VMCore/AsmWriter.cpp
  96. 9 10
      lib/VMCore/LeakDetector.cpp
  97. 1 1
      lib/VMCore/PassManager.cpp
  98. 10 10
      lib/VMCore/TypeSymbolTable.cpp
  99. 2 3
      lib/VMCore/Verifier.cpp
  100. 4 4
      projects/Stacker/tools/stkrc/stkrc.cpp

+ 1 - 1
examples/ModuleMaker/ModuleMaker.cpp

@@ -53,7 +53,7 @@ int main() {
   BB->getInstList().push_back(new ReturnInst(Add));
 
   // Output the bytecode file to stdout
-  WriteBytecodeToFile(M, llvm_cout);
+  WriteBytecodeToFile(M, cout);
 
   // Delete the module and all of its contents.
   delete M;

+ 6 - 4
include/llvm/ADT/BitSetVector.h

@@ -29,7 +29,6 @@
 #include <bitset>
 #include <vector>
 #include <functional>
-#include <ostream>
 
 namespace llvm {
 
@@ -174,11 +173,11 @@ public:
   ///
   ///  Printing and debugging support
   ///
-  void print(llvm_ostream &O) const {
+  void print(OStream &O) const {
     if (O.stream()) print(*O.stream());
   }
   void print(std::ostream &O) const;
-  void dump() const { print(llvm_cerr); }
+  void dump() const { print(cerr); }
 
 public:
   //
@@ -235,6 +234,9 @@ public:
       return (I.bitvec == bitvec &&
               I.currentWord == currentWord && I.currentBit == currentBit);
     }
+    bool operator!=(const iterator& I) {
+      return !(*this == I);
+    }
 
   protected:
     static iterator begin(BitSetVector& _bitvec) { return iterator(_bitvec); }
@@ -252,7 +254,7 @@ inline void BitSetVector::print(std::ostream& O) const
     O << "<" << (*I) << ">" << (I+1 == E? "\n" : ", ");
 }
 
-inline llvm_ostream& operator<< (llvm_ostream& O, const BitSetVector& bset) {
+inline OStream& operator<< (OStream& O, const BitSetVector& bset) {
   bset.print(O);
   return O;
 }

+ 2 - 2
include/llvm/ADT/EquivalenceClasses.h

@@ -43,8 +43,8 @@ namespace llvm {
 ///    if (!I->isLeader()) continue;   // Ignore non-leader sets.
 ///    for (EquivalenceClasses<int>::member_iterator MI = EC.member_begin(I);
 ///         MI != EC.member_end(); ++MI)   // Loop over members in this set.
-///      llvm_cerr << *MI << " ";  // Print member.
-///    llvm_cerr << "\n";   // Finish set.
+///      cerr << *MI << " ";  // Print member.
+///    cerr << "\n";   // Finish set.
 ///  }
 ///
 /// This example prints:

+ 4 - 4
include/llvm/Analysis/AliasSetTracker.h

@@ -156,7 +156,7 @@ public:
   iterator end()   const { return iterator(); }
   bool empty() const { return PtrList == 0; }
 
-  void print(llvm_ostream &OS) const {
+  void print(OStream &OS) const {
     if (OS.stream()) print(*OS.stream());
   }
   void print(std::ostream &OS) const;
@@ -248,7 +248,7 @@ private:
   bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const;
 };
 
-inline llvm_ostream& operator<<(llvm_ostream &OS, const AliasSet &AS) {
+inline OStream& operator<<(OStream &OS, const AliasSet &AS) {
   AS.print(OS);
   return OS;
 }
@@ -361,7 +361,7 @@ public:
   iterator begin() { return AliasSets.begin(); }
   iterator end()   { return AliasSets.end(); }
 
-  void print(llvm_ostream &OS) const {
+  void print(OStream &OS) const {
     if (OS.stream()) print(*OS.stream());
   }
   void print(std::ostream &OS) const;
@@ -390,7 +390,7 @@ private:
   AliasSet *findAliasSetForCallSite(CallSite CS);
 };
 
-inline llvm_ostream& operator<<(llvm_ostream &OS, const AliasSetTracker &AST) {
+inline OStream& operator<<(OStream &OS, const AliasSetTracker &AST) {
   AST.print(OS);
   return OS;
 }

+ 2 - 2
include/llvm/Analysis/CallGraph.h

@@ -152,7 +152,7 @@ public:
   ///
   void initialize(Module &M);
 
-  void print(llvm_ostream &o, const Module *M) const {
+  void print(OStream &o, const Module *M) const {
     if (o.stream()) print(*o.stream(), M);
   }
   virtual void print(std::ostream &o, const Module *M) const;
@@ -201,7 +201,7 @@ public:
   /// dump - Print out this call graph node.
   ///
   void dump() const;
-  void print(llvm_ostream &OS) const {
+  void print(OStream &OS) const {
     if (OS.stream()) print(*OS.stream());
   }
   void print(std::ostream &OS) const;

+ 2 - 2
include/llvm/Analysis/DataStructure/DSGraph.h

@@ -378,12 +378,12 @@ public:
 
   /// print - Print a dot graph to the specified ostream...
   ///
-  void print(llvm_ostream &O) const {
+  void print(OStream &O) const {
     if (O.stream()) print(*O.stream());
   }
   void print(std::ostream &O) const;
 
-  /// dump - call print(llvm_cerr), for use from the debugger...
+  /// dump - call print(cerr), for use from the debugger...
   ///
   void dump() const;
 

+ 1 - 1
include/llvm/Analysis/DataStructure/DSNode.h

@@ -362,7 +362,7 @@ public:
   ///
   void forwardNode(DSNode *To, unsigned Offset);
 
-  void print(llvm_ostream &O, const DSGraph *G) const {
+  void print(OStream &O, const DSGraph *G) const {
     if (O.stream()) print(*O.stream(), G);
   }
   void print(std::ostream &O, const DSGraph *G) const;

+ 2 - 2
include/llvm/Analysis/LoopInfo.h

@@ -217,7 +217,7 @@ public:
   /// the mapping in the LoopInfo class.
   void removeBlockFromLoop(BasicBlock *BB);
 
-  void print(llvm_ostream &O, unsigned Depth = 0) const {
+  void print(OStream &O, unsigned Depth = 0) const {
     if (O.stream()) print(*O.stream(), Depth);
   }
   void print(std::ostream &O, unsigned Depth = 0) const;
@@ -283,7 +283,7 @@ public:
   virtual bool runOnFunction(Function &F);
 
   virtual void releaseMemory();
-  void print(llvm_ostream &O, const Module* = 0) const {
+  void print(OStream &O, const Module* = 0) const {
     if (O.stream()) print(*O.stream());
   }
   void print(std::ostream &O, const Module* = 0) const;

+ 4 - 4
include/llvm/Analysis/ScalarEvolution.h

@@ -97,7 +97,7 @@ namespace llvm {
     /// print - Print out the internal representation of this scalar to the
     /// specified stream.  This should really only be used for debugging
     /// purposes.
-    void print(llvm_ostream &OS) const {
+    void print(OStream &OS) const {
       if (OS.stream()) print(*OS.stream());
     }
     virtual void print(std::ostream &OS) const = 0;
@@ -107,7 +107,7 @@ namespace llvm {
     void dump() const;
   };
 
-  inline llvm_ostream &operator<<(llvm_ostream &OS, const SCEV &S) {
+  inline OStream &operator<<(OStream &OS, const SCEV &S) {
     S.print(OS);
     return OS;
   }
@@ -128,7 +128,7 @@ namespace llvm {
     virtual bool isLoopInvariant(const Loop *L) const;
     virtual const Type *getType() const;
     virtual bool hasComputableLoopEvolution(const Loop *L) const;
-    void print(llvm_ostream &OS) const {
+    void print(OStream &OS) const {
       if (OS.stream()) print(*OS.stream());
     }
     virtual void print(std::ostream &OS) const;
@@ -242,7 +242,7 @@ namespace llvm {
     virtual bool runOnFunction(Function &F);
     virtual void releaseMemory();
     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
-    void print(llvm_ostream &OS, const Module* = 0) const {
+    void print(OStream &OS, const Module* = 0) const {
       if (OS.stream()) print(*OS.stream());
     }
     virtual void print(std::ostream &OS, const Module* = 0) const;

+ 2 - 2
include/llvm/Analysis/Trace.h

@@ -18,11 +18,11 @@
 #ifndef LLVM_ANALYSIS_TRACE_H
 #define LLVM_ANALYSIS_TRACE_H
 
+#include "llvm/Support/Streams.h"
 #include <vector>
 #include <cassert>
 
 namespace llvm {
-  class llvm_ostream;
   class BasicBlock;
   class Function;
   class Module;
@@ -106,7 +106,7 @@ public:
 
   /// print - Write trace to output stream.
   ///
-  void print (llvm_ostream &O) const;
+  void print (OStream &O) const;
 
   /// dump - Debugger convenience method; writes trace to standard error
   /// output stream.

+ 8 - 10
include/llvm/Assembly/PrintModulePass.h

@@ -25,13 +25,12 @@
 namespace llvm {
 
 class PrintModulePass : public ModulePass {
-  llvm_ostream *Out;      // ostream to print on
+  OStream *Out;           // ostream to print on
   bool DeleteStream;      // Delete the ostream in our dtor?
 public:
-  PrintModulePass() : Out(&llvm_cerr), DeleteStream(false) {}
-  PrintModulePass(llvm_ostream *o, bool DS = false)
-    : Out(o), DeleteStream(DS) {
-  }
+  PrintModulePass() : Out(&cerr), DeleteStream(false) {}
+  PrintModulePass(OStream *o, bool DS = false)
+    : Out(o), DeleteStream(DS) {}
 
   ~PrintModulePass() {
     if (DeleteStream) delete Out;
@@ -49,14 +48,13 @@ public:
 
 class PrintFunctionPass : public FunctionPass {
   std::string Banner;     // String to print before each function
-  llvm_ostream *Out;      // ostream to print on
+  OStream *Out;           // ostream to print on
   bool DeleteStream;      // Delete the ostream in our dtor?
 public:
-  PrintFunctionPass() : Banner(""), Out(&llvm_cerr), DeleteStream(false) {}
-  PrintFunctionPass(const std::string &B, llvm_ostream *o = &llvm_cout,
+  PrintFunctionPass() : Banner(""), Out(&cerr), DeleteStream(false) {}
+  PrintFunctionPass(const std::string &B, OStream *o = &cout,
                     bool DS = false)
-    : Banner(B), Out(o), DeleteStream(DS) {
-  }
+    : Banner(B), Out(o), DeleteStream(DS) {}
 
   inline ~PrintFunctionPass() {
     if (DeleteStream) delete Out;

+ 4 - 5
include/llvm/Bytecode/WriteBytecodePass.h

@@ -17,19 +17,18 @@
 
 #include "llvm/Pass.h"
 #include "llvm/Bytecode/Writer.h"
+#include "llvm/Support/Streams.h"
 
 namespace llvm {
 
-class llvm_ostream;
-
 class WriteBytecodePass : public ModulePass {
-  llvm_ostream *Out;           // ostream to print on
+  OStream *Out;                 // ostream to print on
   bool DeleteStream;
   bool CompressFile;
 public:
   WriteBytecodePass()
-    : Out(&llvm_cout), DeleteStream(false), CompressFile(true) {}
-  WriteBytecodePass(llvm_ostream *o, bool DS = false, bool CF = true)
+    : Out(&cout), DeleteStream(false), CompressFile(true) {}
+  WriteBytecodePass(OStream *o, bool DS = false, bool CF = true)
     : Out(o), DeleteStream(DS), CompressFile(CF) {}
 
   inline ~WriteBytecodePass() {

+ 3 - 2
include/llvm/Bytecode/Writer.h

@@ -15,13 +15,14 @@
 #ifndef LLVM_BYTECODE_WRITER_H
 #define LLVM_BYTECODE_WRITER_H
 
+#include "llvm/Support/Streams.h"
+
 namespace llvm {
-  class llvm_ostream;
   class Module;
   /// WriteBytecodeToFile - Write the specified module to the specified output
   /// stream.  If compress is set to true, try to use compression when writing
   /// out the file.  This can never fail if M is a well-formed module.
-  void WriteBytecodeToFile(const Module *M, llvm_ostream &Out,
+  void WriteBytecodeToFile(const Module *M, OStream &Out,
                            bool compress = true);
 } // End llvm namespace
 

+ 4 - 4
include/llvm/CodeGen/LiveInterval.h

@@ -62,7 +62,7 @@ namespace llvm {
   };
 
   std::ostream& operator<<(std::ostream& os, const LiveRange &LR);
-  inline llvm_ostream& operator<<(llvm_ostream& os, const LiveRange &LR) {
+  inline OStream& operator<<(OStream& os, const LiveRange &LR) {
     if (os.stream()) *os.stream() << LR;
     return os;
   }
@@ -258,9 +258,9 @@ namespace llvm {
       return beginNumber() < other.beginNumber();
     }
 
-    void print(llvm_ostream OS, const MRegisterInfo *MRI = 0) const;
+    void print(OStream OS, const MRegisterInfo *MRI = 0) const;
     void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const {
-      print(llvm_ostream(OS), MRI);
+      print(OStream(OS), MRI);
     }
     void dump() const;
 
@@ -271,7 +271,7 @@ namespace llvm {
     LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT
   };
 
-  inline llvm_ostream &operator<<(llvm_ostream &OS, const LiveInterval &LI) {
+  inline OStream &operator<<(OStream &OS, const LiveInterval &LI) {
     LI.print(OS);
     return OS;
   }

+ 2 - 2
include/llvm/CodeGen/MachineBasicBlock.h

@@ -189,7 +189,7 @@ public:
 
   // Debugging methods.
   void dump() const;
-  void print(llvm_ostream &OS) const {
+  void print(OStream &OS) const {
     if (OS.stream()) print(*OS.stream());
   }
   void print(std::ostream &OS) const;
@@ -226,7 +226,7 @@ private:   // Methods used to maintain doubly linked list of blocks...
 };
 
 std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB);
-inline llvm_ostream& operator<<(llvm_ostream &OS, const MachineBasicBlock &MBB){
+inline OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB){
   if (OS.stream()) *OS.stream() << MBB;
   return OS;
 }

+ 4 - 4
include/llvm/CodeGen/MachineConstantPool.h

@@ -49,14 +49,14 @@ public:
 
   /// print - Implement operator<<...
   ///
-  void print(llvm_ostream &O) const {
+  void print(OStream &O) const {
     if (O.stream()) print(*O.stream());
   }
   virtual void print(std::ostream &O) const = 0;
 };
 
-inline llvm_ostream &operator<<(llvm_ostream &OS,
-                                const MachineConstantPoolValue &V) {
+inline OStream &operator<<(OStream &OS,
+                           const MachineConstantPoolValue &V) {
   V.print(OS);
   return OS;
 }
@@ -143,7 +143,7 @@ public:
   /// print - Used by the MachineFunction printer to print information about
   /// constant pool objects.  Implemented in MachineFunction.cpp
   ///
-  void print(llvm_ostream &OS) const {
+  void print(OStream &OS) const {
     if (OS.stream()) print(*OS.stream());
   }
   void print(std::ostream &OS) const;

+ 3 - 3
include/llvm/CodeGen/MachineInstr.h

@@ -285,7 +285,7 @@ public:
     IsDead = false;
   }
 
-  friend llvm_ostream& operator<<(llvm_ostream& os, const MachineOperand& mop) {
+  friend OStream& operator<<(OStream& os, const MachineOperand& mop) {
     if (os.stream()) *os.stream() << mop;
     return os;
   }
@@ -397,12 +397,12 @@ public:
   //
   // Debugging support
   //
-  void print(llvm_ostream &OS, const TargetMachine *TM) const {
+  void print(OStream &OS, const TargetMachine *TM) const {
     if (OS.stream()) print(*OS.stream(), TM);
   }
   void print(std::ostream &OS, const TargetMachine *TM) const;
   void dump() const;
-  friend llvm_ostream& operator<<(llvm_ostream& os, const MachineInstr& minstr){
+  friend OStream& operator<<(OStream& os, const MachineInstr& minstr){
     if (os.stream()) *os.stream() << minstr;
     return os;
   }

+ 5 - 5
include/llvm/CodeGen/SchedGraphCommon.h

@@ -70,7 +70,7 @@ public:
   void dump(int indent=0) const;
 
   // Debugging support
-  void print(llvm_ostream &os) const {
+  void print(OStream &os) const {
     if (os.stream()) print(*os.stream());
   }
   virtual void print(std::ostream &os) const = 0;
@@ -96,8 +96,8 @@ protected:
 };
 
 // ostream << operator for SchedGraphNode class
-inline llvm_ostream &operator<<(llvm_ostream &os,
-                                const SchedGraphNodeCommon &node) {
+inline OStream &operator<<(OStream &os,
+                           const SchedGraphNodeCommon &node) {
   node.print(os);
   return os;
 }
@@ -188,7 +188,7 @@ public:
 
 public:
   // Debugging support
-  void print(llvm_ostream &os) const {
+  void print(OStream &os) const {
     if (os.stream()) print(*os.stream());
   }
   void print(std::ostream &os) const;
@@ -200,7 +200,7 @@ private:
 };
 
 // ostream << operator for SchedGraphNode class
-inline llvm_ostream &operator<<(llvm_ostream &os, const SchedGraphEdge &edge) {
+inline OStream &operator<<(OStream &os, const SchedGraphEdge &edge) {
   edge.print(os);
   return os;
 }

+ 2 - 2
include/llvm/Module.h

@@ -295,12 +295,12 @@ public:
 /// @{
 public:
   /// Print the module to an output stream
-  void print(llvm_ostream &OS) const {
+  void print(OStream &OS) const {
     if (OS.stream()) print(*OS.stream(), 0);
   }
   void print(std::ostream &OS) const { print(OS, 0); }
   /// Print the module to an output stream with AssemblyAnnotationWriter.
-  void print(llvm_ostream &OS, AssemblyAnnotationWriter *AAW) const {
+  void print(OStream &OS, AssemblyAnnotationWriter *AAW) const {
     if (OS.stream()) print(*OS.stream(), AAW);
   }
   void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;

+ 1 - 1
include/llvm/Pass.h

@@ -101,7 +101,7 @@ public:
   /// provide the Module* in case the analysis doesn't need it it can just be
   /// ignored.
   ///
-  void print(llvm_ostream &O, const Module *M) const {
+  void print(OStream &O, const Module *M) const {
     if (O.stream()) print(*O.stream(), M);
   }
   virtual void print(std::ostream &O, const Module *M) const;

+ 2 - 2
include/llvm/Support/Casting.h

@@ -245,13 +245,13 @@ private:
 struct foo {
   void ext() const;
   /*  static bool classof(const bar *X) {
-    llvm_cerr << "Classof: " << X << "\n";
+    cerr << "Classof: " << X << "\n";
     return true;
     }*/
 };
 
 template <> inline bool isa_impl<foo,bar>(const bar &Val) {
-  llvm_cerr << "Classof: " << &Val << "\n";
+  cerr << "Classof: " << &Val << "\n";
   return true;
 }
 

+ 1 - 1
include/llvm/Support/ConstantRange.h

@@ -141,7 +141,7 @@ class ConstantRange {
 
   /// print - Print out the bounds to a stream...
   ///
-  void print(llvm_ostream &OS) const {
+  void print(OStream &OS) const {
     if (OS.stream()) print(*OS.stream());
   }
   void print(std::ostream &OS) const;

+ 2 - 2
include/llvm/Support/Debug.h

@@ -65,10 +65,10 @@ bool isCurrentDebugType(const char *Type);
 /// places the std::c* I/O streams into one .cpp file and relieves the whole
 /// program from having to have hundreds of static c'tor/d'tors for them.
 /// 
-llvm_ostream getErrorOutputStream(const char *DebugType);
+OStream getErrorOutputStream(const char *DebugType);
 
 #ifdef NDEBUG
-#define DOUT llvm_ostream()
+#define DOUT NullStream
 #else
 #define DOUT getErrorOutputStream(DEBUG_TYPE)
 #endif

+ 5 - 5
include/llvm/Support/GraphWriter.h

@@ -247,16 +247,16 @@ sys::Path WriteGraph(const GraphType &G,
   std::string ErrMsg;
   sys::Path Filename = sys::Path::GetTemporaryDirectory(&ErrMsg);
   if (Filename.isEmpty()) {
-    llvm_cerr << "Error: " << ErrMsg << "\n";
+    cerr << "Error: " << ErrMsg << "\n";
     return Filename;
   }
   Filename.appendComponent(Name + ".dot");
   if (Filename.makeUnique(true,&ErrMsg)) {
-    llvm_cerr << "Error: " << ErrMsg << "\n";
+    cerr << "Error: " << ErrMsg << "\n";
     return sys::Path();
   }
 
-  llvm_cerr << "Writing '" << Filename << "'... ";
+  cerr << "Writing '" << Filename << "'... ";
   
   std::ofstream O(Filename.c_str());
 
@@ -275,12 +275,12 @@ sys::Path WriteGraph(const GraphType &G,
 
     // Output the end of the graph
     W.writeFooter();
-    llvm_cerr << " done. \n";
+    cerr << " done. \n";
 
     O.close();
     
   } else {
-    llvm_cerr << "error opening file for writing!\n";
+    cerr << "error opening file for writing!\n";
     Filename.clear();
   }
   

+ 2 - 2
include/llvm/Support/PassNameParser.h

@@ -65,8 +65,8 @@ public:
   virtual void passRegistered(const PassInfo *P) {
     if (ignorablePass(P) || !Opt) return;
     if (findOption(P->getPassArgument()) != getNumOptions()) {
-      llvm_cerr << "Two passes with the same argument (-"
-                << P->getPassArgument() << ") attempted to be registered!\n";
+      cerr << "Two passes with the same argument (-"
+           << P->getPassArgument() << ") attempted to be registered!\n";
       abort();
     }
     addLiteralOption(P->getPassArgument(), P, P->getPassName());

+ 35 - 19
include/llvm/Support/Streams.h

@@ -7,48 +7,64 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This file implements a wrapper for the std::cout and std::cerr I/O streams.
-// It prevents the need to include <iostream> to each file just to get I/O.
+// This file implements a wrapper for the STL I/O streams.  It prevents the need
+// to include <iostream> in a file just to get I/O.
 //
 //===----------------------------------------------------------------------===//
 
 #ifndef LLVM_SUPPORT_STREAMS_H
 #define LLVM_SUPPORT_STREAMS_H
 
-#include <ostream>              // Doesn't have static d'tors!!
+#include <sstream>
 
 namespace llvm {
 
-  /// llvm_ostream - Acts like an ostream. It's a wrapper for the std::cerr and
-  /// std::cout ostreams. However, it doesn't require #including <iostream> in
-  /// every file, which increases static c'tors & d'tors in the object code.
+  /// BaseStream - Acts like the STL streams. It's a wrapper for the std::cerr,
+  /// std::cout, std::cin, etc. streams. However, it doesn't require #including
+  /// <iostream> in every file (doing so increases static c'tors & d'tors in the
+  /// object code).
   /// 
-  class llvm_ostream {
-    std::ostream* Stream;
+  template <typename StreamTy>
+  class BaseStream {
+    StreamTy *Stream;
   public:
-    llvm_ostream() : Stream(0) {}
-    llvm_ostream(std::ostream &OStream) : Stream(&OStream) {}
+    BaseStream() : Stream(0) {}
+    BaseStream(StreamTy &S) : Stream(&S) {}
+    BaseStream(StreamTy *S) : Stream(S) {}
 
-    std::ostream* stream() const { return Stream; }
+    StreamTy *stream() const { return Stream; }
 
-    inline llvm_ostream &operator << (std::ostream& (*Func)(std::ostream&)) {
+    inline BaseStream &operator << (StreamTy &(*Func)(StreamTy&)) {
       if (Stream) *Stream << Func;
       return *this;
     }
-      
+
     template <typename Ty>
-    llvm_ostream &operator << (const Ty &Thing) {
+    BaseStream &operator << (const Ty &Thing) {
       if (Stream) *Stream << Thing;
       return *this;
     }
 
-    bool operator == (const std::ostream &OS) { return &OS == Stream; }
-    bool operator == (const llvm_ostream &OS) { return OS.Stream == Stream; }
+    template <typename Ty>
+    BaseStream &operator >> (const Ty &Thing) {
+      if (Stream) *Stream >> Thing;
+      return *this;
+    }
+
+    bool operator == (const StreamTy &S) { return &S == Stream; }
+    bool operator != (const StreamTy &S) { return !(*this == S); }
+    bool operator == (const BaseStream &S) { return S.Stream == Stream; }
+    bool operator != (const BaseStream &S) { return !(*this == S); }
   };
 
-  extern llvm_ostream llvm_null;
-  extern llvm_ostream llvm_cout;
-  extern llvm_ostream llvm_cerr;
+  typedef BaseStream<std::ostream> OStream;
+  typedef BaseStream<std::istream> IStream;
+  typedef BaseStream<std::stringstream> StringStream;
+
+  extern OStream NullStream;
+  extern OStream cout;
+  extern OStream cerr;
+  extern IStream cin;
 
 } // End llvm namespace
 

+ 1 - 1
include/llvm/Type.h

@@ -136,7 +136,7 @@ protected:
   ///
   mutable std::vector<AbstractTypeUser *> AbstractTypeUsers;
 public:
-  void print(llvm_ostream &O) const {
+  void print(OStream &O) const {
     if (O.stream()) print(*O.stream());
   }
   void print(std::ostream &O) const;

+ 1 - 1
include/llvm/Value.h

@@ -75,7 +75,7 @@ public:
 
   /// print - Implement operator<< on Value...
   ///
-  void print(llvm_ostream &O) const {
+  void print(OStream &O) const {
     if (O.stream()) print(*O.stream());
   }
   virtual void print(std::ostream &O) const = 0;

+ 17 - 21
lib/Analysis/AliasAnalysisCounter.cpp

@@ -39,37 +39,33 @@ namespace {
     }
 
     void printLine(const char *Desc, unsigned Val, unsigned Sum) {
-      llvm_cerr <<  "  " << Val << " " << Desc << " responses ("
-                << Val*100/Sum << "%)\n";
+      cerr <<  "  " << Val << " " << Desc << " responses ("
+           << Val*100/Sum << "%)\n";
     }
     ~AliasAnalysisCounter() {
       unsigned AASum = No+May+Must;
       unsigned MRSum = NoMR+JustRef+JustMod+MR;
       if (AASum + MRSum) { // Print a report if any counted queries occurred...
-        llvm_cerr
-          << "\n===== Alias Analysis Counter Report =====\n"
-          << "  Analysis counted: " << Name << "\n"
-          << "  " << AASum << " Total Alias Queries Performed\n";
+        cerr << "\n===== Alias Analysis Counter Report =====\n"
+             << "  Analysis counted: " << Name << "\n"
+             << "  " << AASum << " Total Alias Queries Performed\n";
         if (AASum) {
           printLine("no alias",     No, AASum);
           printLine("may alias",   May, AASum);
           printLine("must alias", Must, AASum);
-          llvm_cerr
-            << "  Alias Analysis Counter Summary: " << No*100/AASum << "%/"
-            << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n";
+          cerr << "  Alias Analysis Counter Summary: " << No*100/AASum << "%/"
+               << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n";
         }
 
-        llvm_cerr
-          << "  " << MRSum    << " Total Mod/Ref Queries Performed\n";
+        cerr << "  " << MRSum    << " Total Mod/Ref Queries Performed\n";
         if (MRSum) {
           printLine("no mod/ref",    NoMR, MRSum);
           printLine("ref",        JustRef, MRSum);
           printLine("mod",        JustMod, MRSum);
           printLine("mod/ref",         MR, MRSum);
-          llvm_cerr
-            << "  Mod/Ref Analysis Counter Summary: " << NoMR*100/MRSum<< "%/"
-            << JustRef*100/MRSum << "%/" << JustMod*100/MRSum << "%/"
-            << MR*100/MRSum <<"%\n\n";
+          cerr << "  Mod/Ref Analysis Counter Summary: " <<NoMR*100/MRSum<< "%/"
+               << JustRef*100/MRSum << "%/" << JustMod*100/MRSum << "%/"
+               << MR*100/MRSum <<"%\n\n";
         }
       }
     }
@@ -133,10 +129,10 @@ AliasAnalysisCounter::alias(const Value *V1, unsigned V1Size,
   }
 
   if (PrintAll || (PrintAllFailures && R == MayAlias)) {
-    llvm_cerr << AliasString << ":\t";
-    llvm_cerr << "[" << V1Size << "B] ";
+    cerr << AliasString << ":\t";
+    cerr << "[" << V1Size << "B] ";
     WriteAsOperand(std::cerr, V1, true, M) << ", ";
-    llvm_cerr << "[" << V2Size << "B] ";
+    cerr << "[" << V2Size << "B] ";
     WriteAsOperand(std::cerr, V2, true, M) << "\n";
   }
 
@@ -157,10 +153,10 @@ AliasAnalysisCounter::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
   }
 
   if (PrintAll || (PrintAllFailures && R == ModRef)) {
-    llvm_cerr << MRString << ":  Ptr: ";
-    llvm_cerr << "[" << Size << "B] ";
+    cerr << MRString << ":  Ptr: ";
+    cerr << "[" << Size << "B] ";
     WriteAsOperand(std::cerr, P, true, M);
-    llvm_cerr << "\t<->" << *CS.getInstruction();
+    cerr << "\t<->" << *CS.getInstruction();
   }
   return R;
 }

+ 26 - 26
lib/Analysis/AliasAnalysisEvaluator.cpp

@@ -79,7 +79,7 @@ FunctionPass *llvm::createAAEvalPass() { return new AAEval(); }
 static inline void PrintResults(const char *Msg, bool P, Value *V1, Value *V2,
                                 Module *M) {
   if (P) {
-    llvm_cerr << "  " << Msg << ":\t";
+    cerr << "  " << Msg << ":\t";
     WriteAsOperand(std::cerr, V1, true, M) << ", ";
     WriteAsOperand(std::cerr, V2, true, M) << "\n";
   }
@@ -89,9 +89,9 @@ static inline void
 PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr,
                    Module *M) {
   if (P) {
-    llvm_cerr << "  " << Msg << ":  Ptr: ";
+    cerr << "  " << Msg << ":  Ptr: ";
     WriteAsOperand(std::cerr, Ptr, true, M);
-    llvm_cerr << "\t<->" << *I;
+    cerr << "\t<->" << *I;
   }
 }
 
@@ -125,8 +125,8 @@ bool AAEval::runOnFunction(Function &F) {
 
   if (PrintNoAlias || PrintMayAlias || PrintMustAlias ||
       PrintNoModRef || PrintMod || PrintRef || PrintModRef)
-    llvm_cerr << "Function: " << F.getName() << ": " << Pointers.size()
-              << " pointers, " << CallSites.size() << " call sites\n";
+    cerr << "Function: " << F.getName() << ": " << Pointers.size()
+         << " pointers, " << CallSites.size() << " call sites\n";
 
   // iterate over the worklist, and run the full (n^2)/2 disambiguations
   for (std::set<Value *>::iterator I1 = Pointers.begin(), E = Pointers.end();
@@ -151,7 +151,7 @@ bool AAEval::runOnFunction(Function &F) {
         PrintResults("MustAlias", PrintMustAlias, *I1, *I2, F.getParent());
         ++MustAlias; break;
       default:
-        llvm_cerr << "Unknown alias query result!\n";
+        cerr << "Unknown alias query result!\n";
       }
     }
   }
@@ -181,7 +181,7 @@ bool AAEval::runOnFunction(Function &F) {
         PrintModRefResults("  ModRef", PrintModRef, I, *V, F.getParent());
         ++ModRef; break;
       default:
-        llvm_cerr << "Unknown alias query result!\n";
+        cerr << "Unknown alias query result!\n";
       }
     }
   }
@@ -190,45 +190,45 @@ bool AAEval::runOnFunction(Function &F) {
 }
 
 static void PrintPercent(unsigned Num, unsigned Sum) {
-  llvm_cerr << "(" << Num*100ULL/Sum << "."
+  cerr << "(" << Num*100ULL/Sum << "."
             << ((Num*1000ULL/Sum) % 10) << "%)\n";
 }
 
 bool AAEval::doFinalization(Module &M) {
   unsigned AliasSum = NoAlias + MayAlias + MustAlias;
-  llvm_cerr << "===== Alias Analysis Evaluator Report =====\n";
+  cerr << "===== Alias Analysis Evaluator Report =====\n";
   if (AliasSum == 0) {
-    llvm_cerr << "  Alias Analysis Evaluator Summary: No pointers!\n";
+    cerr << "  Alias Analysis Evaluator Summary: No pointers!\n";
   } else {
-    llvm_cerr << "  " << AliasSum << " Total Alias Queries Performed\n";
-    llvm_cerr << "  " << NoAlias << " no alias responses ";
+    cerr << "  " << AliasSum << " Total Alias Queries Performed\n";
+    cerr << "  " << NoAlias << " no alias responses ";
     PrintPercent(NoAlias, AliasSum);
-    llvm_cerr << "  " << MayAlias << " may alias responses ";
+    cerr << "  " << MayAlias << " may alias responses ";
     PrintPercent(MayAlias, AliasSum);
-    llvm_cerr << "  " << MustAlias << " must alias responses ";
+    cerr << "  " << MustAlias << " must alias responses ";
     PrintPercent(MustAlias, AliasSum);
-    llvm_cerr << "  Alias Analysis Evaluator Pointer Alias Summary: "
-              << NoAlias*100/AliasSum  << "%/" << MayAlias*100/AliasSum << "%/"
-              << MustAlias*100/AliasSum << "%\n";
+    cerr << "  Alias Analysis Evaluator Pointer Alias Summary: "
+         << NoAlias*100/AliasSum  << "%/" << MayAlias*100/AliasSum << "%/"
+         << MustAlias*100/AliasSum << "%\n";
   }
 
   // Display the summary for mod/ref analysis
   unsigned ModRefSum = NoModRef + Mod + Ref + ModRef;
   if (ModRefSum == 0) {
-    llvm_cerr << "  Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n";
+    cerr << "  Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n";
   } else {
-    llvm_cerr << "  " << ModRefSum << " Total ModRef Queries Performed\n";
-    llvm_cerr << "  " << NoModRef << " no mod/ref responses ";
+    cerr << "  " << ModRefSum << " Total ModRef Queries Performed\n";
+    cerr << "  " << NoModRef << " no mod/ref responses ";
     PrintPercent(NoModRef, ModRefSum);
-    llvm_cerr << "  " << Mod << " mod responses ";
+    cerr << "  " << Mod << " mod responses ";
     PrintPercent(Mod, ModRefSum);
-    llvm_cerr << "  " << Ref << " ref responses ";
+    cerr << "  " << Ref << " ref responses ";
     PrintPercent(Ref, ModRefSum);
-    llvm_cerr << "  " << ModRef << " mod & ref responses ";
+    cerr << "  " << ModRef << " mod & ref responses ";
     PrintPercent(ModRef, ModRefSum);
-    llvm_cerr << "  Alias Analysis Evaluator Mod/Ref Summary: "
-              << NoModRef*100/ModRefSum  << "%/" << Mod*100/ModRefSum << "%/"
-              << Ref*100/ModRefSum << "%/" << ModRef*100/ModRefSum << "%\n";
+    cerr << "  Alias Analysis Evaluator Mod/Ref Summary: "
+         << NoModRef*100/ModRefSum  << "%/" << Mod*100/ModRefSum << "%/"
+         << Ref*100/ModRefSum << "%/" << ModRef*100/ModRefSum << "%\n";
   }
 
   return false;

+ 3 - 3
lib/Analysis/AliasSetTracker.cpp

@@ -543,8 +543,8 @@ void AliasSetTracker::print(std::ostream &OS) const {
   OS << "\n";
 }
 
-void AliasSet::dump() const { print (llvm_cerr); }
-void AliasSetTracker::dump() const { print(llvm_cerr); }
+void AliasSet::dump() const { print (cerr); }
+void AliasSetTracker::dump() const { print(cerr); }
 
 //===----------------------------------------------------------------------===//
 //                            AliasSetPrinter Pass
@@ -564,7 +564,7 @@ namespace {
 
       for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
         Tracker->add(&*I);
-      Tracker->print(llvm_cerr);
+      Tracker->print(cerr);
       delete Tracker;
       return false;
     }

+ 2 - 2
lib/Analysis/BasicAliasAnalysis.cpp

@@ -745,8 +745,8 @@ BasicAliasAnalysis::CheckGEPInstructions(
     assert(Offset1<Offset2 && "There is at least one different constant here!");
 
     if ((uint64_t)(Offset2-Offset1) >= SizeMax) {
-      //llvm_cerr << "Determined that these two GEP's don't alias ["
-      //          << SizeMax << " bytes]: \n" << *GEP1 << *GEP2;
+      //cerr << "Determined that these two GEP's don't alias ["
+      //     << SizeMax << " bytes]: \n" << *GEP1 << *GEP2;
       return NoAlias;
     }
   }

+ 3 - 3
lib/Analysis/CFGPrinter.cpp

@@ -92,14 +92,14 @@ namespace {
   struct CFGPrinter : public FunctionPass {
     virtual bool runOnFunction(Function &F) {
       std::string Filename = "cfg." + F.getName() + ".dot";
-      llvm_cerr << "Writing '" << Filename << "'...";
+      cerr << "Writing '" << Filename << "'...";
       std::ofstream File(Filename.c_str());
 
       if (File.good())
         WriteGraph(File, (const Function*)&F);
       else
-        llvm_cerr << "  error opening file for writing!";
-      llvm_cerr << "\n";
+        cerr << "  error opening file for writing!";
+      cerr << "\n";
       return false;
     }
 

+ 1 - 1
lib/Analysis/ConstantRange.cpp

@@ -370,5 +370,5 @@ void ConstantRange::print(std::ostream &OS) const {
 /// dump - Allow printing from a debugger easily...
 ///
 void ConstantRange::dump() const {
-  print(llvm_cerr);
+  print(cerr);
 }

+ 12 - 12
lib/Analysis/DataStructure/BottomUpClosure.cpp

@@ -501,7 +501,7 @@ DSGraph &BUDataStructures::CreateGraphForExternalFunction(const Function &Fn) {
     DSG->getNodeForValue(F->arg_begin()).mergeWith(N);
 
   } else {
-    llvm_cerr << "Unrecognized external function: " << F->getName() << "\n";
+    cerr << "Unrecognized external function: " << F->getName() << "\n";
     abort();
   }
 
@@ -588,21 +588,21 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
         ++NumBUInlines;
       } else {
         if (!Printed)
-          llvm_cerr << "In Fns: " << Graph.getFunctionNames() << "\n";
-        llvm_cerr << "  calls " << CalledFuncs.size()
-                  << " fns from site: " << CS.getCallSite().getInstruction()
-                  << "  " << *CS.getCallSite().getInstruction();
-        llvm_cerr << "   Fns =";
+          cerr << "In Fns: " << Graph.getFunctionNames() << "\n";
+        cerr << "  calls " << CalledFuncs.size()
+             << " fns from site: " << CS.getCallSite().getInstruction()
+             << "  " << *CS.getCallSite().getInstruction();
+        cerr << "   Fns =";
         unsigned NumPrinted = 0;
 
         for (std::vector<Function*>::iterator I = CalledFuncs.begin(),
                E = CalledFuncs.end(); I != E; ++I) {
-          if (NumPrinted++ < 8) llvm_cerr << " " << (*I)->getName();
+          if (NumPrinted++ < 8) cerr << " " << (*I)->getName();
 
           // Add the call edges to the call graph.
           ActualCallees.insert(std::make_pair(TheCall, *I));
         }
-        llvm_cerr << "\n";
+        cerr << "\n";
 
         // See if we already computed a graph for this set of callees.
         std::sort(CalledFuncs.begin(), CalledFuncs.end());
@@ -645,7 +645,7 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
           // Clean up the final graph!
           GI->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
         } else {
-          llvm_cerr << "***\n*** RECYCLED GRAPH ***\n***\n";
+          cerr << "***\n*** RECYCLED GRAPH ***\n***\n";
         }
 
         GI = IndCallGraph.first;
@@ -685,7 +685,7 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
          E = MainSM.global_end(); I != E; ++I)
     RC.getClonedNH(MainSM[*I]);
 
-  //Graph.writeGraphToFile(llvm_cerr, "bu_" + F.getName());
+  //Graph.writeGraphToFile(cerr, "bu_" + F.getName());
 }
 
 static const Function *getFnForValue(const Value *V) {
@@ -746,8 +746,8 @@ void BUDataStructures::copyValue(Value *From, Value *To) {
     return;
   }
 
-  llvm_cerr << *From;
-  llvm_cerr << *To;
+  cerr << *From;
+  cerr << *To;
   assert(0 && "Do not know how to copy this yet!");
   abort();
 }

+ 7 - 7
lib/Analysis/DataStructure/CallTargets.cpp

@@ -17,15 +17,15 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Analysis/DataStructure/CallTargets.h"
 #include "llvm/Module.h"
 #include "llvm/Instructions.h"
 #include "llvm/Analysis/DataStructure/DataStructure.h"
 #include "llvm/Analysis/DataStructure/DSGraph.h"
-#include "llvm/Analysis/DataStructure/CallTargets.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/Streams.h"
-#include <ostream>
 #include "llvm/Constants.h"
+#include <ostream>
 using namespace llvm;
 
 namespace {
@@ -58,11 +58,11 @@ void CallTargetFinder::findIndTargets(Module &M)
               } 
               if (N->isComplete() && !IndMap[cs].size()) {
                 ++CompleteEmpty;
-                llvm_cerr << "Call site empty: '"
-                << cs.getInstruction()->getName() 
-                          << "' In '"
-                << cs.getInstruction()->getParent()->getParent()->getName()
-                          << "'\n";
+                cerr << "Call site empty: '"
+                     << cs.getInstruction()->getName() 
+                     << "' In '"
+                     << cs.getInstruction()->getParent()->getParent()->getName()
+                     << "'\n";
               }
             } else {
               ++DirCall;

+ 1 - 2
lib/Analysis/DataStructure/DataStructure.cpp

@@ -25,7 +25,6 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SCCIterator.h"
 #include "llvm/ADT/Statistic.h"
-#include "llvm/Support/Streams.h"
 #include "llvm/Support/Timer.h"
 #include <iostream>
 #include <algorithm>
@@ -1263,7 +1262,7 @@ DSGraph::~DSGraph() {
 }
 
 // dump - Allow inspection of graph in a debugger.
-void DSGraph::dump() const { print(llvm_cerr); }
+void DSGraph::dump() const { print(cerr); }
 
 
 /// remapLinks - Change all of the Links in the current node according to the

+ 6 - 6
lib/Analysis/DataStructure/DataStructureStats.cpp

@@ -92,18 +92,18 @@ void DSGraphStats::countCallees(const Function& F) {
         totalNumCallees  += Callees.size();
         ++numIndirectCalls;
       } else
-        llvm_cerr << "WARNING: No callee in Function '" << F.getName()
-                  << "' at call: \n"
-                  << *I->getCallSite().getInstruction();
+        cerr << "WARNING: No callee in Function '" << F.getName()
+             << "' at call: \n"
+             << *I->getCallSite().getInstruction();
     }
 
   TotalNumCallees  += totalNumCallees;
   NumIndirectCalls += numIndirectCalls;
 
   if (numIndirectCalls)
-    llvm_cout << "  In function " << F.getName() << ":  "
-              << (totalNumCallees / (double) numIndirectCalls)
-              << " average callees per indirect call\n";
+    cout << "  In function " << F.getName() << ":  "
+         << (totalNumCallees / (double) numIndirectCalls)
+         << " average callees per indirect call\n";
 }
 
 DSNode *DSGraphStats::getNodeForValue(Value *V) {

+ 1 - 1
lib/Analysis/DataStructure/EquivClassGraphs.cpp

@@ -90,7 +90,7 @@ bool EquivClassGraphs::runOnModule(Module &M) {
   if (MainFunc && !MainFunc->isExternal()) {
     processSCC(getOrCreateGraph(*MainFunc), Stack, NextID, ValMap);
   } else {
-    llvm_cerr << "Fold Graphs: No 'main' function found!\n";
+    cerr << "Fold Graphs: No 'main' function found!\n";
   }
 
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)

+ 16 - 16
lib/Analysis/DataStructure/GraphChecker.cpp

@@ -84,8 +84,8 @@ FunctionPass *llvm::createDataStructureGraphCheckerPass() {
 DSGC::DSGC() {
   if (!AbortIfAnyCollapsed && AbortIfCollapsed.empty() &&
       CheckFlags.empty() && AbortIfMerged.empty()) {
-    llvm_cerr << "The -datastructure-gc is useless if you don't specify any"
-                 " -dsgc-* options.  See the -help-hidden output for a list.\n";
+    cerr << "The -datastructure-gc is useless if you don't specify any"
+         << " -dsgc-* options.  See the -help-hidden output for a list.\n";
     abort();
   }
 }
@@ -123,8 +123,8 @@ void DSGC::verify(const DSGraph &G) {
     for (DSGraph::node_const_iterator I = G.node_begin(), E = G.node_end();
          I != E; ++I)
       if (I->isNodeCompletelyFolded()) {
-        llvm_cerr << "Node is collapsed: ";
-        I->print(llvm_cerr, &G);
+        cerr << "Node is collapsed: ";
+        I->print(cerr, &G);
         abort();
       }
   }
@@ -142,8 +142,8 @@ void DSGC::verify(const DSGraph &G) {
            E = CheckFlags.end(); I != E; ++I) {
       std::string::size_type ColonPos = I->rfind(':');
       if (ColonPos == std::string::npos) {
-        llvm_cerr << "Error: '" << *I
-               << "' is an invalid value for the --dsgc-check-flags option!\n";
+        cerr << "Error: '" << *I
+             << "' is an invalid value for the --dsgc-check-flags option!\n";
         abort();
       }
 
@@ -158,7 +158,7 @@ void DSGC::verify(const DSGraph &G) {
         case 'M': Flags |= DSNode::Modified;    break;
         case 'R': Flags |= DSNode::Read;        break;
         case 'A': Flags |= DSNode::Array;       break;
-        default: llvm_cerr << "Invalid DSNode flag!\n"; abort();
+        default: cerr << "Invalid DSNode flag!\n"; abort();
         }
       CheckFlagsM[std::string(I->begin(), I->begin()+ColonPos)] = Flags;
     }
@@ -176,25 +176,25 @@ void DSGC::verify(const DSGraph &G) {
 
         // Verify it is not collapsed if it is not supposed to be...
         if (N->isNodeCompletelyFolded() && AbortIfCollapsedS.count(Name)) {
-          llvm_cerr << "Node for value '%" << Name << "' is collapsed: ";
-          N->print(llvm_cerr, &G);
+          cerr << "Node for value '%" << Name << "' is collapsed: ";
+          N->print(cerr, &G);
           abort();
         }
 
         if (CheckFlagsM.count(Name) && CheckFlagsM[Name] != N->getNodeFlags()) {
-          llvm_cerr << "Node flags are not as expected for node: " << Name 
-                    << " (" << CheckFlagsM[Name] << ":" <<N->getNodeFlags()
-                    << ")\n";
-          N->print(llvm_cerr, &G);
+          cerr << "Node flags are not as expected for node: " << Name 
+               << " (" << CheckFlagsM[Name] << ":" <<N->getNodeFlags()
+               << ")\n";
+          N->print(cerr, &G);
           abort();
         }
 
         // Verify that it is not merged if it is not supposed to be...
         if (AbortIfMergedS.count(Name)) {
           if (AbortIfMergedNodes.count(N)) {
-            llvm_cerr << "Nodes for values '%" << Name << "' and '%"
-                      << AbortIfMergedNodes[N] << "' is merged: ";
-            N->print(llvm_cerr, &G);
+            cerr << "Nodes for values '%" << Name << "' and '%"
+                 << AbortIfMergedNodes[N] << "' is merged: ";
+            N->print(cerr, &G);
             abort();
           }
           AbortIfMergedNodes[N] = Name;

+ 2 - 2
lib/Analysis/DataStructure/Local.cpp

@@ -434,7 +434,7 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) {
         // Variable index into a node.  We must merge all of the elements of the
         // sequential type here.
         if (isa<PointerType>(STy))
-          llvm_cerr << "Pointer indexing not handled yet!\n";
+          cerr << "Pointer indexing not handled yet!\n";
         else {
           const ArrayType *ATy = cast<ArrayType>(STy);
           unsigned ElSize = TD.getTypeSize(CurTy);
@@ -1061,7 +1061,7 @@ void GraphBuilder::visitCallSite(CallSite CS) {
   if (DisableDirectCallOpt || !isa<Function>(Callee)) {
     CalleeNode = getValueDest(*Callee).getNode();
     if (CalleeNode == 0) {
-      llvm_cerr << "WARNING: Program is calling through a null pointer?\n"<< *I;
+      cerr << "WARNING: Program is calling through a null pointer?\n"<< *I;
       return;  // Calling a null pointer?
     }
   }

+ 1 - 1
lib/Analysis/DataStructure/Printer.cpp

@@ -37,7 +37,7 @@ namespace {
   Statistic NumFoldedNodes ("dsa", "Number of folded nodes (in final graph)");
 }
 
-void DSNode::dump() const { print(llvm_cerr, 0); }
+void DSNode::dump() const { print(cerr, 0); }
 
 static std::string getCaption(const DSNode *N, const DSGraph *G) {
   std::stringstream OS;

+ 1 - 1
lib/Analysis/DataStructure/Steensgaard.cpp

@@ -53,7 +53,7 @@ namespace {
     }
 
     // print - Implement the Pass::print method...
-    void print(llvm_ostream O, const Module *M) const {
+    void print(OStream O, const Module *M) const {
       if (O.stream()) print(*O.stream(), M);
     }
     void print(std::ostream &O, const Module *M) const {

+ 24 - 24
lib/Analysis/IPA/Andersens.cpp

@@ -533,7 +533,7 @@ Andersens::Node *Andersens::getNodeForConstantPointer(Constant *C) {
     case Instruction::BitCast:
       return getNodeForConstantPointer(CE->getOperand(0));
     default:
-      llvm_cerr << "Constant Expr not yet handled: " << *CE << "\n";
+      cerr << "Constant Expr not yet handled: " << *CE << "\n";
       assert(0);
     }
   } else {
@@ -560,7 +560,7 @@ Andersens::Node *Andersens::getNodeForConstantPointerTarget(Constant *C) {
     case Instruction::BitCast:
       return getNodeForConstantPointerTarget(CE->getOperand(0));
     default:
-      llvm_cerr << "Constant Expr not yet handled: " << *CE << "\n";
+      cerr << "Constant Expr not yet handled: " << *CE << "\n";
       assert(0);
     }
   } else {
@@ -786,7 +786,7 @@ void Andersens::visitInstruction(Instruction &I) {
     return;
   default:
     // Is this something we aren't handling yet?
-    llvm_cerr << "Unknown instruction: " << I;
+    cerr << "Unknown instruction: " << I;
     abort();
   }
 }
@@ -1104,13 +1104,13 @@ void Andersens::SolveConstraints() {
 
 void Andersens::PrintNode(Node *N) {
   if (N == &GraphNodes[UniversalSet]) {
-    llvm_cerr << "<universal>";
+    cerr << "<universal>";
     return;
   } else if (N == &GraphNodes[NullPtr]) {
-    llvm_cerr << "<nullptr>";
+    cerr << "<nullptr>";
     return;
   } else if (N == &GraphNodes[NullObject]) {
-    llvm_cerr << "<null>";
+    cerr << "<null>";
     return;
   }
 
@@ -1119,56 +1119,56 @@ void Andersens::PrintNode(Node *N) {
   if (Function *F = dyn_cast<Function>(V)) {
     if (isa<PointerType>(F->getFunctionType()->getReturnType()) &&
         N == getReturnNode(F)) {
-      llvm_cerr << F->getName() << ":retval";
+      cerr << F->getName() << ":retval";
       return;
     } else if (F->getFunctionType()->isVarArg() && N == getVarargNode(F)) {
-      llvm_cerr << F->getName() << ":vararg";
+      cerr << F->getName() << ":vararg";
       return;
     }
   }
 
   if (Instruction *I = dyn_cast<Instruction>(V))
-    llvm_cerr << I->getParent()->getParent()->getName() << ":";
+    cerr << I->getParent()->getParent()->getName() << ":";
   else if (Argument *Arg = dyn_cast<Argument>(V))
-    llvm_cerr << Arg->getParent()->getName() << ":";
+    cerr << Arg->getParent()->getName() << ":";
 
   if (V->hasName())
-    llvm_cerr << V->getName();
+    cerr << V->getName();
   else
-    llvm_cerr << "(unnamed)";
+    cerr << "(unnamed)";
 
   if (isa<GlobalValue>(V) || isa<AllocationInst>(V))
     if (N == getObject(V))
-      llvm_cerr << "<mem>";
+      cerr << "<mem>";
 }
 
 void Andersens::PrintConstraints() {
-  llvm_cerr << "Constraints:\n";
+  cerr << "Constraints:\n";
   for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
-    llvm_cerr << "  #" << i << ":  ";
+    cerr << "  #" << i << ":  ";
     Constraint &C = Constraints[i];
     if (C.Type == Constraint::Store)
-      llvm_cerr << "*";
+      cerr << "*";
     PrintNode(C.Dest);
-    llvm_cerr << " = ";
+    cerr << " = ";
     if (C.Type == Constraint::Load)
-      llvm_cerr << "*";
+      cerr << "*";
     PrintNode(C.Src);
-    llvm_cerr << "\n";
+    cerr << "\n";
   }
 }
 
 void Andersens::PrintPointsToGraph() {
-  llvm_cerr << "Points-to graph:\n";
+  cerr << "Points-to graph:\n";
   for (unsigned i = 0, e = GraphNodes.size(); i != e; ++i) {
     Node *N = &GraphNodes[i];
-    llvm_cerr << "[" << (N->end() - N->begin()) << "] ";
+    cerr << "[" << (N->end() - N->begin()) << "] ";
     PrintNode(N);
-    llvm_cerr << "\t--> ";
+    cerr << "\t--> ";
     for (Node::iterator I = N->begin(), E = N->end(); I != E; ++I) {
-      if (I != N->begin()) llvm_cerr << ", ";
+      if (I != N->begin()) cerr << ", ";
       PrintNode(*I);
     }
-    llvm_cerr << "\n";
+    cerr << "\n";
   }
 }

+ 4 - 4
lib/Analysis/IPA/CallGraph.cpp

@@ -74,7 +74,7 @@ public:
     AU.setPreservesAll();
   }
 
-  void print(llvm_ostream &o, const Module *M) const {
+  void print(OStream &o, const Module *M) const {
     if (o.stream()) print(*o.stream(), M);
   }
 
@@ -95,7 +95,7 @@ public:
   /// dump - Print out this call graph.
   ///
   inline void dump() const {
-    print(llvm_cerr, Mod);
+    print(cerr, Mod);
   }
 
   CallGraphNode* getExternalCallingNode() const { return ExternalCallingNode; }
@@ -212,7 +212,7 @@ void CallGraph::print(std::ostream &OS, const Module *M) const {
 }
 
 void CallGraph::dump() const {
-  print(llvm_cerr, 0);
+  print(cerr, 0);
 }
 
 //===----------------------------------------------------------------------===//
@@ -275,7 +275,7 @@ void CallGraphNode::print(std::ostream &OS) const {
   OS << "\n";
 }
 
-void CallGraphNode::dump() const { print(llvm_cerr); }
+void CallGraphNode::dump() const { print(cerr); }
 
 void CallGraphNode::removeCallEdgeTo(CallGraphNode *Callee) {
   for (unsigned i = CalledFunctions.size(); ; --i) {

+ 1 - 1
lib/Analysis/InstCount.cpp

@@ -43,7 +43,7 @@ namespace {
 #include "llvm/Instruction.def"
 
     void visitInstruction(Instruction &I) {
-      llvm_cerr << "Instruction Count does not know about " << I;
+      cerr << "Instruction Count does not know about " << I;
       abort();
     }
   public:

+ 1 - 1
lib/Analysis/LoopInfo.cpp

@@ -80,7 +80,7 @@ void Loop::print(std::ostream &OS, unsigned Depth) const {
 }
 
 void Loop::dump() const {
-  print(llvm_cerr);
+  print(cerr);
 }
 
 

+ 14 - 15
lib/Analysis/ProfileInfoLoader.cpp

@@ -37,7 +37,7 @@ static void ReadProfilingBlock(const char *ToolName, FILE *F,
   // Read the number of entries...
   unsigned NumEntries;
   if (fread(&NumEntries, sizeof(unsigned), 1, F) != 1) {
-    llvm_cerr << ToolName << ": data packet truncated!\n";
+    cerr << ToolName << ": data packet truncated!\n";
     perror(0);
     exit(1);
   }
@@ -48,7 +48,7 @@ static void ReadProfilingBlock(const char *ToolName, FILE *F,
 
   // Read in the block of data...
   if (fread(&TempSpace[0], sizeof(unsigned)*NumEntries, 1, F) != 1) {
-    llvm_cerr << ToolName << ": data packet truncated!\n";
+    cerr << ToolName << ": data packet truncated!\n";
     perror(0);
     exit(1);
   }
@@ -75,7 +75,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName,
                                      Module &TheModule) : M(TheModule) {
   FILE *F = fopen(Filename.c_str(), "r");
   if (F == 0) {
-    llvm_cerr << ToolName << ": Error opening '" << Filename << "': ";
+    cerr << ToolName << ": Error opening '" << Filename << "': ";
     perror(0);
     exit(1);
   }
@@ -93,7 +93,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName,
     case ArgumentInfo: {
       unsigned ArgLength;
       if (fread(&ArgLength, sizeof(unsigned), 1, F) != 1) {
-        llvm_cerr << ToolName << ": arguments packet truncated!\n";
+        cerr << ToolName << ": arguments packet truncated!\n";
         perror(0);
         exit(1);
       }
@@ -104,7 +104,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName,
 
       if (ArgLength)
         if (fread(&Chars[0], (ArgLength+3) & ~3, 1, F) != 1) {
-          llvm_cerr << ToolName << ": arguments packet truncated!\n";
+          cerr << ToolName << ": arguments packet truncated!\n";
           perror(0);
           exit(1);
         }
@@ -129,7 +129,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName,
       break;
 
     default:
-      llvm_cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n";
+      cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n";
       exit(1);
     }
   }
@@ -156,7 +156,7 @@ void ProfileInfoLoader::getFunctionCounts(std::vector<std::pair<Function*,
           Counts.push_back(std::make_pair(BlockCounts[i].first->getParent(),
                                           BlockCounts[i].second));
     } else {
-      llvm_cerr << "Function counts are not available!\n";
+      cerr << "Function counts are not available!\n";
     }
     return;
   }
@@ -200,8 +200,8 @@ void ProfileInfoLoader::getBlockCounts(std::vector<std::pair<BasicBlock*,
         if (SuccNum >= TI->getNumSuccessors()) {
           static bool Warned = false;
           if (!Warned) {
-            llvm_cerr << "WARNING: profile info doesn't seem to match"
-                      << " the program!\n";
+            cerr << "WARNING: profile info doesn't seem to match"
+                 << " the program!\n";
             Warned = true;
           }
         } else {
@@ -226,7 +226,7 @@ void ProfileInfoLoader::getBlockCounts(std::vector<std::pair<BasicBlock*,
       }
 
     } else {
-      llvm_cerr << "Block counts are not available!\n";
+      cerr << "Block counts are not available!\n";
     }
     return;
   }
@@ -247,8 +247,8 @@ void ProfileInfoLoader::getBlockCounts(std::vector<std::pair<BasicBlock*,
 void ProfileInfoLoader::getEdgeCounts(std::vector<std::pair<Edge,
                                                   unsigned> > &Counts) {
   if (EdgeCounts.empty()) {
-    llvm_cerr << "Edge counts not available, and no synthesis "
-              << "is implemented yet!\n";
+    cerr << "Edge counts not available, and no synthesis "
+         << "is implemented yet!\n";
     return;
   }
 
@@ -268,9 +268,8 @@ void ProfileInfoLoader::getEdgeCounts(std::vector<std::pair<Edge,
 //
 void ProfileInfoLoader::getBBTrace(std::vector<BasicBlock *> &Trace) {
   if (BBTrace.empty ()) {
-    llvm_cerr << "Basic block trace is not available!\n";
+    cerr << "Basic block trace is not available!\n";
     return;
   }
-  llvm_cerr << "Basic block trace loading is not implemented yet!\n";
+  cerr << "Basic block trace loading is not implemented yet!\n";
 }
-

+ 2 - 2
lib/Analysis/ProfileInfoLoaderPass.cpp

@@ -76,8 +76,8 @@ bool LoaderPass::runOnModule(Module &M) {
     TerminatorInst *TI = BB->getTerminator();
     if (SuccNum >= TI->getNumSuccessors()) {
       if (!PrintedWarning) {
-        llvm_cerr << "WARNING: profile information is inconsistent with "
-                  << "the current program!\n";
+        cerr << "WARNING: profile information is inconsistent with "
+             << "the current program!\n";
         PrintedWarning = true;
       }
     } else {

+ 17 - 17
lib/Analysis/ScalarEvolution.cpp

@@ -118,7 +118,7 @@ namespace {
 //
 SCEV::~SCEV() {}
 void SCEV::dump() const {
-  print(llvm_cerr);
+  print(cerr);
 }
 
 /// getValueRange - Return the tightest constant bounds that this value is
@@ -1558,11 +1558,11 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) {
     break;
   default:
 #if 0
-    llvm_cerr << "ComputeIterationCount ";
+    cerr << "ComputeIterationCount ";
     if (ExitCond->getOperand(0)->getType()->isUnsigned())
-      llvm_cerr << "[unsigned] ";
-    llvm_cerr << *LHS << "   "
-              << Instruction::getOpcodeName(Cond) << "   " << *RHS << "\n";
+      cerr << "[unsigned] ";
+    cerr << *LHS << "   "
+         << Instruction::getOpcodeName(Cond) << "   " << *RHS << "\n";
 #endif
     break;
   }
@@ -1678,9 +1678,9 @@ ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS,
     if (!isa<ConstantBool>(Result)) break;  // Couldn't decide for sure
     if (cast<ConstantBool>(Result)->getValue() == false) {
 #if 0
-      llvm_cerr << "\n***\n*** Computed loop count " << *ItCst
-                << "\n*** From global " << *GV << "*** BB: " << *L->getHeader()
-                << "***\n";
+      cerr << "\n***\n*** Computed loop count " << *ItCst
+           << "\n*** From global " << *GV << "*** BB: " << *L->getHeader()
+           << "***\n";
 #endif
       ++NumArrayLenItCounts;
       return SCEVConstant::get(ItCst);   // Found terminating iteration!
@@ -2147,8 +2147,8 @@ SCEVHandle ScalarEvolutionsImpl::HowFarToZero(SCEV *V, const Loop *L) {
     SCEVConstant *R2 = dyn_cast<SCEVConstant>(Roots.second);
     if (R1) {
 #if 0
-      llvm_cerr << "HFTZ: " << *V << " - sol#1: " << *R1
-                << "  sol#2: " << *R2 << "\n";
+      cerr << "HFTZ: " << *V << " - sol#1: " << *R1
+           << "  sol#2: " << *R2 << "\n";
 #endif
       // Pick the smallest positive root value.
       assert(R1->getType()->isUnsigned()&&"Didn't canonicalize to unsigned?");
@@ -2276,8 +2276,8 @@ HowManyLessThans(SCEV *LHS, SCEV *RHS, const Loop *L) {
     default: break;
     }
 
-    //llvm_cerr << "Computed Loop Trip Count as: " <<
-    //  *SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)) << "\n";
+    //cerr << "Computed Loop Trip Count as: "
+    //     << *SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)) << "\n";
     return SCEV::getMinusSCEV(RHS, AddRec->getOperand(0));
   }
 
@@ -2492,20 +2492,20 @@ static void PrintLoopInfo(std::ostream &OS, const ScalarEvolution *SE,
   for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
     PrintLoopInfo(OS, SE, *I);
 
-  llvm_cerr << "Loop " << L->getHeader()->getName() << ": ";
+  cerr << "Loop " << L->getHeader()->getName() << ": ";
 
   std::vector<BasicBlock*> ExitBlocks;
   L->getExitBlocks(ExitBlocks);
   if (ExitBlocks.size() != 1)
-    llvm_cerr << "<multiple exits> ";
+    cerr << "<multiple exits> ";
 
   if (SE->hasLoopInvariantIterationCount(L)) {
-    llvm_cerr << *SE->getIterationCount(L) << " iterations! ";
+    cerr << *SE->getIterationCount(L) << " iterations! ";
   } else {
-    llvm_cerr << "Unpredictable iteration count. ";
+    cerr << "Unpredictable iteration count. ";
   }
 
-  llvm_cerr << "\n";
+  cerr << "\n";
 }
 
 void ScalarEvolution::print(std::ostream &OS, const Module* ) const {

+ 2 - 3
lib/Analysis/ScalarEvolutionExpander.cpp

@@ -13,9 +13,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Analysis/ScalarEvolutionExpander.h"
-
+#include "llvm/Analysis/LoopInfo.h"
 using namespace llvm;
 
 /// InsertCastOfTo - Insert a cast of V to the specified type, doing what
@@ -175,7 +174,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) {
   SCEVHandle IH = SCEVUnknown::get(I);   // Get I as a "symbolic" SCEV.
 
   SCEVHandle V = S->evaluateAtIteration(IH);
-  //llvm_cerr << "Evaluated: " << *this << "\n     to: " << *V << "\n";
+  //cerr << "Evaluated: " << *this << "\n     to: " << *V << "\n";
 
   return expandInTy(V, Ty);
 }

+ 2 - 3
lib/Analysis/Trace.cpp

@@ -25,14 +25,13 @@ Function *Trace::getFunction() const {
   return getEntryBasicBlock()->getParent();
 }
 
-
 Module *Trace::getModule() const {
   return getFunction()->getParent();
 }
 
 /// print - Write trace to output stream.
 ///
-void Trace::print(llvm_ostream &O) const {
+void Trace::print(OStream &O) const {
   Function *F = getFunction ();
   O << "; Trace from function " << F->getName() << ", blocks:\n";
   for (const_iterator i = begin(), e = end(); i != e; ++i) {
@@ -48,5 +47,5 @@ void Trace::print(llvm_ostream &O) const {
 /// output stream.
 ///
 void Trace::dump() const {
-  print(llvm_cerr);
+  print(cerr);
 }

文件差異過大導致無法顯示
+ 401 - 182
lib/AsmParser/llvmAsmParser.cpp.cvs


+ 25 - 15
lib/AsmParser/llvmAsmParser.h.cvs

@@ -1,7 +1,9 @@
-/* A Bison parser, made by GNU Bison 2.1.  */
+/* A Bison parser, made by GNU Bison 2.3.  */
 
-/* Skeleton parser for Yacc-like parsing with Bison,
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -18,10 +20,18 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.  */
 
-/* As a special exception, when this file is copied by Bison into a
-   Bison output file, you may use that output file without restriction.
-   This special exception was added by the Free Software Foundation
-   in version 1.24 of Bison.  */
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
 
 /* Tokens.  */
 #ifndef YYTOKENTYPE
@@ -320,9 +330,10 @@
 
 
 
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 855 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
-typedef union YYSTYPE {
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 855 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
+{
   llvm::Module                           *ModuleVal;
   llvm::Function                         *FunctionVal;
   std::pair<llvm::PATypeHolder*, char*>  *ArgVal;
@@ -363,9 +374,10 @@ typedef union YYSTYPE {
   llvm::Module::Endianness          Endianness;
   llvm::ICmpInst::Predicate         IPredicate;
   llvm::FCmpInst::Predicate         FPredicate;
-} YYSTYPE;
-/* Line 1447 of yacc.c.  */
-#line 369 "llvmAsmParser.tab.h"
+}
+/* Line 1529 of yacc.c.  */
+#line 380 "llvmAsmParser.tab.h"
+	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 # define YYSTYPE_IS_TRIVIAL 1
@@ -373,5 +385,3 @@ typedef union YYSTYPE {
 
 extern YYSTYPE llvmAsmlval;
 
-
-

+ 3 - 3
lib/AsmParser/llvmAsmParser.y

@@ -57,7 +57,7 @@ static Module *ParserResult;
 //
 //#define DEBUG_UPREFS 1
 #ifdef DEBUG_UPREFS
-#define UR_OUT(X) llvm_cerr << X
+#define UR_OUT(X) cerr << X
 #else
 #define UR_OUT(X)
 #endif
@@ -2390,8 +2390,8 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
       GEN_ERROR("fcmp operator returned null!");
   }
   | NOT ResolvedVal {
-    llvm_cerr << "WARNING: Use of eliminated 'not' instruction:"
-              << " Replacing with 'xor'.\n";
+    cerr << "WARNING: Use of eliminated 'not' instruction:"
+         << " Replacing with 'xor'.\n";
 
     Value *Ones = ConstantIntegral::getAllOnesValue($2->getType());
     if (Ones == 0)

+ 3 - 3
lib/AsmParser/llvmAsmParser.y.cvs

@@ -57,7 +57,7 @@ static Module *ParserResult;
 //
 //#define DEBUG_UPREFS 1
 #ifdef DEBUG_UPREFS
-#define UR_OUT(X) llvm_cerr << X
+#define UR_OUT(X) cerr << X
 #else
 #define UR_OUT(X)
 #endif
@@ -2390,8 +2390,8 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
       GEN_ERROR("fcmp operator returned null!");
   }
   | NOT ResolvedVal {
-    llvm_cerr << "WARNING: Use of eliminated 'not' instruction:"
-              << " Replacing with 'xor'.\n";
+    cerr << "WARNING: Use of eliminated 'not' instruction:"
+         << " Replacing with 'xor'.\n";
 
     Value *Ones = ConstantIntegral::getAllOnesValue($2->getType());
     if (Ones == 0)

+ 1 - 1
lib/Bytecode/Writer/SlotCalculator.cpp

@@ -32,7 +32,7 @@ using namespace llvm;
 
 #if 0
 #include "llvm/Support/Streams.h"
-#define SC_DEBUG(X) llvm_cerr << X
+#define SC_DEBUG(X) cerr << X
 #else
 #define SC_DEBUG(X)
 #endif

+ 6 - 6
lib/Bytecode/Writer/Writer.cpp

@@ -276,8 +276,8 @@ void BytecodeWriter::outputType(const Type *T) {
     break;
 
   default:
-    llvm_cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize"
-              << " Type '" << T->getDescription() << "'\n";
+    cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize"
+         << " Type '" << T->getDescription() << "'\n";
     break;
   }
 }
@@ -387,8 +387,8 @@ void BytecodeWriter::outputConstant(const Constant *CPV) {
   case Type::VoidTyID:
   case Type::LabelTyID:
   default:
-    llvm_cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize"
-              << " type '" << *CPV->getType() << "'\n";
+    cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize"
+         << " type '" << *CPV->getType() << "'\n";
     break;
   }
   return;
@@ -1239,13 +1239,13 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
   }
 }
 
-void llvm::WriteBytecodeToFile(const Module *M, llvm_ostream &Out,
+void llvm::WriteBytecodeToFile(const Module *M, OStream &Out,
                                bool compress) {
   assert(M && "You can't write a null module!!");
 
   // Make sure that std::cout is put into binary mode for systems
   // that care.
-  if (Out == llvm_cout)
+  if (Out == cout)
     sys::Program::ChangeStdoutToBinary();
 
   // Create a vector of unsigned char for the bytecode output. We

+ 18 - 19
lib/CodeGen/AsmPrinter.cpp

@@ -25,7 +25,6 @@
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetLowering.h"
 #include "llvm/Target/TargetMachine.h"
-#include <ostream>
 #include <cerrno>
 using namespace llvm;
 
@@ -668,8 +667,8 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) {
     if (LastMI != MI) { ++Counter; LastMI = MI; }
     O << Counter;
   } else {
-    llvm_cerr << "Unknown special formatter '" << Code
-              << "' for machine instr: " << *MI;
+    cerr << "Unknown special formatter '" << Code
+         << "' for machine instr: " << *MI;
     exit(1);
   }    
 }
@@ -737,8 +736,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
       case '(':             // $( -> same as GCC's { character.
         ++LastEmitted;      // Consume '(' character.
         if (CurVariant != -1) {
-          llvm_cerr << "Nested variants found in inline asm string: '"
-                    << AsmStr << "'\n";
+          cerr << "Nested variants found in inline asm string: '"
+               << AsmStr << "'\n";
           exit(1);
         }
         CurVariant = 0;     // We're in the first variant now.
@@ -746,8 +745,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
       case '|':
         ++LastEmitted;  // consume '|' character.
         if (CurVariant == -1) {
-          llvm_cerr << "Found '|' character outside of variant in inline asm "
-                    << "string: '" << AsmStr << "'\n";
+          cerr << "Found '|' character outside of variant in inline asm "
+               << "string: '" << AsmStr << "'\n";
           exit(1);
         }
         ++CurVariant;   // We're in the next variant.
@@ -755,8 +754,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
       case ')':         // $) -> same as GCC's } char.
         ++LastEmitted;  // consume ')' character.
         if (CurVariant == -1) {
-          llvm_cerr << "Found '}' character outside of variant in inline asm "
-                    << "string: '" << AsmStr << "'\n";
+          cerr << "Found '}' character outside of variant in inline asm "
+               << "string: '" << AsmStr << "'\n";
           exit(1);
         }
         CurVariant = -1;
@@ -774,8 +773,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
       char *IDEnd;
       long Val = strtol(IDStart, &IDEnd, 10); // We only accept numbers for IDs.
       if (!isdigit(*IDStart) || (Val == 0 && errno == EINVAL)) {
-        llvm_cerr << "Bad $ operand number in inline asm string: '" 
-                  << AsmStr << "'\n";
+        cerr << "Bad $ operand number in inline asm string: '" 
+             << AsmStr << "'\n";
         exit(1);
       }
       LastEmitted = IDEnd;
@@ -788,8 +787,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
         if (*LastEmitted == ':') {
           ++LastEmitted;    // Consume ':' character.
           if (*LastEmitted == 0) {
-            llvm_cerr << "Bad ${:} expression in inline asm string: '" 
-                      << AsmStr << "'\n";
+            cerr << "Bad ${:} expression in inline asm string: '" 
+                 << AsmStr << "'\n";
             exit(1);
           }
           
@@ -798,16 +797,16 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
         }
         
         if (*LastEmitted != '}') {
-          llvm_cerr << "Bad ${} expression in inline asm string: '" 
-                    << AsmStr << "'\n";
+          cerr << "Bad ${} expression in inline asm string: '" 
+               << AsmStr << "'\n";
           exit(1);
         }
         ++LastEmitted;    // Consume '}' character.
       }
       
       if ((unsigned)Val >= NumOperands-1) {
-        llvm_cerr << "Invalid $ operand number in inline asm string: '" 
-                  << AsmStr << "'\n";
+        cerr << "Invalid $ operand number in inline asm string: '" 
+             << AsmStr << "'\n";
         exit(1);
       }
       
@@ -841,8 +840,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
           }
         }
         if (Error) {
-          llvm_cerr << "Invalid operand found in inline asm: '"
-                    << AsmStr << "'\n";
+          cerr << "Invalid operand found in inline asm: '"
+               << AsmStr << "'\n";
           MI->dump();
           exit(1);
         }

+ 7 - 9
lib/CodeGen/DwarfWriter.cpp

@@ -31,10 +31,8 @@
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetFrameInfo.h"
-
 #include <ostream>
 #include <string>
-
 using namespace llvm;
 using namespace llvm::dwarf;
 
@@ -139,7 +137,7 @@ public:
   }
   
 #ifndef NDEBUG
-  void print(llvm_ostream &O) const {
+  void print(OStream &O) const {
     if (O.stream()) print(*O.stream());
   }
   void print(std::ostream &O) const {
@@ -247,7 +245,7 @@ public:
   void Emit(const Dwarf &DW) const; 
       
 #ifndef NDEBUG
-  void print(llvm_ostream &O) {
+  void print(OStream &O) {
     if (O.stream()) print(*O.stream());
   }
   void print(std::ostream &O);
@@ -337,7 +335,7 @@ public:
   void Profile(FoldingSetNodeID &ID) ;
       
 #ifndef NDEBUG
-  void print(llvm_ostream &O, unsigned IncIndent = 0) {
+  void print(OStream &O, unsigned IncIndent = 0) {
     if (O.stream()) print(*O.stream(), IncIndent);
   }
   void print(std::ostream &O, unsigned IncIndent = 0);
@@ -388,7 +386,7 @@ public:
   virtual void Profile(FoldingSetNodeID &ID) = 0;
       
 #ifndef NDEBUG
-  void print(llvm_ostream &O) {
+  void print(OStream &O) {
     if (O.stream()) print(*O.stream());
   }
   virtual void print(std::ostream &O) = 0;
@@ -2861,14 +2859,14 @@ void DIEAbbrev::print(std::ostream &O) {
       << "\n";
   }
 }
-void DIEAbbrev::dump() { print(llvm_cerr); }
+void DIEAbbrev::dump() { print(cerr); }
 #endif
 
 //===----------------------------------------------------------------------===//
 
 #ifndef NDEBUG
 void DIEValue::dump() {
-  print(llvm_cerr);
+  print(cerr);
 }
 #endif
 
@@ -3079,7 +3077,7 @@ void DIE::print(std::ostream &O, unsigned IncIndent) {
 }
 
 void DIE::dump() {
-  print(llvm_cerr);
+  print(cerr);
 }
 #endif
 

+ 3 - 4
lib/CodeGen/ELFWriter.cpp

@@ -39,7 +39,6 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Support/Mangler.h"
 #include "llvm/Support/Streams.h"
-#include <ostream>
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
@@ -104,9 +103,9 @@ void ELFCodeEmitter::startFunction(MachineFunction &F) {
                       ELFWriter::ELFSection::SHF_EXECINSTR |
                       ELFWriter::ELFSection::SHF_ALLOC);
   OutBuffer = &ES->SectionData;
-  llvm_cerr << "FIXME: This code needs to be updated for changes in the"
-            << " CodeEmitter interfaces.  In particular, this should set "
-            << "BufferBegin/BufferEnd/CurBufferPtr, not deal with OutBuffer!";
+  cerr << "FIXME: This code needs to be updated for changes in the"
+       << " CodeEmitter interfaces.  In particular, this should set "
+       << "BufferBegin/BufferEnd/CurBufferPtr, not deal with OutBuffer!";
   abort();
 
   // Upgrade the section alignment if required.

+ 12 - 12
lib/CodeGen/IntrinsicLowering.cpp

@@ -274,12 +274,12 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
 
   switch (Callee->getIntrinsicID()) {
   case Intrinsic::not_intrinsic:
-    llvm_cerr << "Cannot lower a call to a non-intrinsic function '"
-              << Callee->getName() << "'!\n";
+    cerr << "Cannot lower a call to a non-intrinsic function '"
+         << Callee->getName() << "'!\n";
     abort();
   default:
-    llvm_cerr << "Error: Code generator does not support intrinsic function '"
-              << Callee->getName() << "'!\n";
+    cerr << "Error: Code generator does not support intrinsic function '"
+         << Callee->getName() << "'!\n";
     abort();
 
     // The setjmp/longjmp intrinsics should only exist in the code if it was
@@ -356,9 +356,9 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
   case Intrinsic::stackrestore: {
     static bool Warned = false;
     if (!Warned)
-      llvm_cerr << "WARNING: this target does not support the llvm.stack"
-                << (Callee->getIntrinsicID() == Intrinsic::stacksave ?
-                    "save" : "restore") << " intrinsic.\n";
+      cerr << "WARNING: this target does not support the llvm.stack"
+           << (Callee->getIntrinsicID() == Intrinsic::stacksave ?
+               "save" : "restore") << " intrinsic.\n";
     Warned = true;
     if (Callee->getIntrinsicID() == Intrinsic::stacksave)
       CI->replaceAllUsesWith(Constant::getNullValue(CI->getType()));
@@ -367,9 +367,9 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
     
   case Intrinsic::returnaddress:
   case Intrinsic::frameaddress:
-    llvm_cerr << "WARNING: this target does not support the llvm."
-              << (Callee->getIntrinsicID() == Intrinsic::returnaddress ?
-                  "return" : "frame") << "address intrinsic.\n";
+    cerr << "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())));
     break;
@@ -380,8 +380,8 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
   case Intrinsic::pcmarker:
     break;    // Simply strip out pcmarker on unsupported architectures
   case Intrinsic::readcyclecounter: {
-    llvm_cerr << "WARNING: this target does not support the llvm.readcyclecoun"
-              << "ter intrinsic.  It is being lowered to a constant 0\n";
+    cerr << "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::ULongTy, 0));
     break;
   }

+ 3 - 4
lib/CodeGen/LiveInterval.cpp

@@ -23,7 +23,6 @@
 #include "llvm/Support/Streams.h"
 #include "llvm/Target/MRegisterInfo.h"
 #include <algorithm>
-#include <iostream>
 #include <map>
 using namespace llvm;
 
@@ -472,10 +471,10 @@ std::ostream& llvm::operator<<(std::ostream& os, const LiveRange &LR) {
 }
 
 void LiveRange::dump() const {
-  llvm_cerr << *this << "\n";
+  cerr << *this << "\n";
 }
 
-void LiveInterval::print(llvm_ostream OS, const MRegisterInfo *MRI) const {
+void LiveInterval::print(OStream OS, const MRegisterInfo *MRI) const {
   if (MRI && MRegisterInfo::isPhysicalRegister(reg))
     OS << MRI->getName(reg);
   else
@@ -508,5 +507,5 @@ void LiveInterval::print(llvm_ostream OS, const MRegisterInfo *MRI) const {
 }
 
 void LiveInterval::dump() const {
-  llvm_cerr << *this << "\n";
+  cerr << *this << "\n";
 }

+ 2 - 2
lib/CodeGen/LiveIntervalAnalysis.cpp

@@ -419,9 +419,9 @@ addIntervalsForSpills(const LiveInterval &li, VirtRegMap &vrm, int slot) {
 
 void LiveIntervals::printRegName(unsigned reg) const {
   if (MRegisterInfo::isPhysicalRegister(reg))
-    llvm_cerr << mri_->getName(reg);
+    cerr << mri_->getName(reg);
   else
-    llvm_cerr << "%reg" << reg;
+    cerr << "%reg" << reg;
 }
 
 /// isReDefinedByTwoAddr - Returns true if the Reg re-definition is due to

+ 1 - 2
lib/CodeGen/MachineInstr.cpp

@@ -18,7 +18,6 @@
 #include "llvm/Target/MRegisterInfo.h"
 #include "llvm/Support/LeakDetector.h"
 #include "llvm/Support/Streams.h"
-#include <iostream>
 using namespace llvm;
 
 /// MachineInstr ctor - This constructor creates a dummy MachineInstr with
@@ -201,7 +200,7 @@ void MachineInstr::copyKillDeadInfo(const MachineInstr *MI) {
 }
 
 void MachineInstr::dump() const {
-  llvm_cerr << "  " << *this;
+  cerr << "  " << *this;
 }
 
 static inline void OutputReg(std::ostream &os, unsigned RegNo,

+ 3 - 3
lib/CodeGen/VirtRegMap.cpp

@@ -112,11 +112,11 @@ void VirtRegMap::virtFolded(unsigned VirtReg, MachineInstr *OldMI,
 }
 
 void VirtRegMap::print(std::ostream &OS) const {
-  llvm_ostream LOS(OS);
+  OStream LOS(OS);
   print(LOS);
 }
 
-void VirtRegMap::print(llvm_ostream &OS) const {
+void VirtRegMap::print(OStream &OS) const {
   const MRegisterInfo* MRI = MF.getTarget().getRegisterInfo();
 
   OS << "********** REGISTER MAP **********\n";
@@ -135,7 +135,7 @@ void VirtRegMap::print(llvm_ostream &OS) const {
 }
 
 void VirtRegMap::dump() const {
-  llvm_ostream OS = DOUT;
+  OStream OS = DOUT;
   print(OS);
 }
 

+ 2 - 2
lib/CodeGen/VirtRegMap.h

@@ -19,12 +19,12 @@
 
 #include "llvm/Target/MRegisterInfo.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/Streams.h"
 #include <map>
 
 namespace llvm {
   class MachineInstr;
   class TargetInstrInfo;
-  class llvm_ostream;
 
   class VirtRegMap {
   public:
@@ -145,7 +145,7 @@ namespace llvm {
     }
 
     void print(std::ostream &OS) const;
-    void print(llvm_ostream &OS) const;
+    void print(OStream &OS) const;
     void dump() const;
   };
 

+ 9 - 9
lib/ExecutionEngine/ExecutionEngine.cpp

@@ -402,7 +402,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
     default:
       break;
     }
-    llvm_cerr << "ConstantExpr not handled as global var init: " << *CE << "\n";
+    cerr << "ConstantExpr not handled as global var init: " << *CE << "\n";
     abort();
   }
 
@@ -432,7 +432,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
       assert(0 && "Unknown constant pointer type!");
     break;
   default:
-    llvm_cerr << "ERROR: Constant unimp for type: " << *C->getType() << "\n";
+    cerr << "ERROR: Constant unimp for type: " << *C->getType() << "\n";
     abort();
   }
   return Result;
@@ -477,7 +477,7 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr,
       Ptr->Untyped[7] = (unsigned char)(Val.ULongVal >> 56);
       break;
     default:
-      llvm_cerr << "Cannot store value of type " << *Ty << "!\n";
+      cerr << "Cannot store value of type " << *Ty << "!\n";
     }
   } else {
     switch (Ty->getTypeID()) {
@@ -511,7 +511,7 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr,
       Ptr->Untyped[0] = (unsigned char)(Val.ULongVal >> 56);
       break;
     default:
-      llvm_cerr << "Cannot store value of type " << *Ty << "!\n";
+      cerr << "Cannot store value of type " << *Ty << "!\n";
     }
   }
 }
@@ -552,7 +552,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
                                              ((uint64_t)Ptr->Untyped[7] << 56);
                             break;
     default:
-      llvm_cerr << "Cannot load value of type " << *Ty << "!\n";
+      cerr << "Cannot load value of type " << *Ty << "!\n";
       abort();
     }
   } else {
@@ -586,7 +586,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
                                              ((uint64_t)Ptr->Untyped[0] << 56);
                             break;
     default:
-      llvm_cerr << "Cannot load value of type " << *Ty << "!\n";
+      cerr << "Cannot load value of type " << *Ty << "!\n";
       abort();
     }
   }
@@ -634,7 +634,7 @@ void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
   }
 
   default:
-    llvm_cerr << "Bad Type: " << *Init->getType() << "\n";
+    cerr << "Bad Type: " << *Init->getType() << "\n";
     assert(0 && "Unknown constant type to initialize memory with!");
   }
 }
@@ -718,8 +718,8 @@ void ExecutionEngine::emitGlobals() {
             sys::DynamicLibrary::SearchForAddressOfSymbol(I->getName().c_str()))
           addGlobalMapping(I, SymAddr);
         else {
-          llvm_cerr << "Could not resolve external global address: "
-                    << I->getName() << "\n";
+          cerr << "Could not resolve external global address: "
+               << I->getName() << "\n";
           abort();
         }
       }

+ 28 - 29
lib/ExecutionEngine/Interpreter/Execution.cpp

@@ -188,7 +188,7 @@ GenericValue Interpreter::getConstantExprValue (ConstantExpr *CE,
                              getOperandValue(CE->getOperand(1), SF),
                              getOperandValue(CE->getOperand(2), SF));
   default:
-    llvm_cerr << "Unhandled ConstantExpr: " << *CE << "\n";
+    cerr << "Unhandled ConstantExpr: " << *CE << "\n";
     abort();
     return GenericValue();
   }
@@ -236,7 +236,7 @@ static GenericValue executeAddInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_BINARY_OPERATOR(+, Float);
     IMPLEMENT_BINARY_OPERATOR(+, Double);
   default:
-    llvm_cerr << "Unhandled type for Add instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for Add instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -257,7 +257,7 @@ static GenericValue executeSubInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_BINARY_OPERATOR(-, Float);
     IMPLEMENT_BINARY_OPERATOR(-, Double);
   default:
-    llvm_cerr << "Unhandled type for Sub instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for Sub instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -278,7 +278,7 @@ static GenericValue executeMulInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_BINARY_OPERATOR(*, Float);
     IMPLEMENT_BINARY_OPERATOR(*, Double);
   default:
-    llvm_cerr << "Unhandled type for Mul instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for Mul instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -296,7 +296,7 @@ static GenericValue executeUDivInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SIGNLESS_BINOP(/, UInt,   Int);
     IMPLEMENT_SIGNLESS_BINOP(/, ULong,  Long);
   default:
-    llvm_cerr << "Unhandled type for UDiv instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for UDiv instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -311,7 +311,7 @@ static GenericValue executeSDivInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SIGNLESS_BINOP(/, Int,   UInt);
     IMPLEMENT_SIGNLESS_BINOP(/, Long,  ULong);
   default:
-    llvm_cerr << "Unhandled type for SDiv instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for SDiv instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -324,7 +324,7 @@ static GenericValue executeFDivInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_BINARY_OPERATOR(/, Float);
     IMPLEMENT_BINARY_OPERATOR(/, Double);
   default:
-    llvm_cerr << "Unhandled type for Div instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for Div instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -339,7 +339,7 @@ static GenericValue executeURemInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SIGNLESS_BINOP(%, UInt,   Int);
     IMPLEMENT_SIGNLESS_BINOP(%, ULong,  Long);
   default:
-    llvm_cerr << "Unhandled type for URem instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for URem instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -354,7 +354,7 @@ static GenericValue executeSRemInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SIGNLESS_BINOP(%, Int,   UInt);
     IMPLEMENT_SIGNLESS_BINOP(%, Long,  ULong);
   default:
-    llvm_cerr << "Unhandled type for Rem instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for Rem instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -371,7 +371,7 @@ static GenericValue executeFRemInst(GenericValue Src1, GenericValue Src2,
     Dest.DoubleVal = fmod(Src1.DoubleVal, Src2.DoubleVal);
     break;
   default:
-    llvm_cerr << "Unhandled type for Rem instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for Rem instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -391,7 +391,7 @@ static GenericValue executeAndInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_BINARY_OPERATOR(&, ULong);
     IMPLEMENT_BINARY_OPERATOR(&, Long);
   default:
-    llvm_cerr << "Unhandled type for And instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for And instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -411,7 +411,7 @@ static GenericValue executeOrInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_BINARY_OPERATOR(|, ULong);
     IMPLEMENT_BINARY_OPERATOR(|, Long);
   default:
-    llvm_cerr << "Unhandled type for Or instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for Or instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -431,7 +431,7 @@ static GenericValue executeXorInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_BINARY_OPERATOR(^, ULong);
     IMPLEMENT_BINARY_OPERATOR(^, Long);
   default:
-    llvm_cerr << "Unhandled type for Xor instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for Xor instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -465,7 +465,7 @@ static GenericValue executeSetEQInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SETCC(==, Double);
     IMPLEMENT_POINTERSETCC(==);
   default:
-    llvm_cerr << "Unhandled type for SetEQ instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for SetEQ instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -488,7 +488,7 @@ static GenericValue executeSetNEInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_POINTERSETCC(!=);
 
   default:
-    llvm_cerr << "Unhandled type for SetNE instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for SetNE instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -510,7 +510,7 @@ static GenericValue executeSetLEInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SETCC(<=, Double);
     IMPLEMENT_POINTERSETCC(<=);
   default:
-    llvm_cerr << "Unhandled type for SetLE instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for SetLE instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -532,7 +532,7 @@ static GenericValue executeSetGEInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SETCC(>=, Double);
     IMPLEMENT_POINTERSETCC(>=);
   default:
-    llvm_cerr << "Unhandled type for SetGE instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for SetGE instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -554,7 +554,7 @@ static GenericValue executeSetLTInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SETCC(<, Double);
     IMPLEMENT_POINTERSETCC(<);
   default:
-    llvm_cerr << "Unhandled type for SetLT instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for SetLT instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -576,7 +576,7 @@ static GenericValue executeSetGTInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SETCC(>, Double);
     IMPLEMENT_POINTERSETCC(>);
   default:
-    llvm_cerr << "Unhandled type for SetGT instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for SetGT instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -609,7 +609,7 @@ void Interpreter::visitBinaryOperator(BinaryOperator &I) {
   case Instruction::SetLT: R = executeSetLTInst(Src1, Src2, Ty); break;
   case Instruction::SetGT: R = executeSetGTInst(Src1, Src2, Ty); break;
   default:
-    llvm_cerr << "Don't know how to handle this binary operator!\n-->" << I;
+    cerr << "Don't know how to handle this binary operator!\n-->" << I;
     abort();
   }
 
@@ -710,7 +710,7 @@ void Interpreter::visitUnwindInst(UnwindInst &I) {
 }
 
 void Interpreter::visitUnreachableInst(UnreachableInst &I) {
-  llvm_cerr << "ERROR: Program executed an 'unreachable' instruction!\n";
+  cerr << "ERROR: Program executed an 'unreachable' instruction!\n";
   abort();
 }
 
@@ -978,7 +978,7 @@ static GenericValue executeShlInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SHIFT(<<, ULong);
     IMPLEMENT_SHIFT(<<, Long);
   default:
-    llvm_cerr << "Unhandled type for Shl instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for Shl instruction: " << *Ty << "\n";
   }
   return Dest;
 }
@@ -992,7 +992,7 @@ static GenericValue executeLShrInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SIGNLESS_SHIFT(>>, UInt,   Int);
     IMPLEMENT_SIGNLESS_SHIFT(>>, ULong,  Long);
   default:
-    llvm_cerr << "Unhandled type for LShr instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for LShr instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -1007,7 +1007,7 @@ static GenericValue executeAShrInst(GenericValue Src1, GenericValue Src2,
     IMPLEMENT_SIGNLESS_SHIFT(>>, Int,   UInt);
     IMPLEMENT_SIGNLESS_SHIFT(>>, Long,  ULong);
   default:
-    llvm_cerr << "Unhandled type for AShr instruction: " << *Ty << "\n";
+    cerr << "Unhandled type for AShr instruction: " << *Ty << "\n";
     abort();
   }
   return Dest;
@@ -1065,14 +1065,14 @@ void Interpreter::visitAShr(ShiftInst &I) {
       IMPLEMENT_CAST(DESTTY, DESTCTY, Float);   \
       IMPLEMENT_CAST(DESTTY, DESTCTY, Double)   \
     default:                                    \
-      llvm_cerr << "Unhandled cast: "           \
+      cerr << "Unhandled cast: "                \
         << *SrcTy << " to " << *DstTy << "\n";  \
       abort();                                  \
     }                                           \
     break
 
 #define IMPLEMENT_CAST_END                      \
-  default: llvm_cerr                            \
+  default: cerr                                 \
       << "Unhandled dest type for cast instruction: "  \
       << *DstTy << "\n";                        \
     abort();                                    \
@@ -1226,8 +1226,7 @@ GenericValue Interpreter::executeCastOperation(Instruction::CastOps opcode,
       IMPLEMENT_CAST_END
       break;
     default:
-      llvm_cerr 
-        << "Invalid cast opcode for cast instruction: " << opcode << "\n";
+      cerr << "Invalid cast opcode for cast instruction: " << opcode << "\n";
       abort();
   }
   return Dest;
@@ -1266,7 +1265,7 @@ void Interpreter::visitVAArgInst(VAArgInst &I) {
     IMPLEMENT_VAARG(Double);
     IMPLEMENT_VAARG(Bool);
   default:
-    llvm_cerr << "Unhandled dest type for vaarg instruction: " << *Ty << "\n";
+    cerr << "Unhandled dest type for vaarg instruction: " << *Ty << "\n";
     abort();
   }
 

+ 7 - 7
lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp

@@ -93,8 +93,8 @@ GenericValue Interpreter::callExternalFunction(Function *F,
   std::map<const Function *, ExFunc>::iterator FI = Functions.find(F);
   ExFunc Fn = (FI == Functions.end()) ? lookupFunction(F) : FI->second;
   if (Fn == 0) {
-    llvm_cerr << "Tried to execute an unknown external function: "
-              << F->getType()->getDescription() << " " << F->getName() << "\n";
+    cerr << "Tried to execute an unknown external function: "
+         << F->getType()->getDescription() << " " << F->getName() << "\n";
     if (F->getName() == "__main")
       return GenericValue();
     abort();
@@ -114,19 +114,19 @@ extern "C" {  // Don't add C++ manglings to llvm mangling :)
 
 // void putchar(sbyte)
 GenericValue lle_Vb_putchar(FunctionType *M, const vector<GenericValue> &Args) {
-  llvm_cout << Args[0].SByteVal;
+  cout << Args[0].SByteVal;
   return GenericValue();
 }
 
 // int putchar(int)
 GenericValue lle_ii_putchar(FunctionType *M, const vector<GenericValue> &Args) {
-  llvm_cout << ((char)Args[0].IntVal) << std::flush;
+  cout << ((char)Args[0].IntVal) << std::flush;
   return Args[0];
 }
 
 // void putchar(ubyte)
 GenericValue lle_VB_putchar(FunctionType *M, const vector<GenericValue> &Args) {
-  llvm_cout << Args[0].SByteVal << std::flush;
+  cout << Args[0].SByteVal << std::flush;
   return Args[0];
 }
 
@@ -332,7 +332,7 @@ GenericValue lle_X_sprintf(FunctionType *M, const vector<GenericValue> &Args) {
         sprintf(Buffer, FmtBuf, (void*)GVTOP(Args[ArgNo++])); break;
       case 's':
         sprintf(Buffer, FmtBuf, (char*)GVTOP(Args[ArgNo++])); break;
-      default:  llvm_cerr << "<unknown printf code '" << *FmtStr << "'!>";
+      default:  cerr << "<unknown printf code '" << *FmtStr << "'!>";
         ArgNo++; break;
       }
       strcpy(OutputBuffer, Buffer);
@@ -350,7 +350,7 @@ GenericValue lle_X_printf(FunctionType *M, const vector<GenericValue> &Args) {
   NewArgs.push_back(PTOGV(Buffer));
   NewArgs.insert(NewArgs.end(), Args.begin(), Args.end());
   GenericValue GV = lle_X_sprintf(M, NewArgs);
-  llvm_cout << Buffer;
+  cout << Buffer;
   return GV;
 }
 

+ 8 - 9
lib/Linker/LinkModules.cpp

@@ -25,7 +25,6 @@
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/System/Path.h"
-#include <sstream>
 using namespace llvm;
 
 // Error - Simple wrapper function to conditionally assign to E and return true.
@@ -251,11 +250,11 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
 static void PrintMap(const std::map<const Value*, Value*> &M) {
   for (std::map<const Value*, Value*>::const_iterator I = M.begin(), E =M.end();
        I != E; ++I) {
-    llvm_cerr << " Fr: " << (void*)I->first << " ";
+    cerr << " Fr: " << (void*)I->first << " ";
     I->first->dump();
-    llvm_cerr << " To: " << (void*)I->second << " ";
+    cerr << " To: " << (void*)I->second << " ";
     I->second->dump();
-    llvm_cerr << "\n";
+    cerr << "\n";
   }
 }
 
@@ -313,10 +312,10 @@ static Value *RemapOperand(const Value *In,
   }
   
 
-  llvm_cerr << "LinkModules ValueMap: \n";
+  cerr << "LinkModules ValueMap: \n";
   PrintMap(ValueMap);
 
-  llvm_cerr << "Couldn't remap value: " << (void*)In << " " << *In << "\n";
+  cerr << "Couldn't remap value: " << (void*)In << " " << *In << "\n";
   assert(0 && "Couldn't remap value!");
   return 0;
 }
@@ -844,13 +843,13 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) {
 
   if (Src->getEndianness() != Module::AnyEndianness &&
       Dest->getEndianness() != Src->getEndianness())
-    llvm_cerr << "WARNING: Linking two modules of different endianness!\n";
+    cerr << "WARNING: Linking two modules of different endianness!\n";
   if (Src->getPointerSize() != Module::AnyPointerSize &&
       Dest->getPointerSize() != Src->getPointerSize())
-    llvm_cerr << "WARNING: Linking two modules of different pointer size!\n";
+    cerr << "WARNING: Linking two modules of different pointer size!\n";
   if (!Src->getTargetTriple().empty() &&
       Dest->getTargetTriple() != Src->getTargetTriple())
-    llvm_cerr << "WARNING: Linking two modules of different target triples!\n";
+    cerr << "WARNING: Linking two modules of different target triples!\n";
 
   if (!Src->getModuleInlineAsm().empty()) {
     if (Dest->getModuleInlineAsm().empty())

+ 3 - 3
lib/Linker/Linker.cpp

@@ -45,7 +45,7 @@ bool
 Linker::error(const std::string& message) {
   Error = message;
   if (!(Flags&QuietErrors))
-    llvm_cerr << ProgramName << ": error: " << message << "\n";
+    cerr << ProgramName << ": error: " << message << "\n";
   return true;
 }
 
@@ -53,14 +53,14 @@ bool
 Linker::warning(const std::string& message) {
   Error = message;
   if (!(Flags&QuietErrors))
-    llvm_cerr << ProgramName << ": warning: " << message << "\n";
+    cerr << ProgramName << ": warning: " << message << "\n";
   return false;
 }
 
 void
 Linker::verbose(const std::string& message) {
   if (Flags&Verbose)
-    llvm_cerr << "  " << message << "\n";
+    cerr << "  " << message << "\n";
 }
 
 void

+ 2 - 2
lib/Support/Allocator.cpp

@@ -102,6 +102,6 @@ void BumpPtrAllocator::PrintStats() const {
   for (; R; R = R->getNext(), ++NumRegions)
     BytesUsed += R->getNumBytesAllocated();
 
-  llvm_cerr << "\nNumber of memory regions: " << NumRegions << "\n";
-  llvm_cerr << "Bytes allocated: " << BytesUsed << "\n";
+  cerr << "\nNumber of memory regions: " << NumRegions << "\n";
+  cerr << "Bytes allocated: " << BytesUsed << "\n";
 }

+ 47 - 47
lib/Support/CommandLine.cpp

@@ -84,8 +84,8 @@ static Option *getOption(const std::string &Str) {
 
 static void AddArgument(const char *ArgName, Option *Opt) {
   if (getOption(ArgName)) {
-    llvm_cerr << ProgramName << ": CommandLine Error: Argument '"
-              << ArgName << "' defined more than once!\n";
+    cerr << ProgramName << ": CommandLine Error: Argument '"
+         << ArgName << "' defined more than once!\n";
   } else {
     // Add argument to the argument map!
     (*Options)[ArgName] = Opt;
@@ -129,9 +129,9 @@ static inline bool ProvideOption(Option *Handler, const char *ArgName,
   case ValueOptional:
     break;
   default:
-    llvm_cerr << ProgramName
-              << ": Bad ValueMask flag! CommandLine usage error:"
-              << Handler->getValueExpectedFlag() << "\n";
+    cerr << ProgramName
+         << ": Bad ValueMask flag! CommandLine usage error:"
+         << Handler->getValueExpectedFlag() << "\n";
     abort();
     break;
   }
@@ -468,8 +468,8 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
     }
 
     if (Handler == 0) {
-      llvm_cerr << ProgramName << ": Unknown command line argument '"
-                << argv[i] << "'.  Try: '" << argv[0] << " --help'\n";
+      cerr << ProgramName << ": Unknown command line argument '"
+           << argv[i] << "'.  Try: '" << argv[0] << " --help'\n";
       ErrorParsing = true;
       continue;
     }
@@ -505,18 +505,18 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
 
   // Check and handle positional arguments now...
   if (NumPositionalRequired > PositionalVals.size()) {
-    llvm_cerr << ProgramName
-              << ": Not enough positional command line arguments specified!\n"
-              << "Must specify at least " << NumPositionalRequired
-              << " positional arguments: See: " << argv[0] << " --help\n";
+    cerr << ProgramName
+         << ": Not enough positional command line arguments specified!\n"
+         << "Must specify at least " << NumPositionalRequired
+         << " positional arguments: See: " << argv[0] << " --help\n";
     
     ErrorParsing = true;
   } else if (!HasUnlimitedPositionals
              && PositionalVals.size() > PositionalOpts.size()) {
-    llvm_cerr << ProgramName
-              << ": Too many positional arguments specified!\n"
-              << "Can specify at most " << PositionalOpts.size()
-              << " positional arguments: See: " << argv[0] << " --help\n";
+    cerr << ProgramName
+         << ": Too many positional arguments specified!\n"
+         << "Can specify at most " << PositionalOpts.size()
+         << " positional arguments: See: " << argv[0] << " --help\n";
     ErrorParsing = true;
 
   } else if (ConsumeAfterOpt == 0) {
@@ -617,11 +617,11 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
 bool Option::error(std::string Message, const char *ArgName) {
   if (ArgName == 0) ArgName = ArgStr;
   if (ArgName[0] == 0)
-    llvm_cerr << HelpStr;  // Be nice for positional arguments
+    cerr << HelpStr;  // Be nice for positional arguments
   else
-    llvm_cerr << ProgramName << ": for the -" << ArgName;
+    cerr << ProgramName << ": for the -" << ArgName;
   
-  llvm_cerr << " option: " << Message << "\n";
+  cerr << " option: " << Message << "\n";
   return true;
 }
 
@@ -701,8 +701,8 @@ unsigned alias::getOptionWidth() const {
 // Print out the option for the alias.
 void alias::printOptionInfo(unsigned GlobalWidth) const {
   unsigned L = std::strlen(ArgStr);
-  llvm_cout << "  -" << ArgStr << std::string(GlobalWidth-L-6, ' ') << " - "
-            << HelpStr << "\n";
+  cout << "  -" << ArgStr << std::string(GlobalWidth-L-6, ' ') << " - "
+       << HelpStr << "\n";
 }
 
 
@@ -728,13 +728,13 @@ unsigned basic_parser_impl::getOptionWidth(const Option &O) const {
 //
 void basic_parser_impl::printOptionInfo(const Option &O,
                                         unsigned GlobalWidth) const {
-  llvm_cout << "  -" << O.ArgStr;
+  cout << "  -" << O.ArgStr;
 
   if (const char *ValName = getValueName())
-    llvm_cout << "=<" << getValueStr(O, ValName) << ">";
+    cout << "=<" << getValueStr(O, ValName) << ">";
 
-  llvm_cout << std::string(GlobalWidth-getOptionWidth(O), ' ') << " - "
-            << O.HelpStr << "\n";
+  cout << std::string(GlobalWidth-getOptionWidth(O), ' ') << " - "
+       << O.HelpStr << "\n";
 }
 
 
@@ -850,21 +850,21 @@ void generic_parser_base::printOptionInfo(const Option &O,
                                           unsigned GlobalWidth) const {
   if (O.hasArgStr()) {
     unsigned L = std::strlen(O.ArgStr);
-    llvm_cout << "  -" << O.ArgStr << std::string(GlobalWidth-L-6, ' ')
-              << " - " << O.HelpStr << "\n";
+    cout << "  -" << O.ArgStr << std::string(GlobalWidth-L-6, ' ')
+         << " - " << O.HelpStr << "\n";
 
     for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
       unsigned NumSpaces = GlobalWidth-strlen(getOption(i))-8;
-      llvm_cout << "    =" << getOption(i) << std::string(NumSpaces, ' ')
-                << " - " << getDescription(i) << "\n";
+      cout << "    =" << getOption(i) << std::string(NumSpaces, ' ')
+           << " - " << getDescription(i) << "\n";
     }
   } else {
     if (O.HelpStr[0])
-      llvm_cout << "  " << O.HelpStr << "\n";
+      cout << "  " << O.HelpStr << "\n";
     for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
       unsigned L = std::strlen(getOption(i));
-      llvm_cout << "    -" << getOption(i) << std::string(GlobalWidth-L-8, ' ')
-                << " - " << getDescription(i) << "\n";
+      cout << "    -" << getOption(i) << std::string(GlobalWidth-L-8, ' ')
+           << " - " << getDescription(i) << "\n";
     }
   }
 }
@@ -917,9 +917,9 @@ public:
     }
 
     if (ProgramOverview)
-      llvm_cout << "OVERVIEW:" << ProgramOverview << "\n";
+      cout << "OVERVIEW:" << ProgramOverview << "\n";
 
-    llvm_cout << "USAGE: " << ProgramName << " [options]";
+    cout << "USAGE: " << ProgramName << " [options]";
 
     // Print out the positional options.
     std::vector<Option*> &PosOpts = *PositionalOptions;
@@ -929,28 +929,28 @@ public:
 
     for (unsigned i = CAOpt != 0, e = PosOpts.size(); i != e; ++i) {
       if (PosOpts[i]->ArgStr[0])
-        llvm_cout << " --" << PosOpts[i]->ArgStr;
-      llvm_cout << " " << PosOpts[i]->HelpStr;
+        cout << " --" << PosOpts[i]->ArgStr;
+      cout << " " << PosOpts[i]->HelpStr;
     }
 
     // Print the consume after option info if it exists...
-    if (CAOpt) llvm_cout << " " << CAOpt->HelpStr;
+    if (CAOpt) cout << " " << CAOpt->HelpStr;
 
-    llvm_cout << "\n\n";
+    cout << "\n\n";
 
     // Compute the maximum argument length...
     MaxArgLen = 0;
     for (unsigned i = 0, e = Opts.size(); i != e; ++i)
       MaxArgLen = std::max(MaxArgLen, Opts[i].second->getOptionWidth());
 
-    llvm_cout << "OPTIONS:\n";
+    cout << "OPTIONS:\n";
     for (unsigned i = 0, e = Opts.size(); i != e; ++i)
       Opts[i].second->printOptionInfo(MaxArgLen);
 
     // Print any extra help the user has declared.
     for (std::vector<const char *>::iterator I = MoreHelp->begin(),
           E = MoreHelp->end(); I != E; ++I)
-      llvm_cout << *I;
+      cout << *I;
     MoreHelp->clear();
 
     // Halt the program since help information was printed
@@ -982,21 +982,21 @@ public:
   void operator=(bool OptionWasSpecified) {
     if (OptionWasSpecified) {
       if (OverrideVersionPrinter == 0) {
-        llvm_cout << "Low Level Virtual Machine (http://llvm.org/):\n";
-        llvm_cout << "  " << PACKAGE_NAME << " version " << PACKAGE_VERSION;
+        cout << "Low Level Virtual Machine (http://llvm.org/):\n";
+        cout << "  " << PACKAGE_NAME << " version " << PACKAGE_VERSION;
 #ifdef LLVM_VERSION_INFO
-        llvm_cout << LLVM_VERSION_INFO;
+        cout << LLVM_VERSION_INFO;
 #endif
-        llvm_cout << "\n  ";
+        cout << "\n  ";
 #ifndef __OPTIMIZE__
-        llvm_cout << "DEBUG build";
+        cout << "DEBUG build";
 #else
-        llvm_cout << "Optimized build";
+        cout << "Optimized build";
 #endif
 #ifndef NDEBUG
-        llvm_cout << " with assertions";
+        cout << " with assertions";
 #endif
-        llvm_cout << ".\n";
+        cout << ".\n";
         Options->clear();  // Don't bother making option dtors remove from map.
         exit(1);
       } else {

+ 1 - 1
lib/Support/ConstantRange.cpp

@@ -370,5 +370,5 @@ void ConstantRange::print(std::ostream &OS) const {
 /// dump - Allow printing from a debugger easily...
 ///
 void ConstantRange::dump() const {
-  print(llvm_cerr);
+  print(cerr);
 }

+ 3 - 3
lib/Support/Debug.cpp

@@ -68,9 +68,9 @@ bool llvm::isCurrentDebugType(const char *DebugType) {
 // places the std::c* I/O streams into one .cpp file and relieves the whole
 // program from having to have hundreds of static c'tor/d'tors for them.
 // 
-llvm_ostream llvm::getErrorOutputStream(const char *DebugType) {
+OStream llvm::getErrorOutputStream(const char *DebugType) {
   if (DebugFlag && isCurrentDebugType(DebugType))
-    return llvm_cerr;
+    return cerr;
   else
-    return llvm_null;
+    return NullStream;
 }

+ 8 - 8
lib/Support/GraphWriter.cpp

@@ -28,9 +28,9 @@ void llvm::DisplayGraph(const sys::Path &Filename) {
   args.push_back(Filename.c_str());
   args.push_back(0);
   
-  llvm_cerr << "Running 'Graphviz' program... " << std::flush;
+  cerr << "Running 'Graphviz' program... " << std::flush;
   if (sys::Program::ExecuteAndWait(Graphviz, &args[0],0,0,0,&ErrMsg)) {
-    llvm_cerr << "Error viewing graph: " << ErrMsg << "\n";
+    cerr << "Error viewing graph: " << ErrMsg << "\n";
   }
 #elif (HAVE_GV && HAVE_DOT)
   sys::Path PSFilename = Filename;
@@ -48,11 +48,11 @@ void llvm::DisplayGraph(const sys::Path &Filename) {
   args.push_back(PSFilename.c_str());
   args.push_back(0);
   
-  llvm_cerr << "Running 'dot' program... " << std::flush;
+  cerr << "Running 'dot' program... " << std::flush;
   if (sys::Program::ExecuteAndWait(dot, &args[0],0,0,0,&ErrMsg)) {
-    llvm_cerr << "Error viewing graph: '" << ErrMsg << "\n";
+    cerr << "Error viewing graph: '" << ErrMsg << "\n";
   } else {
-    llvm_cerr << " done. \n";
+    cerr << " done. \n";
 
     sys::Path gv(LLVM_PATH_GV);
     args.clear();
@@ -62,7 +62,7 @@ void llvm::DisplayGraph(const sys::Path &Filename) {
     
     ErrMsg.clear();
     if (sys::Program::ExecuteAndWait(gv, &args[0],0,0,0,&ErrMsg)) {
-      llvm_cerr << "Error viewing graph: " << ErrMsg << "\n";
+      cerr << "Error viewing graph: " << ErrMsg << "\n";
     }
   }
   PSFilename.eraseFromDisk();
@@ -73,9 +73,9 @@ void llvm::DisplayGraph(const sys::Path &Filename) {
   args.push_back(Filename.c_str());
   args.push_back(0);
   
-  llvm_cerr << "Running 'dotty' program... " << std::flush;
+  cerr << "Running 'dotty' program... " << std::flush;
   if (sys::Program::ExecuteAndWait(dotty, &args[0],0,0,0,&ErrMsg)) {
-    llvm_cerr << "Error viewing graph: " << ErrMsg << "\n";
+    cerr << "Error viewing graph: " << ErrMsg << "\n";
   } else {
 #ifdef __MINGW32__ // Dotty spawns another app and doesn't wait until it returns
     return;

+ 2 - 2
lib/Support/PluginLoader.cpp

@@ -26,8 +26,8 @@ void PluginLoader::operator=(const std::string &Filename) {
 
   std::string Error;
   if (sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str(), &Error)) {
-    llvm_cerr << "Error opening '" << Filename << "': " << Error
-              << "\n  -load request ignored.\n";
+    cerr << "Error opening '" << Filename << "': " << Error
+         << "\n  -load request ignored.\n";
   } else {
     Plugins->push_back(Filename);
   }

+ 4 - 4
lib/Support/SlowOperationInformer.cpp

@@ -28,8 +28,8 @@ SlowOperationInformer::~SlowOperationInformer() {
   if (LastPrintAmount) {
     // If we have printed something, make _sure_ we print the 100% amount, and
     // also print a newline.
-    llvm_cout << std::string(LastPrintAmount, '\b') << "Progress "
-              << OperationName << ": 100%  \n";
+    cout << std::string(LastPrintAmount, '\b') << "Progress "
+         << OperationName << ": 100%  \n";
   }
 }
 
@@ -40,7 +40,7 @@ SlowOperationInformer::~SlowOperationInformer() {
 bool SlowOperationInformer::progress(unsigned Amount) {
   int status = sys::AlarmStatus();
   if (status == -1) {
-    llvm_cout << "\n";
+    cout << "\n";
     LastPrintAmount = 0;
     return true;
   }
@@ -61,6 +61,6 @@ bool SlowOperationInformer::progress(unsigned Amount) {
     OS << "%  ";
 
   LastPrintAmount = OS.str().size();
-  llvm_cout << ToPrint+OS.str() << std::flush;
+  cout << ToPrint+OS.str() << std::flush;
   return false;
 }

+ 4 - 3
lib/Support/Streams.cpp

@@ -16,6 +16,7 @@
 #include <iostream>
 using namespace llvm;
 
-llvm_ostream llvm::llvm_null;
-llvm_ostream llvm::llvm_cout(std::cout);
-llvm_ostream llvm::llvm_cerr(std::cerr);
+OStream llvm::NullStream;
+OStream llvm::cout(std::cout);
+OStream llvm::cerr(std::cerr);
+IStream llvm::cin(std::cin);

+ 4 - 4
lib/Support/SystemUtils.cpp

@@ -23,10 +23,10 @@ bool llvm::CheckBytecodeOutputToConsole(std::ostream* stream_to_check,
                                         bool print_warning) {
   if (stream_to_check == &std::cout && sys::Process::StandardOutIsDisplayed()) {
     if (print_warning) {
-      llvm_cerr << "WARNING: You're attempting to print out a bytecode file.\n"
-                << "This is inadvisable as it may cause display problems. If\n"
-                << "you REALLY want to taste LLVM bytecode first-hand, you\n"
-                << "can force output with the `-f' option.\n\n";
+      cerr << "WARNING: You're attempting to print out a bytecode file.\n"
+           << "This is inadvisable as it may cause display problems. If\n"
+           << "you REALLY want to taste LLVM bytecode first-hand, you\n"
+           << "can force output with the `-f' option.\n\n";
     }
     return true;
   }

+ 2 - 2
lib/Transforms/ExprTypeConvert.cpp

@@ -693,8 +693,8 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
   I->setName("");
   Instruction *Res;     // Result of conversion
 
-  //llvm_cerr << endl << endl << "Type:\t" << Ty << "\nInst: " << I
-  //          << "BB Before: " << BB << endl;
+  //cerr << endl << endl << "Type:\t" << Ty << "\nInst: " << I
+  //     << "BB Before: " << BB << endl;
 
   // Prevent I from being removed...
   ValueHandle IHandle(VMC, I);

+ 2 - 2
lib/Transforms/Hello/Hello.cpp

@@ -30,7 +30,7 @@ namespace {
       HelloCounter++;
       std::string fname = F.getName();
       EscapeString(fname);
-      llvm_cerr << "Hello: " << fname << "\n";
+      cerr << "Hello: " << fname << "\n";
       return false;
     }
   };
@@ -43,7 +43,7 @@ namespace {
       HelloCounter++;
       std::string fname = F.getName();
       EscapeString(fname);
-      llvm_cerr << "Hello: " << fname << "\n";
+      cerr << "Hello: " << fname << "\n";
       return false;
     }
 

+ 18 - 18
lib/Transforms/IPO/GlobalOpt.cpp

@@ -494,17 +494,17 @@ static bool AllUsesOfValueWillTrapIfNull(Value *V) {
       // Will trap.
     } else if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) {
       if (SI->getOperand(0) == V) {
-        //llvm_cerr << "NONTRAPPING USE: " << **UI;
+        //cerr << "NONTRAPPING USE: " << **UI;
         return false;  // Storing the value.
       }
     } else if (CallInst *CI = dyn_cast<CallInst>(*UI)) {
       if (CI->getOperand(0) != V) {
-        //llvm_cerr << "NONTRAPPING USE: " << **UI;
+        //cerr << "NONTRAPPING USE: " << **UI;
         return false;  // Not calling the ptr
       }
     } else if (InvokeInst *II = dyn_cast<InvokeInst>(*UI)) {
       if (II->getOperand(0) != V) {
-        //llvm_cerr << "NONTRAPPING USE: " << **UI;
+        //cerr << "NONTRAPPING USE: " << **UI;
         return false;  // Not calling the ptr
       }
     } else if (CastInst *CI = dyn_cast<CastInst>(*UI)) {
@@ -515,7 +515,7 @@ static bool AllUsesOfValueWillTrapIfNull(Value *V) {
                isa<ConstantPointerNull>(UI->getOperand(1))) {
       // Ignore setcc X, null
     } else {
-      //llvm_cerr << "NONTRAPPING USE: " << **UI;
+      //cerr << "NONTRAPPING USE: " << **UI;
       return false;
     }
   return true;
@@ -533,7 +533,7 @@ static bool AllUsesOfLoadedValueWillTrapIfNull(GlobalVariable *GV) {
       // Ignore stores to the global.
     } else {
       // We don't know or understand this user, bail out.
-      //llvm_cerr << "UNKNOWN USER OF GLOBAL!: " << **UI;
+      //cerr << "UNKNOWN USER OF GLOBAL!: " << **UI;
       return false;
     }
 
@@ -1206,25 +1206,25 @@ bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV,
 
   if (!AnalyzeGlobal(GV, GS, PHIUsers)) {
 #if 0
-    llvm_cerr << "Global: " << *GV;
-    llvm_cerr << "  isLoaded = " << GS.isLoaded << "\n";
-    llvm_cerr << "  StoredType = ";
+    cerr << "Global: " << *GV;
+    cerr << "  isLoaded = " << GS.isLoaded << "\n";
+    cerr << "  StoredType = ";
     switch (GS.StoredType) {
-    case GlobalStatus::NotStored: llvm_cerr << "NEVER STORED\n"; break;
-    case GlobalStatus::isInitializerStored: llvm_cerr << "INIT STORED\n"; break;
-    case GlobalStatus::isStoredOnce: llvm_cerr << "STORED ONCE\n"; break;
-    case GlobalStatus::isStored: llvm_cerr << "stored\n"; break;
+    case GlobalStatus::NotStored: cerr << "NEVER STORED\n"; break;
+    case GlobalStatus::isInitializerStored: cerr << "INIT STORED\n"; break;
+    case GlobalStatus::isStoredOnce: cerr << "STORED ONCE\n"; break;
+    case GlobalStatus::isStored: cerr << "stored\n"; break;
     }
     if (GS.StoredType == GlobalStatus::isStoredOnce && GS.StoredOnceValue)
-      llvm_cerr << "  StoredOnceValue = " << *GS.StoredOnceValue << "\n";
+      cerr << "  StoredOnceValue = " << *GS.StoredOnceValue << "\n";
     if (GS.AccessingFunction && !GS.HasMultipleAccessingFunctions)
-      llvm_cerr << "  AccessingFunction = " << GS.AccessingFunction->getName()
+      cerr << "  AccessingFunction = " << GS.AccessingFunction->getName()
                 << "\n";
-    llvm_cerr << "  HasMultipleAccessingFunctions =  "
+    cerr << "  HasMultipleAccessingFunctions =  "
               << GS.HasMultipleAccessingFunctions << "\n";
-    llvm_cerr << "  HasNonInstructionUser = " << GS.HasNonInstructionUser<<"\n";
-    llvm_cerr << "  isNotSuitableForSRA = " << GS.isNotSuitableForSRA << "\n";
-    llvm_cerr << "\n";
+    cerr << "  HasNonInstructionUser = " << GS.HasNonInstructionUser<<"\n";
+    cerr << "  isNotSuitableForSRA = " << GS.isNotSuitableForSRA << "\n";
+    cerr << "\n";
 #endif
     
     // If this is a first class global and has only one accessing function

+ 1 - 2
lib/Transforms/IPO/Internalize.cpp

@@ -74,8 +74,7 @@ void InternalizePass::LoadFile(const char *Filename) {
   // Load the APIFile...
   std::ifstream In(Filename);
   if (!In.good()) {
-    llvm_cerr << "WARNING: Internalize couldn't load file '" << Filename
-              << "'!\n";
+    cerr << "WARNING: Internalize couldn't load file '" << Filename << "'!\n";
     return;   // Do not internalize anything...
   }
   while (In) {

+ 4 - 4
lib/Transforms/Instrumentation/BlockProfiling.cpp

@@ -47,8 +47,8 @@ ModulePass *llvm::createFunctionProfilerPass() {
 bool FunctionProfiler::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
-    llvm_cerr << "WARNING: cannot insert function profiling into a module"
-              << " with no main function!\n";
+    cerr << "WARNING: cannot insert function profiling into a module"
+         << " with no main function!\n";
     return false;  // No main, no instrumentation!
   }
 
@@ -90,8 +90,8 @@ ModulePass *llvm::createBlockProfilerPass() { return new BlockProfiler(); }
 bool BlockProfiler::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
-    llvm_cerr << "WARNING: cannot insert block profiling into a module"
-              << " with no main function!\n";
+    cerr << "WARNING: cannot insert block profiling into a module"
+         << " with no main function!\n";
     return false;  // No main, no instrumentation!
   }
 

+ 3 - 3
lib/Transforms/Instrumentation/EdgeProfiling.cpp

@@ -17,6 +17,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "ProfilingUtils.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
@@ -24,7 +25,6 @@
 #include "llvm/Support/Streams.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Transforms/Instrumentation.h"
-#include "ProfilingUtils.h"
 #include <set>
 using namespace llvm;
 
@@ -42,8 +42,8 @@ ModulePass *llvm::createEdgeProfilerPass() { return new EdgeProfiler(); }
 bool EdgeProfiler::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
-    llvm_cerr << "WARNING: cannot insert edge profiling into a module"
-              << " with no main function!\n";
+    cerr << "WARNING: cannot insert edge profiling into a module"
+         << " with no main function!\n";
     return false;  // No main, no instrumentation!
   }
 

+ 3 - 3
lib/Transforms/Instrumentation/TraceBasicBlocks.cpp

@@ -13,6 +13,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "ProfilingUtils.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
@@ -20,7 +21,6 @@
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Transforms/Instrumentation.h"
 #include "llvm/Instructions.h"
-#include "ProfilingUtils.h"
 #include "llvm/Support/Debug.h"
 #include <set>
 using namespace llvm;
@@ -61,8 +61,8 @@ static void InsertInstrumentationCall (BasicBlock *BB,
 bool TraceBasicBlocks::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
-    llvm_cerr << "WARNING: cannot insert basic-block trace instrumentation"
-              << " into a module with no main function!\n";
+    cerr << "WARNING: cannot insert basic-block trace instrumentation"
+         << " into a module with no main function!\n";
     return false;  // No main, no instrumentation!
   }
 

+ 2 - 2
lib/Transforms/Scalar/InstructionCombining.cpp

@@ -7018,8 +7018,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
   // If we are removing arguments to the function, emit an obnoxious warning...
   if (FT->getNumParams() < NumActualArgs)
     if (!FT->isVarArg()) {
-      llvm_cerr << "WARNING: While resolving call to function '"
-                << Callee->getName() << "' arguments were dropped!\n";
+      cerr << "WARNING: While resolving call to function '"
+           << Callee->getName() << "' arguments were dropped!\n";
     } else {
       // Add all of the arguments in their promoted form to the arg list...
       for (unsigned i = FT->getNumParams(); i != NumActualArgs; ++i, ++AI) {

+ 4 - 4
lib/Transforms/Scalar/LoopStrengthReduce.cpp

@@ -507,12 +507,12 @@ namespace {
 }
 
 void BasedUser::dump() const {
-  llvm_cerr << " Base=" << *Base;
-  llvm_cerr << " Imm=" << *Imm;
+  cerr << " Base=" << *Base;
+  cerr << " Imm=" << *Imm;
   if (EmittedBase)
-    llvm_cerr << "  EB=" << *EmittedBase;
+    cerr << "  EB=" << *EmittedBase;
 
-  llvm_cerr << "   Inst: " << *Inst;
+  cerr << "   Inst: " << *Inst;
 }
 
 Value *BasedUser::InsertCodeForBaseAtPosition(const SCEVHandle &NewBase, 

+ 1 - 2
lib/Transforms/Scalar/LowerPacked.cpp

@@ -73,8 +73,7 @@ public:
    /// @param I the unhandled instruction
    void visitInstruction(Instruction &I) {
      if (isa<PackedType>(I.getType()))
-       llvm_cerr << "Unhandled Instruction with Packed ReturnType: "
-                 << I << '\n';
+       cerr << "Unhandled Instruction with Packed ReturnType: " << I << '\n';
    }
 private:
    /// @brief Retrieves lowered values for a packed value.

+ 3 - 3
lib/Transforms/Scalar/SCCP.cpp

@@ -350,7 +350,7 @@ private:
 
   void visitInstruction(Instruction &I) {
     // If a new instruction is added to LLVM that we don't handle...
-    llvm_cerr << "SCCP: Don't know how to handle: " << I;
+    cerr << "SCCP: Don't know how to handle: " << I;
     markOverdefined(&I);   // Just in case
   }
 };
@@ -400,7 +400,7 @@ void SCCPSolver::getFeasibleSuccessors(TerminatorInst &TI,
       Succs[0] = true;
     }
   } else {
-    llvm_cerr << "SCCP: Don't know how to handle: " << TI;
+    cerr << "SCCP: Don't know how to handle: " << TI;
     Succs.assign(TI.getNumSuccessors(), true);
   }
 }
@@ -459,7 +459,7 @@ bool SCCPSolver::isEdgeFeasible(BasicBlock *From, BasicBlock *To) {
     }
     return false;
   } else {
-    llvm_cerr << "Unknown terminator instruction: " << *TI;
+    cerr << "Unknown terminator instruction: " << *TI;
     abort();
   }
 }

+ 2 - 2
lib/Transforms/Utils/CodeExtractor.cpp

@@ -699,10 +699,10 @@ ExtractCodeRegion(const std::vector<BasicBlock*> &code) {
           }
     }
 
-  //llvm_cerr << "NEW FUNCTION: " << *newFunction;
+  //cerr << "NEW FUNCTION: " << *newFunction;
   //  verifyFunction(*newFunction);
 
-  //  llvm_cerr << "OLD FUNCTION: " << *oldFunction;
+  //  cerr << "OLD FUNCTION: " << *oldFunction;
   //  verifyFunction(*oldFunction);
 
   DEBUG(if (verifyFunction(*newFunction)) abort());

+ 1 - 2
lib/Transforms/Utils/LowerSwitch.cpp

@@ -96,8 +96,7 @@ bool LowerSwitch::runOnFunction(Function &F) {
 
 // operator<< - Used for debugging purposes.
 //
-llvm_ostream& operator<<(llvm_ostream &O,
-                         const std::vector<LowerSwitch::Case> &C) {
+OStream& operator<<(OStream &O, const std::vector<LowerSwitch::Case> &C) {
   O << "[";
 
   for (std::vector<LowerSwitch::Case>::const_iterator B = C.begin(),

+ 5 - 5
lib/VMCore/AsmWriter.cpp

@@ -829,7 +829,7 @@ void AssemblyWriter::printGlobal(const GlobalVariable *GV) {
     case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break;
     case GlobalValue::ExternalLinkage:     break;
     case GlobalValue::GhostLinkage:
-      llvm_cerr << "GhostLinkage not allowed in AsmWriter!\n";
+      cerr << "GhostLinkage not allowed in AsmWriter!\n";
       abort();
     }
 
@@ -928,7 +928,7 @@ void AssemblyWriter::printFunction(const Function *F) {
     case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break;      
     case GlobalValue::ExternalLinkage: break;
     case GlobalValue::GhostLinkage:
-      llvm_cerr << "GhostLinkage not allowed in AsmWriter!\n";
+      cerr << "GhostLinkage not allowed in AsmWriter!\n";
       abort();
     }
 
@@ -1328,18 +1328,18 @@ void Argument::print(std::ostream &o) const {
 
 // Value::dump - allow easy printing of  Values from the debugger.
 // Located here because so much of the needed functionality is here.
-void Value::dump() const { print(std::cerr); llvm_cerr << '\n'; }
+void Value::dump() const { print(std::cerr); cerr << '\n'; }
 
 // Type::dump - allow easy printing of  Values from the debugger.
 // Located here because so much of the needed functionality is here.
-void Type::dump() const { print(std::cerr); llvm_cerr << '\n'; }
+void Type::dump() const { print(std::cerr); cerr << '\n'; }
 
 //===----------------------------------------------------------------------===//
 //                         SlotMachine Implementation
 //===----------------------------------------------------------------------===//
 
 #if 0
-#define SC_DEBUG(X) llvm_cerr << X
+#define SC_DEBUG(X) cerr << X
 #else
 #define SC_DEBUG(X)
 #endif

+ 9 - 10
lib/VMCore/LeakDetector.cpp

@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/LeakDetector.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/Value.h"
 #include <set>
@@ -21,12 +21,12 @@ using namespace llvm;
 namespace {
   template <class T>
   struct VISIBILITY_HIDDEN PrinterTrait {
-    static void print(const T* P) { llvm_cerr << P; }
+    static void print(const T* P) { cerr << P; }
   };
 
   template<>
   struct VISIBILITY_HIDDEN PrinterTrait<Value> {
-    static void print(const Value* P) { llvm_cerr << *P; }
+    static void print(const Value* P) { cerr << *P; }
   };
 
   template <typename T>
@@ -59,15 +59,14 @@ namespace {
       assert(Cache == 0 && "No value should be cached anymore!");
 
       if (!Ts.empty()) {
-        llvm_cerr
-            << "Leaked " << Name << " objects found: " << Message << ":\n";
+        cerr << "Leaked " << Name << " objects found: " << Message << ":\n";
         for (typename std::set<const T*>::iterator I = Ts.begin(),
                E = Ts.end(); I != E; ++I) {
-          llvm_cerr << "\t";
+          cerr << "\t";
           PrinterTrait<T>::print(*I);
-          llvm_cerr << "\n";
+          cerr << "\n";
         }
-        llvm_cerr << '\n';
+        cerr << '\n';
 
         return true;
       }
@@ -123,8 +122,8 @@ void LeakDetector::checkForGarbageImpl(const std::string &Message) {
   // use non-short-circuit version so that both checks are performed
   if (getObjects().hasGarbage(Message) |
       getLLVMObjects().hasGarbage(Message))
-    llvm_cerr << "\nThis is probably because you removed an object, but didn't "
-              << "delete it.  Please check your code for memory leaks.\n";
+    cerr << "\nThis is probably because you removed an object, but didn't "
+         << "delete it.  Please check your code for memory leaks.\n";
 
   // Clear out results so we don't get duplicate warnings on
   // next call...

+ 1 - 1
lib/VMCore/PassManager.cpp

@@ -442,7 +442,7 @@ bool FunctionPassManager_New::runOnModule(Module &M) {
 bool FunctionPassManager_New::run(Function &F) {
   std::string errstr;
   if (MP->materializeFunction(&F, &errstr)) {
-    llvm_cerr << "Error reading bytecode file: " << errstr << "\n";
+    cerr << "Error reading bytecode file: " << errstr << "\n";
     abort();
   }
   return FPM->runOnFunction(F);

+ 10 - 10
lib/VMCore/TypeSymbolTable.cpp

@@ -66,7 +66,7 @@ Type* TypeSymbolTable::erase(iterator Entry) {
 
 #if DEBUG_SYMBOL_TABLE
   dump();
-  llvm_cerr << " Removing Value: " << Result->getName() << "\n";
+  cerr << " Removing Value: " << Result->getName() << "\n";
 #endif
 
   tmap.erase(Entry);
@@ -75,7 +75,7 @@ Type* TypeSymbolTable::erase(iterator Entry) {
   // list...
   if (Result->isAbstract()) {
 #if DEBUG_ABSTYPE
-    llvm_cerr << "Removing abstract type from symtab" << Result->getDescription()<<"\n";
+    cerr << "Removing abstract type from symtab" << Result->getDescription()<<"\n";
 #endif
     cast<DerivedType>(Result)->removeAbstractTypeUser(this);
   }
@@ -95,8 +95,8 @@ void TypeSymbolTable::insert(const std::string& Name, const Type* T) {
 
 #if DEBUG_SYMBOL_TABLE
   dump();
-  llvm_cerr << " Inserting type: " << UniqueName << ": "
-            << T->getDescription() << "\n";
+  cerr << " Inserting type: " << UniqueName << ": "
+       << T->getDescription() << "\n";
 #endif
 
   // Insert the tmap entry
@@ -106,7 +106,7 @@ void TypeSymbolTable::insert(const std::string& Name, const Type* T) {
   if (T->isAbstract()) {
     cast<DerivedType>(T)->addAbstractTypeUser(this);
 #if DEBUG_ABSTYPE
-    llvm_cerr << "Added abstract type to ST: " << T->getDescription() << "\n";
+    cerr << "Added abstract type to ST: " << T->getDescription() << "\n";
 #endif
   }
 }
@@ -152,14 +152,14 @@ void TypeSymbolTable::refineAbstractType(const DerivedType *OldType,
   for (iterator I = begin(), E = end(); I != E; ++I) {
     if (I->second == (Type*)OldType) {  // FIXME when Types aren't const.
 #if DEBUG_ABSTYPE
-      llvm_cerr << "Removing type " << OldType->getDescription() << "\n";
+      cerr << "Removing type " << OldType->getDescription() << "\n";
 #endif
       OldType->removeAbstractTypeUser(this);
 
       I->second = (Type*)NewType;  // TODO FIXME when types aren't const
       if (NewType->isAbstract()) {
 #if DEBUG_ABSTYPE
-        llvm_cerr << "Added type " << NewType->getDescription() << "\n";
+        cerr << "Added type " << NewType->getDescription() << "\n";
 #endif
         cast<DerivedType>(NewType)->addAbstractTypeUser(this);
       }
@@ -179,13 +179,13 @@ void TypeSymbolTable::typeBecameConcrete(const DerivedType *AbsTy) {
 }
 
 static void DumpTypes(const std::pair<const std::string, const Type*>& T ) {
-  llvm_cerr << "  '" << T.first << "' = ";
+  cerr << "  '" << T.first << "' = ";
   T.second->dump();
-  llvm_cerr << "\n";
+  cerr << "\n";
 }
 
 void TypeSymbolTable::dump() const {
-  llvm_cerr << "TypeSymbolPlane: ";
+  cerr << "TypeSymbolPlane: ";
   for_each(tmap.begin(), tmap.end(), DumpTypes);
 }
 

+ 2 - 3
lib/VMCore/Verifier.cpp

@@ -60,7 +60,6 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Compiler.h"
 #include <algorithm>
-#include <sstream>
 #include <cstdarg>
 using namespace llvm;
 
@@ -156,11 +155,11 @@ namespace {  // Anonymous namespace for class
         switch (action) {
           case AbortProcessAction:
             msgs << "compilation aborted!\n";
-            llvm_cerr << msgs.str();
+            cerr << msgs.str();
             abort();
           case PrintMessageAction:
             msgs << "verification continues.\n";
-            llvm_cerr << msgs.str();
+            cerr << msgs.str();
             return false;
           case ReturnStatusAction:
             msgs << "compilation terminated.\n";

+ 4 - 4
projects/Stacker/tools/stkrc/stkrc.cpp

@@ -115,7 +115,7 @@ int main(int argc, char **argv)
       }
 
       if (DumpAsm)
-        llvm_cerr << "Here's the assembly:" << M.get();
+        cerr << "Here's the assembly:" << M.get();
 
       if (OutputFilename != "") {   // Specified an output filename?
         if (OutputFilename != "-") {  // Not stdout?
@@ -163,15 +163,15 @@ int main(int argc, char **argv)
         throw std::string("error opening ") + OutputFilename + "!";
       }
 
-      llvm_ostream L(*Out);
+      OStream L(*Out);
       WriteBytecodeToFile(M.get(), L);
     } catch (const ParseError &E) {
-      llvm_cerr << argv[0] << ": " << E.getMessage() << "\n";
+      cerr << argv[0] << ": " << E.getMessage() << "\n";
       return 1;
     }
   }
   catch (const std::string& msg ) {
-    llvm_cerr << argv[0] << ": " << msg << "\n";
+    cerr << argv[0] << ": " << msg << "\n";
     return 1;
   }
 

部分文件因文件數量過多而無法顯示