summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-07-11 20:32:22 +0000
committerChris Lattner <sabre@nondot.org>2002-07-11 20:32:22 +0000
commit228163059b28f028c130260f59193e8a5b9a5e70 (patch)
tree797e60242029af907d0a58664197967c9949404f /llvm/lib/Analysis
parent7d0dafc0dcc696c97dec1a51ed6b5d2cc2563c51 (diff)
downloadbcm5719-llvm-228163059b28f028c130260f59193e8a5b9a5e70.tar.gz
bcm5719-llvm-228163059b28f028c130260f59193e8a5b9a5e70.zip
* Nodes now keep track of any global variables in them
llvm-svn: 2879
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/DataStructure/DataStructure.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp
index 84e2cfbc47e..dd0b52a4383 100644
--- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/llvm/lib/Analysis/DataStructure/DataStructure.cpp
@@ -37,6 +37,16 @@ void DSNode::removeReferrer(DSNodeHandle *H) {
Referrers.erase(I.base()-1);
}
+// 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 DSNode::addGlobal(GlobalValue *GV) {
+ assert(GV->getType()->getElementType() == Ty);
+ Globals.push_back(GV);
+ NodeType |= GlobalNode;
+}
+
+
// addEdgeTo - Add an edge from the current node to the specified node. This
// can cause merging of nodes in the graph.
//
@@ -74,8 +84,13 @@ void DSNode::mergeWith(DSNode *N) {
N->Links[i] = 0; // Reduce unneccesary edges in graph. N is dead
}
+ // Merge the node types
NodeType |= N->NodeType;
N->NodeType = 0; // N is now a dead node.
+
+ // Merge the globals list...
+ Globals.insert(Globals.end(), N->Globals.begin(), N->Globals.end());
+ N->Globals.clear();
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud