Removed #include <iostream> and used the llvm_cerr/DOUT streams instead.
authorBill Wendling <isanbard@gmail.com>
Sun, 26 Nov 2006 09:17:06 +0000 (09:17 +0000)
committerBill Wendling <isanbard@gmail.com>
Sun, 26 Nov 2006 09:17:06 +0000 (09:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31922 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/ExprTypeConvert.cpp
lib/Transforms/Hello/Hello.cpp
lib/Transforms/Instrumentation/BlockProfiling.cpp
lib/Transforms/Instrumentation/EdgeProfiling.cpp
lib/Transforms/Instrumentation/RSProfiling.cpp
lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
lib/Transforms/LevelRaise.cpp

index e0aaf7b668ee41e9b5af6de536035b91193325c7..7c336d5b4b86b7868533dd4ce85d803263faab54 100644 (file)
@@ -19,7 +19,6 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
 #include <algorithm>
-#include <iostream>
 using namespace llvm;
 
 static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
@@ -205,7 +204,7 @@ Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty,
     return VMCI->second;
   }
 
-  DEBUG(std::cerr << "CETT: " << (void*)V << " " << *V);
+  DOUT << "CETT: " << (void*)V << " " << *V;
 
   Instruction *I = dyn_cast<Instruction>(V);
   if (I == 0) {
@@ -384,8 +383,8 @@ Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty,
     if (NumUses == OldSize) ++It;
   }
 
-  DEBUG(std::cerr << "ExpIn: " << (void*)I << " " << *I
-                  << "ExpOut: " << (void*)Res << " " << *Res);
+  DOUT << "ExpIn: " << (void*)I << " " << *I
+       << "ExpOut: " << (void*)Res << " " << *Res;
 
   return Res;
 }
@@ -708,7 +707,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
   I->setName("");
   Instruction *Res;     // Result of conversion
 
-  //std::cerr << endl << endl << "Type:\t" << Ty << "\nInst: " << I
+  //llvm_cerr << endl << endl << "Type:\t" << Ty << "\nInst: " << I
   //          << "BB Before: " << BB << endl;
 
   // Prevent I from being removed...
@@ -930,9 +929,9 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
   assert(It != BB->end() && "Instruction not in own basic block??");
   BB->getInstList().insert(It, Res);   // Keep It pointing to old instruction
 
-  DEBUG(std::cerr << "COT CREATED: "  << (void*)Res << " " << *Res
-                  << "In: " << (void*)I << " " << *I << "Out: " << (void*)Res
-                  << " " << *Res);
+  DOUT << "COT CREATED: "  << (void*)Res << " " << *Res
+       << "In: " << (void*)I << " " << *I << "Out: " << (void*)Res
+       << " " << *Res;
 
   // Add the instruction to the expression map
   VMC.ExprMap[I] = Res;
