aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/DataStructure
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-08 00:53:26 +0000
committerChris Lattner <sabre@nondot.org>2004-02-08 00:53:26 +0000
commit28897e178400a93cfe6725f4166869c92efd228a (patch)
tree1776e12b01e9c88b05098af37916d660ed1ffb20 /include/llvm/Analysis/DataStructure
parent2cca3008e86aa5448a629c744064daecb531bf94 (diff)
Switch the Nodes list from being an std::vector<DSNode*> to an ilist<DSNode>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11173 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/DataStructure')
-rw-r--r--include/llvm/Analysis/DataStructure/DSGraph.h8
-rw-r--r--include/llvm/Analysis/DataStructure/DSNode.h29
2 files changed, 33 insertions, 4 deletions
diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h
index 2cfcfb9505..568a90bc60 100644
--- a/include/llvm/Analysis/DataStructure/DSGraph.h
+++ b/include/llvm/Analysis/DataStructure/DSGraph.h
@@ -92,7 +92,7 @@ struct DSGraph {
typedef DSScalarMap ScalarMapTy;
typedef hash_map<Function*, DSNodeHandle> ReturnNodesTy;
typedef hash_set<GlobalValue*> GlobalSetTy;
- typedef std::vector<DSNode*> NodeListTy;
+ typedef ilist<DSNode> NodeListTy;
/// NodeMapTy - This data type is used when cloning one graph into another to
/// keep track of the correspondence between the nodes in the old and new
@@ -171,9 +171,9 @@ public:
/// getNodes - Get a vector of all the nodes in the graph
///
- typedef NodeListTy::const_iterator node_iterator;
- node_iterator node_begin() const { return Nodes.begin(); }
- node_iterator node_end() const { return Nodes.end(); }
+ typedef NodeListTy::compat_iterator node_iterator;
+ node_iterator node_begin() const { return Nodes.compat_begin(); }
+ node_iterator node_end() const { return Nodes.compat_end(); }
/// getFunctionNames - Return a space separated list of the name of the
/// functions in this graph (if any)
diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h
index 6ddc7ec85e..e76a48090f 100644
--- a/include/llvm/Analysis/DataStructure/DSNode.h
+++ b/include/llvm/Analysis/DataStructure/DSNode.h
@@ -42,6 +42,11 @@ class DSNode {
/// null.
DSNodeHandle ForwardNH;
+ /// Next, Prev - These instance variables are used to keep the node on a
+ /// doubly-linked ilist in the DSGraph.
+ DSNode *Next, *Prev;
+ friend class ilist_traits<DSNode>;
+
/// Size - The current size of the node. This should be equal to the size of
/// the current type record.
///
@@ -334,6 +339,30 @@ private:
static void MergeNodes(DSNodeHandle& CurNodeH, DSNodeHandle& NH);
};
+//===----------------------------------------------------------------------===//
+// Define the ilist_traits specialization for the DSGraph ilist.
+//
+template<>
+struct ilist_traits<DSNode> {
+ static DSNode *getPrev(const DSNode *N) { return N->Prev; }
+ static DSNode *getNext(const DSNode *N) { return N->Next; }
+
+ static void setPrev(DSNode *N, DSNode *Prev) { N->Prev = Prev; }
+ static void setNext(DSNode *N, DSNode *Next) { N->Next = Next; }
+
+ static DSNode *createNode() { return new DSNode(0,0); }
+ //static DSNode *createNode(const DSNode &V) { return new DSNode(V); }
+
+
+ void addNodeToList(DSNode *NTy) {}
+ void removeNodeFromList(DSNode *NTy) {}
+ void transferNodesFromList(iplist<DSNode, ilist_traits> &L2,
+ ilist_iterator<DSNode> first,
+ ilist_iterator<DSNode> last) {}
+};
+
+template<>
+struct ilist_traits<const DSNode> : public ilist_traits<DSNode> {};
//===----------------------------------------------------------------------===//
// Define inline DSNodeHandle functions that depend on the definition of DSNode