aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-11-09 20:01:01 +0000
committerChris Lattner <sabre@nondot.org>2002-11-09 20:01:01 +0000
commit2e4f9bf86e5d3b86c4a24a58138c630c861d9def (patch)
tree711d268a9a871e39ee29db96aefee6716924610a /include/llvm/Analysis
parentd888893a54caeab7408e8015f7d4f423a2a4378a (diff)
Add initial support for a globals graph
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4656 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis')
-rw-r--r--include/llvm/Analysis/DSGraph.h25
-rw-r--r--include/llvm/Analysis/DataStructure.h1
-rw-r--r--include/llvm/Analysis/DataStructure/DSGraph.h25
-rw-r--r--include/llvm/Analysis/DataStructure/DataStructure.h1
4 files changed, 30 insertions, 22 deletions
diff --git a/include/llvm/Analysis/DSGraph.h b/include/llvm/Analysis/DSGraph.h
index 26dee954be..6afce63e1b 100644
--- a/include/llvm/Analysis/DSGraph.h
+++ b/include/llvm/Analysis/DSGraph.h
@@ -13,18 +13,13 @@
/// DSGraph - The graph that represents a function.
///
class DSGraph {
- Function *Func;
+ Function *Func; // Func - The LLVM function this graph corresponds to
+ DSGraph *GlobalsGraph; // Pointer to the common graph of global objects
+
+ DSNodeHandle RetNode; // The node that gets returned...
std::vector<DSNode*> Nodes;
- DSNodeHandle RetNode; // Node that gets returned...
std::map<Value*, DSNodeHandle> ScalarMap;
-#if 0
- // GlobalsGraph -- Reference to the common graph of globally visible objects.
- // This includes GlobalValues, New nodes, Cast nodes, and Calls.
- //
- GlobalDSGraph* GlobalsGraph;
-#endif
-
// FunctionCalls - This vector maintains a single entry for each call
// instruction in the current graph. The first entry in the vector is the
// scalar that holds the return value for the call, the second is the function
@@ -41,12 +36,17 @@ class DSGraph {
void operator=(const DSGraph &); // DO NOT IMPLEMENT
public:
- DSGraph() : Func(0) {} // Create a new, empty, DSGraph.
- DSGraph(Function &F); // Compute the local DSGraph
+ DSGraph() : Func(0), GlobalsGraph(0) {} // Create a new, empty, DSGraph.
+ DSGraph(Function &F, DSGraph *GlobalsGraph); // Compute the local DSGraph
// Copy ctor - If you want to capture the node mapping between the source and
// destination graph, you may optionally do this by specifying a map to record
// this into.
+ //
+ // Note that a copied graph does not retain the GlobalsGraph pointer of the
+ // source. You need to set a new GlobalsGraph with the setGlobalsGraph
+ // method.
+ //
DSGraph(const DSGraph &DSG);
DSGraph(const DSGraph &DSG, std::map<const DSNode*, DSNodeHandle> &NodeMap);
~DSGraph();
@@ -54,6 +54,9 @@ public:
bool hasFunction() const { return Func != 0; }
Function &getFunction() const { return *Func; }
+ DSGraph *getGlobalsGraph() const { return GlobalsGraph; }
+ void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; }
+
/// getNodes - Get a vector of all the nodes in the graph
///
const std::vector<DSNode*> &getNodes() const { return Nodes; }
diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h
index 610fa712e8..71bf5128ec 100644
--- a/include/llvm/Analysis/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure.h
@@ -33,6 +33,7 @@ namespace DataStructureAnalysis {
class LocalDataStructures : public Pass {
// DSInfo, one graph for each function
std::map<const Function*, DSGraph*> DSInfo;
+ DSGraph *GlobalsGraph;
public:
~LocalDataStructures() { releaseMemory(); }
diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h
index 26dee954be..6afce63e1b 100644
--- a/include/llvm/Analysis/DataStructure/DSGraph.h
+++ b/include/llvm/Analysis/DataStructure/DSGraph.h
@@ -13,18 +13,13 @@
/// DSGraph - The graph that represents a function.
///
class DSGraph {
- Function *Func;
+ Function *Func; // Func - The LLVM function this graph corresponds to
+ DSGraph *GlobalsGraph; // Pointer to the common graph of global objects
+
+ DSNodeHandle RetNode; // The node that gets returned...
std::vector<DSNode*> Nodes;
- DSNodeHandle RetNode; // Node that gets returned...
std::map<Value*, DSNodeHandle> ScalarMap;
-#if 0
- // GlobalsGraph -- Reference to the common graph of globally visible objects.
- // This includes GlobalValues, New nodes, Cast nodes, and Calls.
- //
- GlobalDSGraph* GlobalsGraph;
-#endif
-
// FunctionCalls - This vector maintains a single entry for each call
// instruction in the current graph. The first entry in the vector is the
// scalar that holds the return value for the call, the second is the function
@@ -41,12 +36,17 @@ class DSGraph {
void operator=(const DSGraph &); // DO NOT IMPLEMENT
public:
- DSGraph() : Func(0) {} // Create a new, empty, DSGraph.
- DSGraph(Function &F); // Compute the local DSGraph
+ DSGraph() : Func(0), GlobalsGraph(0) {} // Create a new, empty, DSGraph.
+ DSGraph(Function &F, DSGraph *GlobalsGraph); // Compute the local DSGraph
// Copy ctor - If you want to capture the node mapping between the source and
// destination graph, you may optionally do this by specifying a map to record
// this into.
+ //
+ // Note that a copied graph does not retain the GlobalsGraph pointer of the
+ // source. You need to set a new GlobalsGraph with the setGlobalsGraph
+ // method.
+ //
DSGraph(const DSGraph &DSG);
DSGraph(const DSGraph &DSG, std::map<const DSNode*, DSNodeHandle> &NodeMap);
~DSGraph();
@@ -54,6 +54,9 @@ public:
bool hasFunction() const { return Func != 0; }
Function &getFunction() const { return *Func; }
+ DSGraph *getGlobalsGraph() const { return GlobalsGraph; }
+ void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; }
+
/// getNodes - Get a vector of all the nodes in the graph
///
const std::vector<DSNode*> &getNodes() const { return Nodes; }
diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h
index 610fa712e8..71bf5128ec 100644
--- a/include/llvm/Analysis/DataStructure/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure/DataStructure.h
@@ -33,6 +33,7 @@ namespace DataStructureAnalysis {
class LocalDataStructures : public Pass {
// DSInfo, one graph for each function
std::map<const Function*, DSGraph*> DSInfo;
+ DSGraph *GlobalsGraph;
public:
~LocalDataStructures() { releaseMemory(); }