@@ -955,13 +954,13 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
 
 ValueHandle::ValueHandle(ValueMapCache &VMC, Value *V)
   : Instruction(Type::VoidTy, UserOp1, &Op, 1, ""), Op(V, this), Cache(VMC) {
-  //DEBUG(std::cerr << "VH AQUIRING: " << (void*)V << " " << V);
+  //DOUT << "VH AQUIRING: " << (void*)V << " " << V;
 }
 
 ValueHandle::ValueHandle(const ValueHandle &VH)
   : Instruction(Type::VoidTy, UserOp1, &Op, 1, ""),
     Op(VH.Op, this), Cache(VH.Cache) {
-  //DEBUG(std::cerr << "VH AQUIRING: " << (void*)V << " " << V);
+  //DOUT << "VH AQUIRING: " << (void*)V << " " << V;
 }
 
 static void RecursiveDelete(ValueMapCache &Cache, Instruction *I) {
@@ -969,7 +968,7 @@ static void RecursiveDelete(ValueMapCache &Cache, Instruction *I) {
 
   assert(I->getParent() && "Inst not in basic block!");
 
-  //DEBUG(std::cerr << "VH DELETING: " << (void*)I << " " << I);
+  //DOUT << "VH DELETING: " << (void*)I << " " << I;
 
   for (User::op_iterator OI = I->op_begin(), OE = I->op_end();
        OI != OE; ++OI)
@@ -996,8 +995,7 @@ ValueHandle::~ValueHandle() {
     //
     RecursiveDelete(Cache, dyn_cast<Instruction>(V));
   } else {
-    //DEBUG(std::cerr << "VH RELEASING: " << (void*)Operands[0].get() << " "
-    //                << Operands[0]->getNumUses() << " " << Operands[0]);
+    //DOUT << "VH RELEASING: " << (void*)Operands[0].get() << " "
+    //     << Operands[0]->getNumUses() << " " << Operands[0];
   }
 }
-
index cfa879a32db8862afa82353d3e5d751a266cfa59..e02406d81d5cd0b9fe2d8dd3b208b8a5bdf07e00 100644 (file)
@@ -16,8 +16,8 @@
 #include "llvm/Function.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/SlowOperationInformer.h"
+#include "llvm/Support/Streams.h"
 #include "llvm/ADT/Statistic.h"
-#include <iostream>
 using namespace llvm;
 
 namespace {
@@ -30,7 +30,7 @@ namespace {
       HelloCounter++;
       std::string fname = F.getName();
       EscapeString(fname);
-      std::cerr << "Hello: " << fname << "\n";
+      llvm_cerr << "Hello: " << fname << "\n";
       return false;
     }
   };
@@ -43,7 +43,7 @@ namespace {
       HelloCounter++;
       std::string fname = F.getName();
       EscapeString(fname);
-      std::cerr << "Hello: " << fname << "\n";
+      llvm_cerr << "Hello: " << fname << "\n";
       return false;
     }
 
index 7e1f5cc76ca8f8fba705377ac8a0c2daf771b06a..af2928b0fce91351d4e438d819011aba62e8b503 100644 (file)
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Streams.h"
 #include "llvm/Transforms/Instrumentation.h"
 #include "RSProfiling.h"
 #include "ProfilingUtils.h"
-#include <iostream>
-
 using namespace llvm;
 
 namespace {
@@ -48,7 +47,7 @@ ModulePass *llvm::createFunctionProfilerPass() {
 bool FunctionProfiler::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
-    std::cerr << "WARNING: cannot insert function profiling into a module"
+    llvm_cerr << "WARNING: cannot insert function profiling into a module"
               << " with no main function!\n";
     return false;  // No main, no instrumentation!
   }
@@ -91,7 +90,7 @@ ModulePass *llvm::createBlockProfilerPass() { return new BlockProfiler(); }
 bool BlockProfiler::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
-    std::cerr << "WARNING: cannot insert block profiling into a module"
+    llvm_cerr << "WARNING: cannot insert block profiling into a module"
               << " with no main function!\n";
     return false;  // No main, no instrumentation!
   }
index a94c42dcaaf7a23f20f1f8ae9ffc57609d5a9a93..40a8faaf507f4682a5af209a05f41c634158b618 100644 (file)
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Streams.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Transforms/Instrumentation.h"
 #include "ProfilingUtils.h"
-#include <iostream>
 #include <set>
 using namespace llvm;
 
@@ -42,7 +42,7 @@ ModulePass *llvm::createEdgeProfilerPass() { return new EdgeProfiler(); }
 bool EdgeProfiler::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
-    std::cerr << "WARNING: cannot insert edge profiling into a module"
+    llvm_cerr << "WARNING: cannot insert edge profiling into a module"
               << " with no main function!\n";
     return false;  // No main, no instrumentation!
   }
index 671b3bcf2277ad02ef3973fe0a63a7eb7993055d..4c6f264b3bb88f1f0d4b9ce43a895792e0bc681c 100644 (file)
 #include "llvm/Transforms/Instrumentation.h"
 //#include "ProfilingUtils.h"
 #include "RSProfiling.h"
-
 #include <set>
 #include <map>
 #include <queue>
 #include <list>
