An intrusive list node.
Synopsis
Declared in <llvm/ADT/ilist_node.h>
template<
class T,
class... Options>
class ilist_node
: public ilist_node_impl<ilist_detail::compute_node_options<T, Options...>::type>
Description
A base class to enable membership in intrusive lists, including simple_ilist, iplist, and ilist. The first template parameter is the value_type for the list.
An ilist node can be configured with compile‐time options to change behaviour and/or add API.
By default, an ilist_node knows whether it is the list sentinel (an instance of ilist_sentinel) if and only if LLVM_ENABLE_ABI_BREAKING_CHECKS. The function isKnownSentinel() always returns false tracking is off. Sentinel tracking steals a bit from the "prev" link, which adds a mask operation when decrementing an iterator, but enables bug‐finding assertions in ilist_iterator.
To turn sentinel tracking on all the time, pass in the ilist_sentinel_tracking<true> template parameter. This also enables the isSentinel() function. The same option must be passed to the intrusive list. (ilist_sentinel_tracking<false> turns sentinel tracking off all the time.)
A type can inherit from ilist_node multiple times by passing in different ilist_tag options. This allows a single instance to be inserted into multiple lists simultaneously, where each list is given the same tag.
struct A {}; struct B {}; struct N : ilist_node<N, ilist_tag[>, ilist_node<N, ilist_tag<B>> {};]
void foo() { simple_ilist<N, ilist_tag[> ListA;] simple_ilist<N, ilist_tag<B>> ListB; N N1; ListA.push_back(N1); ListB.push_back(N1); } endexample
When the ilist_parent<ParentTy> option is passed to an ilist_node and the owning ilist, each node contains a pointer to the ilist's owner. This adds getParent() and setParent(ParentTy*) methods to the ilist_node, which will be used for node access by the ilist if the node class publicly inherits from ilist_node_with_parent. By default, setParent() is not automatically called by the ilist; a SymbolTableList will call setParent() on inserted nodes, but the sentinel must still be manually set after the list is created (e.g. SymTabList.end()‐>setParent(Parent)).
The primary benefit of using ilist_parent is that a parent pointer will be stored in the sentinel, meaning that you can safely use ilist_iterator::getNodeParent() to get the node parent from any valid (i.e. non‐null) iterator, even one that points to a sentinel value.
See is_valid_option for steps on adding a new option.
Base Classes
Name |
Description |
Implementation for an ilist node. |
Member Functions
Name |
Description |
|
|
|
|
|
|
Check whether this is the sentinel node. |
|
Record |
Using Declarations
Name |
Description |
Return whether this node is known to be a list sentinel. |
Protected Type Aliases
Name |
Description |
Const reverse iterator referring to this node. |
|
Forward const iterator referring to this node. |
|
Reverse mutable iterator referring to this node. |
|
Forward mutable iterator referring to this node. |
Derived Classes
Name |
Description |
A set of memory locations that may alias each other. |
|
Binary held in an intrusive LRU cache, or an empty error placeholder. |
|
Base class for non‐instruction debug metadata records positioned in IR. |
|
A single function or procedure in LLVM IR. |
|
Represents a single function or variable alias in the IR. |
|
Represents a single ELF indirect function (ifunc) in the IR. |
|
Represents a single global variable (or constant) in the IR. |
|
Tracks one use of a strided induction variable. |
|
An entry in the SlotIndexes index list. |
|
Base class for MemoryUse, MemoryDef, and MemoryPhi nodes in MemorySSA. |
|
A tuple of MDNodes. |
|
Represents one node in the SelectionDAG. |
|
An ilist node that can access its parent list. |
Created with MrDocs