[llvm-commits] [poolalloc] r66285 - in /poolalloc/trunk: include/dsa/DSNode.h lib/DSA/DataStructure.cpp
John Criswell
criswell at uiuc.edu
Fri Mar 6 11:05:09 PST 2009
Author: criswell
Date: Fri Mar 6 13:05:08 2009
New Revision: 66285
URL: http://llvm.org/viewvc/llvm-project?rev=66285&view=rev
Log:
Added missing methods to the specialization of the ilist for DSNodes.
This makes the code compile (and hopefully work) with the new LLVM API.
Reverted last change to DSNode constructors; it somehow intereferes with the
ilist implementation.
Modified:
poolalloc/trunk/include/dsa/DSNode.h
poolalloc/trunk/lib/DSA/DataStructure.cpp
Modified: poolalloc/trunk/include/dsa/DSNode.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSNode.h?rev=66285&r1=66284&r2=66285&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSNode.h (original)
+++ poolalloc/trunk/include/dsa/DSNode.h Fri Mar 6 13:05:08 2009
@@ -434,6 +434,29 @@
void transferNodesFromList(iplist<DSNode, ilist_traits> &L2,
ilist_iterator<DSNode> first,
ilist_iterator<DSNode> last) {}
+ DSNode *provideInitialHead() const {
+ DSNode * sentinel = createSentinel();
+ setPrev (sentinel, sentinel);
+ return sentinel;
+ }
+
+ /// ensureHead - make sure that Head is either already
+ /// initialized or assigned a fresh sentinel
+ /// @return the sentinel
+ static DSNode *ensureHead(DSNode *&Head) {
+ if (!Head) {
+ Head = createSentinel();
+ noteHead (Head, Head);
+ setNext(Head, Head);
+ return Head;
+ }
+ return getPrev(Head);
+ }
+
+ /// noteHead - stash the sentinel into its default location
+ static void noteHead(DSNode *NewHead, DSNode *Sentinel) {
+ setPrev(NewHead, Sentinel);
+ }
};
template<>
Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=66285&r1=66284&r2=66285&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Fri Mar 6 13:05:08 2009
@@ -147,9 +147,6 @@
if (T) mergeTypeInfo(T, 0);
if (G) G->addNode(this);
++NumNodeAllocated;
-
- // Be good memory stewards and give our pointers a default of NULL
- Next = Prev = 0;
}
// DSNode copy constructor... do not copy over the referrers list!
@@ -162,9 +159,6 @@
Links.resize(N.Links.size()); // Create the appropriate number of null links
G->addNode(this);
++NumNodeAllocated;
-
- // Be good memory stewards and give our pointers a default of NULL
- Next = Prev = 0;
}
DSNode::~DSNode() {
More information about the llvm-commits
mailing list