[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.h MemoryDepAnalysis.cpp PgmDependenceGraph.cpp PgmDependenceGraph.h
Chris Lattner
lattner at cs.uiuc.edu
Sun Jun 27 19:28:10 PDT 2004
Changes in directory llvm/lib/Analysis/DataStructure:
MemoryDepAnalysis.h added (r1.1)
MemoryDepAnalysis.cpp updated: 1.13 -> 1.14
PgmDependenceGraph.cpp updated: 1.5 -> 1.6
PgmDependenceGraph.h updated: 1.1 -> 1.2
---
Log message:
Move MemoryDepAnalysis.h into lib/Analysis/DataStructure
---
Diffs of the changes: (+105 -3)
Index: llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.h
diff -c /dev/null llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.h:1.1
*** /dev/null Sun Jun 27 19:27:26 2004
--- llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.h Sun Jun 27 19:27:15 2004
***************
*** 0 ****
--- 1,103 ----
+ //===- MemoryDepAnalysis.h - Compute dep graph for memory ops ---*- C++ -*-===//
+ //
+ // 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 provides a pass (MemoryDepAnalysis) that computes memory-based
+ // data dependences between instructions for each function in a module.
+ // Memory-based dependences occur due to load and store operations, but
+ // also the side-effects of call instructions.
+ //
+ // The result of this pass is a DependenceGraph for each function
+ // representing the memory-based data dependences between instructions.
+ //
+ //===----------------------------------------------------------------------===//
+
+ #ifndef LLVM_ANALYSIS_MEMORYDEPANALYSIS_H
+ #define LLVM_ANALYSIS_MEMORYDEPANALYSIS_H
+
+ #include "llvm/Analysis/DependenceGraph.h"
+ #include "llvm/Pass.h"
+ #include "Support/hash_map"
+
+ namespace llvm {
+
+ class ModRefTable;
+ class DSGraph;
+ class FunctionModRefInfo;
+
+ ///---------------------------------------------------------------------------
+ /// class MemoryDepGraph:
+ /// Dependence analysis for load/store/call instructions using IPModRef info
+ /// computed at the granularity of individual DSGraph nodes.
+ ///
+ /// This pass computes memory dependences for each function in a module.
+ /// It can be made a FunctionPass once a Pass (such as Parallelize) is
+ /// allowed to use a FunctionPass such as this one.
+ ///---------------------------------------------------------------------------
+
+ class MemoryDepAnalysis : public Pass {
+ /// The following map and depGraph pointer are temporary until this class
+ /// becomes a FunctionPass instead of a module Pass.
+ hash_map<Function*, DependenceGraph*> funcMap;
+ DependenceGraph* funcDepGraph;
+
+ /// Information about one function being analyzed.
+ const DSGraph* funcGraph;
+ const FunctionModRefInfo* funcModRef;
+
+ /// Internal routine that processes each SCC of the CFG.
+ ///
+ void ProcessSCC(std::vector<BasicBlock*> &SCC, ModRefTable& ModRefAfter,
+ bool HasLoop);
+
+ friend class PgmDependenceGraph;
+
+ public:
+ MemoryDepAnalysis() : funcDepGraph(0), funcGraph(0), funcModRef(0) {}
+ ~MemoryDepAnalysis();
+
+ /// Driver function to compute dependence graphs for every function.
+ ///
+ bool run(Module &M);
+
+ /// getGraph - Retrieve the dependence graph for a function.
+ /// This is temporary and will go away once this is a FunctionPass.
+ /// At that point, this class should directly inherit from DependenceGraph.
+ ///
+ DependenceGraph& getGraph(Function& F) {
+ hash_map<Function*, DependenceGraph*>::iterator I = funcMap.find(&F);
+ assert(I != funcMap.end());
+ return *I->second;
+ }
+ const DependenceGraph& getGraph(Function& F) const {
+ hash_map<Function*, DependenceGraph*>::const_iterator I = funcMap.find(&F);
+ assert(I != funcMap.end());
+ return *I->second;
+ }
+
+ /// Release depGraphs held in the Function -> DepGraph map.
+ ///
+ virtual void releaseMemory();
+
+ /// Driver functions to compute the Load/Store Dep. Graph per function.
+ ///
+ bool runOnFunction(Function &F);
+
+ /// getAnalysisUsage - This does not modify anything. It uses the Top-Down DS
+ /// Graph and IPModRef.
+ void getAnalysisUsage(AnalysisUsage &AU) const;
+
+ /// Debugging support methods
+ ///
+ void print(std::ostream &O) const;
+ void dump() const;
+ };
+
+ } // End llvm namespace
+
+ #endif
Index: llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp
diff -u llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp:1.13 llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp:1.14
--- llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp:1.13 Thu Mar 11 18:58:41 2004
+++ llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp Sun Jun 27 19:27:15 2004
@@ -17,7 +17,7 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Analysis/MemoryDepAnalysis.h"
+#include "MemoryDepAnalysis.h"
#include "llvm/Module.h"
#include "llvm/iMemory.h"
#include "llvm/iOther.h"
Index: llvm/lib/Analysis/DataStructure/PgmDependenceGraph.cpp
diff -u llvm/lib/Analysis/DataStructure/PgmDependenceGraph.cpp:1.5 llvm/lib/Analysis/DataStructure/PgmDependenceGraph.cpp:1.6
--- llvm/lib/Analysis/DataStructure/PgmDependenceGraph.cpp:1.5 Sun Jun 27 19:20:04 2004
+++ llvm/lib/Analysis/DataStructure/PgmDependenceGraph.cpp Sun Jun 27 19:27:16 2004
@@ -26,7 +26,6 @@
//===----------------------------------------------------------------------===//
#include "PgmDependenceGraph.h"
-#include "llvm/Analysis/MemoryDepAnalysis.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Function.h"
Index: llvm/lib/Analysis/DataStructure/PgmDependenceGraph.h
diff -u llvm/lib/Analysis/DataStructure/PgmDependenceGraph.h:1.1 llvm/lib/Analysis/DataStructure/PgmDependenceGraph.h:1.2
--- llvm/lib/Analysis/DataStructure/PgmDependenceGraph.h:1.1 Sun Jun 27 19:20:04 2004
+++ llvm/lib/Analysis/DataStructure/PgmDependenceGraph.h Sun Jun 27 19:27:16 2004
@@ -40,7 +40,7 @@
#define LLVM_ANALYSIS_PGMDEPENDENCEGRAPH_H
#include "llvm/Analysis/DependenceGraph.h"
-#include "llvm/Analysis/MemoryDepAnalysis.h"
+#include "MemoryDepAnalysis.h"
/* #include "llvm/Analysis/PostDominators.h" -- see below */
#include "llvm/Instruction.h"
#include "llvm/Pass.h"
More information about the llvm-commits
mailing list