aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-07-11 20:30:18 +0000
committerChris Lattner <sabre@nondot.org>2002-07-11 20:30:18 +0000
commit1dc15b79979019e7abd6c37122970a328d26f585 (patch)
tree8d24fb0071ea747317dc1edca35b034fa561f7c5 /include/llvm/Analysis
parente683f773a47423bbbaf90980cefea6f19c6f6d83 (diff)
downloadexternal_llvm-1dc15b79979019e7abd6c37122970a328d26f585.zip
external_llvm-1dc15b79979019e7abd6c37122970a328d26f585.tar.gz
external_llvm-1dc15b79979019e7abd6c37122970a328d26f585.tar.bz2
* Nodes now keep track of any global variables contained within them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2877 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis')
-rw-r--r--include/llvm/Analysis/DataStructure.h19
-rw-r--r--include/llvm/Analysis/DataStructure/DataStructure.h19
2 files changed, 30 insertions, 8 deletions
diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h
index c0240a4..c417a49 100644
--- a/include/llvm/Analysis/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure.h
@@ -11,12 +11,12 @@
#include <string>
class Type;
+class GlobalValue;
class DSNode; // Each node in the graph
class DSGraph; // A graph for a function
class DSNodeIterator; // Data structure graph traversal iterator
class LocalDataStructures; // A collection of local graphs for a program
-
//===----------------------------------------------------------------------===//
// DSNodeHandle - Implement a "handle" to a data structure node that takes care
// of all of the add/un'refing of the node to prevent the backpointers in the
@@ -62,6 +62,9 @@ class DSNode {
std::vector<DSNodeHandle> Links;
std::vector<DSNodeHandle*> Referrers;
+ // Globals - The list of global values that are merged into this node.
+ std::vector<GlobalValue*> Globals;
+
DSNode(const DSNode &); // DO NOT IMPLEMENT
void operator=(const DSNode &); // DO NOT IMPLEMENT
public:
@@ -108,6 +111,11 @@ public:
return Links[i];
}
+ // addGlobal - Add an entry for a global value to the Globals list. This also
+ // marks the node with the 'G' flag if it does not already have it.
+ //
+ void addGlobal(GlobalValue *GV);
+
// addEdgeTo - Add an edge from the current node to the specified node. This
// can cause merging of nodes in the graph.
//
@@ -129,10 +137,10 @@ public:
void removeReferrer(DSNodeHandle *H);
const std::vector<DSNodeHandle*> &getReferrers() const { return Referrers; }
- void print(std::ostream &O, Function *F) const;
+ void print(std::ostream &O, const DSGraph *G) const;
void dump() const;
- std::string getCaption(Function *F) const;
+ std::string getCaption(const DSGraph *G) const;
virtual void dropAllReferences() {
Links.clear();
@@ -158,7 +166,10 @@ class DSGraph {
// FunctionCalls - This vector maintains a single entry for each call
// instruction in the current graph. Each call entry contains DSNodeHandles
- // that refer to the arguments that are passed into the function call.
+ // that refer to the arguments that are passed into the function call. The
+ // first entry in the vector is the scalar that holds the return value for the
+ // call, the second is the function scalar being invoked, and the rest are
+ // pointer arguments to the function.
//
std::vector<std::vector<DSNodeHandle> > FunctionCalls;
#if 0
diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h
index c0240a4..c417a49 100644
--- a/include/llvm/Analysis/DataStructure/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure/DataStructure.h
@@ -11,12 +11,12 @@
#include <string>
class Type;
+class GlobalValue;
class DSNode; // Each node in the graph
class DSGraph; // A graph for a function
class DSNodeIterator; // Data structure graph traversal iterator
class LocalDataStructures; // A collection of local graphs for a program
-
//===----------------------------------------------------------------------===//
// DSNodeHandle - Implement a "handle" to a data structure node that takes care
// of all of the add/un'refing of the node to prevent the backpointers in the
@@ -62,6 +62,9 @@ class DSNode {
std::vector<DSNodeHandle> Links;
std::vector<DSNodeHandle*> Referrers;
+ // Globals - The list of global values that are merged into this node.
+ std::vector<GlobalValue*> Globals;
+
DSNode(const DSNode &); // DO NOT IMPLEMENT
void operator=(const DSNode &); // DO NOT IMPLEMENT
public:
@@ -108,6 +111,11 @@ public:
return Links[i];
}
+ // addGlobal - Add an entry for a global value to the Globals list. This also
+ // marks the node with the 'G' flag if it does not already have it.
+ //
+ void addGlobal(GlobalValue *GV);
+
// addEdgeTo - Add an edge from the current node to the specified node. This
// can cause merging of nodes in the graph.
//
@@ -129,10 +137,10 @@ public:
void removeReferrer(DSNodeHandle *H);
const std::vector<DSNodeHandle*> &getReferrers() const { return Referrers; }
- void print(std::ostream &O, Function *F) const;
+ void print(std::ostream &O, const DSGraph *G) const;
void dump() const;
- std::string getCaption(Function *F) const;
+ std::string getCaption(const DSGraph *G) const;
virtual void dropAllReferences() {
Links.clear();
@@ -158,7 +166,10 @@ class DSGraph {
// FunctionCalls - This vector maintains a single entry for each call
// instruction in the current graph. Each call entry contains DSNodeHandles
- // that refer to the arguments that are passed into the function call.
+ // that refer to the arguments that are passed into the function call. The
+ // first entry in the vector is the scalar that holds the return value for the
+ // call, the second is the function scalar being invoked, and the rest are
+ // pointer arguments to the function.
//
std::vector<std::vector<DSNodeHandle> > FunctionCalls;
#if 0