aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/DataStructure.cpp
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
commitf9ae4c5cb6b546b83a11d9e5d9da44179b2680d3 (patch)
tree84839e241ae74b9cd5f98ad8488028644d04630b /lib/Analysis/DataStructure/DataStructure.cpp
parentc314ac49d753df1e658151b929589c8b4109c8b8 (diff)
* Nodes now keep track of any global variables in them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2879 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index 84e2cfbc47..dd0b52a438 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/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();
}
//===----------------------------------------------------------------------===//