You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to introduce a new linked list data structure, TaggedList. This is an intrusive doubly linked list like llvm::iplist with the following differences:
Each node has a uint32_t tag member. These tags are maintained online in a strictly increasing order. This means that the relative position of elements in the list can be determined in (fast) constant time, even while inserting and removing elements from the list.
The list has a constant time size() operation, maintained as a member in the TaggedList class. This is needed for the online tag maintenance algorithm.
Splicing is a linear time operation because the new elements need to be tagged correctly. This is already the case for our specialization of transferNodesFromList().
The tag also makes it possible to detect when an end() iterator is dereferenced or incremented.
We already have class LiveIntervalsInstructionNumbering in IROptimizer.cpp. This change makes that class redundant by providing the same functionality while also allowing online instruction insertions.
The online instruction ordering is needed to implement advanced memory allocation and scheduling in backends.
Preemptively Answered Questions:
No, we can't extend llvm::iplist with this functionality because a) iplist::size() is linear time, and b) despite using 27 template classes for configuration and specialization, iplist doesn't offer the hooks needed.
No, we can't implement this as a hack in IRFunction because a) we need the constant time size() operator, and b) IRFunction::getInstrs() exposes the list implementation, and we can't prevent users from modifying the list and invalidating our side tables.
I want to introduce a new linked list data structure,
TaggedList. This is an intrusive doubly linked list likellvm::iplistwith the following differences:uint32_t tagmember. These tags are maintained online in a strictly increasing order. This means that the relative position of elements in the list can be determined in (fast) constant time, even while inserting and removing elements from the list.size()operation, maintained as a member in theTaggedListclass. This is needed for the online tag maintenance algorithm.transferNodesFromList().end()iterator is dereferenced or incremented.I have implemented a prototype of
TaggedListbased on the Two simplified algorithms for maintaining order in a list paper in order to run benchmarks. List insertions are O(log N) with excellent constant factors.We already have
class LiveIntervalsInstructionNumberinginIROptimizer.cpp. This change makes that class redundant by providing the same functionality while also allowing online instruction insertions.The online instruction ordering is needed to implement advanced memory allocation and scheduling in backends.
Preemptively Answered Questions:
llvm::iplistwith this functionality because a)iplist::size()is linear time, and b) despite using 27 template classes for configuration and specialization,iplistdoesn't offer the hooks needed.IRFunctionbecause a) we need the constant timesize()operator, and b)IRFunction::getInstrs()exposes the list implementation, and we can't prevent users from modifying the list and invalidating our side tables.