Move some warnings to debug mode.
[oota-llvm.git] / lib / Analysis / DataStructure / TopDownClosure.cpp
index 6d01fda2d607d224db66013d2d87a184772a85a3..55a37dbcd164ea3409d42c97b675fef7b979aa52 100644 (file)
@@ -1,10 +1,10 @@
 //===- TopDownClosure.cpp - Compute the top-down interprocedure closure ---===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This file implements the TDDataStructures class, which represents the
@@ -21,6 +21,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Timer.h"
 #include "llvm/ADT/Statistic.h"
+#include <iostream>
 using namespace llvm;
 
 #if 0
@@ -31,7 +32,7 @@ using namespace llvm;
 #endif
 
 namespace {
-  RegisterAnalysis<TDDataStructures>   // Register the pass
+  RegisterPass<TDDataStructures>   // Register the pass
   Y("tddatastructure", "Top-down Data Structure Analysis");
 
   Statistic<> NumTDInlines("tddatastructures", "Number of graphs inlined");
@@ -135,7 +136,7 @@ bool TDDataStructures::runOnModule(Module &M) {
     delete IndCallMap.begin()->second;
     IndCallMap.erase(IndCallMap.begin());
   }
-    
+
 
   ArgsRemainIncomplete.clear();
   GlobalsGraph->removeTriviallyDeadNodes();
@@ -170,13 +171,12 @@ void TDDataStructures::ComputePostOrder(Function &F,hash_set<DSGraph*> &Visited,
   DSGraph &G = getOrCreateDSGraph(F);
   if (Visited.count(&G)) return;
   Visited.insert(&G);
-  
+
   // Recursively traverse all of the callee graphs.
-  for (DSGraph::fc_iterator CI = G.fc_begin(), E = G.fc_end(); CI != E; ++CI) {
+  for (DSGraph::fc_iterator CI = G.fc_begin(), CE = G.fc_end(); CI != CE; ++CI){
     Instruction *CallI = CI->getCallSite().getInstruction();
-    BUDataStructures::callee_iterator I = 
-      BUInfo->callee_begin(CallI), E = BUInfo->callee_end(CallI);
-    for (; I != E; ++I)
+    for (BUDataStructures::callee_iterator I = BUInfo->callee_begin(CallI),
+           E = BUInfo->callee_end(CallI); I != E; ++I)
       ComputePostOrder(*I->second, Visited, PostOrder);
   }
 
@@ -215,12 +215,12 @@ void TDDataStructures::InlineCallersIntoGraph(DSGraph &DSG) {
   // sites that call into this graph.
   std::vector<CallerCallEdge> EdgesFromCaller;
   std::map<DSGraph*, std::vector<CallerCallEdge> >::iterator
-    CEI = CallerEdges.find(&DSG); 
+    CEI = CallerEdges.find(&DSG);
   if (CEI != CallerEdges.end()) {
     std::swap(CEI->second, EdgesFromCaller);
     CallerEdges.erase(CEI);
   }
-  
+
   // Sort the caller sites to provide a by-caller-graph ordering.
   std::sort(EdgesFromCaller.begin(), EdgesFromCaller.end());
 
@@ -268,7 +268,7 @@ void TDDataStructures::InlineCallersIntoGraph(DSGraph &DSG) {
                getParent()->getParent()->getName() << "'");
       DEBUG(std::cerr << ": " << CF.getFunctionType()->getNumParams()
             << " args\n");
-      
+
       // Get the formal argument and return nodes for the called function and
       // merge them with the cloned subgraph.
       DSCallSite T1 = DSG.getCallSiteForArguments(CF);
@@ -357,7 +357,7 @@ void TDDataStructures::InlineCallersIntoGraph(DSGraph &DSG) {
     // so we build up a new, private, graph that represents the calls of all
     // calls to this set of functions.
     std::vector<Function*> Callees;
-    for (BUDataStructures::ActualCalleesTy::const_iterator I = 
+    for (BUDataStructures::ActualCalleesTy::const_iterator I =
            BUInfo->callee_begin(CallI), E = BUInfo->callee_end(CallI);
          I != E; ++I)
       if (!I->second->isExternal())
@@ -371,8 +371,8 @@ void TDDataStructures::InlineCallersIntoGraph(DSGraph &DSG) {
 
     // If we already have this graph, recycle it.
     if (IndCallRecI != IndCallMap.end() && IndCallRecI->first == Callees) {
-      std::cerr << "  [TD] *** Reuse of indcall graph for " << Callees.size()
-                << " callees!\n";
+      DEBUG(std::cerr << "  [TD] *** Reuse of indcall graph for " << Callees.size()
+            << " callees!\n");
       IndCallGraph = IndCallRecI->second;
     } else {
       // Otherwise, create a new DSGraph to represent this.