Fix a minor bug
[oota-llvm.git] / lib / Analysis / DataStructure / MemoryDepAnalysis.cpp
index 215b4e2ba7140cca776a77c386082fa290d33c7d..2bc8e4ac272017f026b26ef0bb187de1cc7b7925 100644 (file)
@@ -1,4 +1,11 @@
-//===- MemoryDepAnalysis.cpp - Compute dep graph for memory ops --*-C++-*--===//
+//===- MemoryDepAnalysis.cpp - Compute dep graph for memory ops -----------===//
+// 
+//                     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 a pass (MemoryDepAnalysis) that computes memory-based
 // data dependences between instructions for each function in a module.  
 //
 // The result of this pass is a DependenceGraph for each function
 // representing the memory-based data dependences between instructions.
+//
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Analysis/MemoryDepAnalysis.h"
-#include "llvm/Analysis/IPModRef.h"
-#include "llvm/Analysis/DataStructure.h"
-#include "llvm/Analysis/DSGraph.h"
 #include "llvm/Module.h"
 #include "llvm/iMemory.h"
 #include "llvm/iOther.h"
+#include "llvm/Analysis/IPModRef.h"
+#include "llvm/Analysis/DataStructure.h"
+#include "llvm/Analysis/DSGraph.h"
 #include "llvm/Support/InstVisitor.h"
 #include "llvm/Support/CFG.h"
-#include "Support/TarjanSCCIterator.h"
+#include "Support/SCCIterator.h"
 #include "Support/Statistic.h"
 #include "Support/STLExtras.h"
 #include "Support/hash_map"
 #include "Support/hash_set"
 
+namespace llvm {
 
 ///--------------------------------------------------------------------------
 /// struct ModRefTable:
@@ -115,7 +124,7 @@ struct ModRefTable {
 class ModRefInfoBuilder : public InstVisitor<ModRefInfoBuilder> {
   const DSGraph&            funcGraph;
   const FunctionModRefInfo& funcModRef;
-  ModRefTable&              modRefTable;
+  struct ModRefTable&       modRefTable;
 
   ModRefInfoBuilder();                         // DO NOT IMPLEMENT
   ModRefInfoBuilder(const ModRefInfoBuilder&); // DO NOT IMPLEMENT
@@ -208,7 +217,7 @@ void MemoryDepAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
 }
 
 
-/// Basic dependence gathering algorithm, using TarjanSCCIterator on CFG:
+/// Basic dependence gathering algorithm, using scc_iterator on CFG:
 /// 
 /// for every SCC S in the CFG in PostOrder on the SCC DAG
 ///     {
@@ -290,7 +299,7 @@ void MemoryDepAnalysis::ProcessSCC(std::vector<BasicBlock*> &S,
   ModRefInfoBuilder builder(*funcGraph, *funcModRef, ModRefCurrent);
   for (std::vector<BasicBlock*>::iterator BI = S.begin(), BE = S.end();
        BI != BE; ++BI)
-    // Note: BBs in the SCC<> created by TarjanSCCIterator are in postorder.
+    // Note: BBs in the SCC<> created by scc_iterator are in postorder.
     for (BasicBlock::reverse_iterator II=(*BI)->rbegin(), IE=(*BI)->rend();
          II != IE; ++II)
       builder.visit(*II);
@@ -438,10 +447,8 @@ bool MemoryDepAnalysis::runOnFunction(Function &F) {
 
   ModRefTable ModRefAfter;
 
-  SCC<Function*>* nextSCC;
-  for (TarjanSCC_iterator<Function*> I = tarj_begin(&F), E = tarj_end(&F);
-       I != E; ++I)
-    ProcessSCC(*I, ModRefAfter, (*I).HasLoop());
+  for (scc_iterator<Function*> I = scc_begin(&F), E = scc_end(&F); I != E; ++I)
+    ProcessSCC(*I, ModRefAfter, I.hasLoop());
 
   return true;
 }
@@ -493,3 +500,5 @@ void MemoryDepAnalysis::dump() const
 static RegisterAnalysis<MemoryDepAnalysis>
 Z("memdep", "Memory Dependence Analysis");
 
+
+} // End llvm namespace