-#include <iostream>
-
 using namespace llvm;
 
 namespace {
@@ -628,7 +625,7 @@ static void getBackEdges(Function& F, T& BackEdges) {
   std::map<BasicBlock*, int> finish;
   int time = 0;
   recBackEdge(&F.getEntryBlock(), BackEdges, color, depth, finish, time);
-  DEBUG(std::cerr << F.getName() << " " << BackEdges.size() << "\n");
+  DOUT << F.getName() << " " << BackEdges.size() << "\n";
 }
 
 
index 003ea0d26ae3c071708b57f74a6f11479e54bc1b..076fa81074222434b3fb4a8db157288715e43f3f 100644 (file)
@@ -23,7 +23,6 @@
 #include "ProfilingUtils.h"
 #include "llvm/Support/Debug.h"
 #include <set>
-#include <iostream>
 using namespace llvm;
 
 namespace {
@@ -43,8 +42,8 @@ ModulePass *llvm::createTraceBasicBlockPass()
 static void InsertInstrumentationCall (BasicBlock *BB,
                                        const std::string FnName,
                                        unsigned BBNumber) {
-  DEBUG (std::cerr << "InsertInstrumentationCall (\"" << BB->getName ()
-                   << "\", \"" << FnName << "\", " << BBNumber << ")\n");
+  DOUT << "InsertInstrumentationCall (\"" << BB->getName ()
+       << "\", \"" << FnName << "\", " << BBNumber << ")\n";
   Module &M = *BB->getParent ()->getParent ();
   Function *InstrFn = M.getOrInsertFunction (FnName, Type::VoidTy,
                                              Type::UIntTy, (Type *)0);
@@ -62,7 +61,7 @@ static void InsertInstrumentationCall (BasicBlock *BB,
 bool TraceBasicBlocks::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
-    std::cerr << "WARNING: cannot insert basic-block trace instrumentation"
+    llvm_cerr << "WARNING: cannot insert basic-block trace instrumentation"
               << " into a module with no main function!\n";
     return false;  // No main, no instrumentation!
   }
index 4c366bdd33ef59e16d0dcfa24f5413ad813a375c..77136099078f1076156d31da844a29a09f7f281c 100644 (file)
@@ -24,7 +24,6 @@
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
 #include <algorithm>
-#include <iostream>
 using namespace llvm;
 
 // StartInst - This enables the -raise-start-inst=foo option to cause the level
@@ -54,7 +53,7 @@ static Statistic<>
 NumVarargCallChanges("raise", "Number of vararg call peepholes");
 
 #define PRINT_PEEPHOLE(ID, NUM, I)            \
-  DEBUG(std::cerr << "Inst P/H " << ID << "[" << NUM << "] " << I)
+  DOUT << "Inst P/H " << ID << "[" << NUM << "] " << I
 
 #define PRINT_PEEPHOLE1(ID, I1) do { PRINT_PEEPHOLE(ID, 0, I1); } while (0)
 #define PRINT_PEEPHOLE2(ID, I1, I2) \
@@ -140,7 +139,7 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
       if (ExpressionConvertibleToType(Src, DestTy, ConvertedTypes, TD)) {
         PRINT_PEEPHOLE3("CAST-SRC-EXPR-CONV:in ", *Src, *CI, *BB->getParent());
 
-        DEBUG(std::cerr << "\nCONVERTING SRC EXPR TYPE:\n");
+        DOUT << "\nCONVERTING SRC EXPR TYPE:\n";
         { // ValueMap must be destroyed before function verified!
           ValueMapCache ValueMap;
           Value *E = ConvertExpressionToType(Src, DestTy, ValueMap, TD);
@@ -149,8 +148,8 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
             CI->replaceAllUsesWith(CPV);
 
           PRINT_PEEPHOLE1("CAST-SRC-EXPR-CONV:out", *E);
-          DEBUG(std::cerr << "DONE CONVERTING SRC EXPR TYPE: \n"
-                          << *BB->getParent());
+          DOUT << "DONE CONVERTING SRC EXPR TYPE: \n"
+               << *BB->getParent();
         }
 
         BI = BB->begin();  // Rescan basic block.  BI might be invalidated.
@@ -168,15 +167,14 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
         //PRINT_PEEPHOLE3("CAST-DEST-EXPR-CONV:in ", *Src, *CI,
         //                *BB->getParent());
 
-        DEBUG(std::cerr << "\nCONVERTING EXPR TYPE:\n");
+        DOUT << "\nCONVERTING EXPR TYPE:\n";
         { // ValueMap must be destroyed before function verified!
           ValueMapCache ValueMap;
           ConvertValueToNewType(CI, Src, ValueMap, TD);  // This will delete CI!
         }
 
         PRINT_PEEPHOLE1("CAST-DEST-EXPR-CONV:out", *Src);
-        DEBUG(std::cerr << "DONE CONVERTING EXPR TYPE: \n\n" <<
-              *BB->getParent());
+        DOUT << "DONE CONVERTING EXPR TYPE: \n\n" << *BB->getParent();
 
         BI = BB->begin();  // Rescan basic block.  BI might be invalidated.
         ++NumExprTreesConv;
@@ -402,11 +400,11 @@ bool RPR::DoRaisePass(Function &F) {
   bool Changed = false;
   for (Function::iterator BB = F.begin(), BBE = F.end(); BB != BBE; ++BB)
     for (BasicBlock::iterator BI = BB->begin(); BI != BB->end();) {
-      DEBUG(std::cerr << "LevelRaising: " << *BI);
+      DOUT << "LevelRaising: " << *BI;
       if (dceInstruction(BI) || doConstantPropagation(BI)) {
         Changed = true;
         ++NumDCEorCP;
-        DEBUG(std::cerr << "***\t\t^^-- Dead code eliminated!\n");
+        DOUT << "***\t\t^^-- Dead code eliminated!\n";
       } else if (PeepholeOptimize(BB, BI)) {
         Changed = true;
       } else {
@@ -420,8 +418,7 @@ bool RPR::DoRaisePass(Function &F) {
 
 // runOnFunction - Raise a function representation to a higher level.
 bool RPR::runOnFunction(Function &F) {
-  DEBUG(std::cerr << "\n\n\nStarting to work on Function '" << F.getName()
-                  << "'\n");
+  DOUT << "\n\n\nStarting to work on Function '" << F.getName() << "'\n";
 
   // Insert casts for all incoming pointer pointer values that are treated as
   // arrays...
@@ -443,7 +440,7 @@ bool RPR::runOnFunction(Function &F) {
   }
 
   do {
-    DEBUG(std::cerr << "Looping: \n" << F);
+    DOUT << "Looping: \n" << F;
 
     // Iterate over the function, refining it, until it converges on a stable
     // state