llvm.org GIT mirror llvm / 9de7579
Release notes for ilist changes, by Duncan git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_40@294478 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 3 years ago
1 changed file(s) with 74 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
7373 cross-module indirect call promotion.
7474 * Significant build-time and binary-size improvements when compiling with
7575 debug info (-g).
76
77 Intrusive list API overhaul
78 ---------------------------
79
80 The intrusive list infrastructure was substantially rewritten over the last
81 couple of releases, primarily to excise undefined behaviour. The biggest
82 changes landed in this release.
83
84 * ``simple_ilist`` is a lower-level intrusive list that never takes
85 ownership of its nodes. New intrusive-list clients should consider using it
86 instead of ``ilist``.
87
88 * ``ilist_tag`` allows a single data type to be inserted into two
89 parallel intrusive lists. A type can inherit twice from ``ilist_node``,
90 first using ``ilist_node>`` (enabling insertion into
91 ``simple_ilist>``) and second using
92 ``ilist_node>`` (enabling insertion into
93 ``simple_ilist>``), where ``A`` and ``B`` are arbitrary
94 types.
95
96 * ``ilist_sentinel_tracking`` controls whether an iterator knows
97 whether it's pointing at the sentinel (``end()``). By default, sentinel
98 tracking is on when ABI-breaking checks are enabled, and off otherwise;
99 this is used for an assertion when dereferencing ``end()`` (this assertion
100 triggered often in practice, and many backend bugs were fixed). Explicitly
101 turning on sentinel tracking also enables ``iterator::isEnd()``. This is
102 used by ``MachineInstrBundleIterator`` to iterate over bundles.
103
104 * ``ilist`` is built on top of ``simple_ilist``, and supports the same
105 configuration options. As before (and unlike ``simple_ilist``),
106 ``ilist`` takes ownership of its nodes. However, it no longer supports
107 *allocating* nodes, and is now equivalent to ``iplist``. ``iplist``
108 will likely be removed in the future.
109
110 * ``ilist`` now always uses ``ilist_traits``. Instead of passing a
111 custom traits class in via a template parameter, clients that want to
112 customize the traits should specialize ``ilist_traits``. Clients that
113 want to avoid ownership can specialize ``ilist_alloc_traits`` to inherit
114 from ``ilist_noalloc_traits`` (or to do something funky); clients that
115 need callbacks can specialize ``ilist_callback_traits`` directly.
116
117 * The underlying data structure is now a simple recursive linked list. The
118 sentinel node contains only a "next" (``begin()``) and "prev" (``rbegin()``)
119 pointer and is stored in the same allocation as ``simple_ilist``.
120 Previously, it was malloc-allocated on-demand by default, although the
121 now-defunct ``ilist_sentinel_traits`` was sometimes specialized to avoid
122 this.
123
124 * The ``reverse_iterator`` class no longer uses ``std::reverse_iterator``.
125 Instead, it now has a handle to the same node that it dereferences to.
126 Reverse iterators now have the same iterator invalidation semantics as
127 forward iterators.
128
129 * ``iterator`` and ``reverse_iterator`` have explicit conversion constructors
130 that match ``std::reverse_iterator``'s off-by-one semantics, so that
131 reversing the end points of an iterator range results in the same range
132 (albeit in reverse). I.e., ``reverse_iterator(begin())`` equals
133 ``rend()``.
134
135 * ``iterator::getReverse()`` and ``reverse_iterator::getReverse()`` return an
136 iterator that dereferences to the *same* node. I.e.,
137 ``begin().getReverse()`` equals ``--rend()``.
138
139 * ``ilist_node::getIterator()`` and
140 ``ilist_node::getReverseIterator()`` return the forward and reverse
141 iterators that dereference to the current node. I.e.,
142 ``begin()->getIterator()`` equals ``begin()`` and
143 ``rbegin()->getReverseIterator()`` equals ``rbegin()``.
144
145 * ``iterator`` now stores an ``ilist_node_base*`` instead of a ``T*``. The
146 implicit conversions between ``ilist::iterator`` and ``T*`` have been
147 removed. Clients may use ``N->getIterator()`` (if not ``nullptr``) or
148 ``&*I`` (if not ``end()``); alternatively, clients may refactor to use
149 references for known-good nodes.
76150
77151 Changes to the LLVM IR
78152 ----------------------