-//===- 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:
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
}
-/// 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
/// {
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);
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;
}
static RegisterAnalysis<MemoryDepAnalysis>
Z("memdep", "Memory Dependence Analysis");
+
+} // End llvm namespace