[all-commits] [llvm/llvm-project] 0863bd: [LLVM] Add option to store Parent-pointer in ilist...
Stephen Tozer via All-commits
all-commits at lists.llvm.org
Tue Jun 18 11:59:57 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0863bd83e573f5e3e35c5c6b5750ac74f2295f48
https://github.com/llvm/llvm-project/commit/0863bd83e573f5e3e35c5c6b5750ac74f2295f48
Author: Stephen Tozer <stephen.tozer at sony.com>
Date: 2024-06-18 (Tue, 18 Jun 2024)
Changed paths:
M llvm/include/llvm/ADT/ilist_base.h
M llvm/include/llvm/ADT/ilist_iterator.h
M llvm/include/llvm/ADT/ilist_node.h
M llvm/include/llvm/ADT/ilist_node_base.h
M llvm/include/llvm/ADT/ilist_node_options.h
M llvm/include/llvm/IR/BasicBlock.h
M llvm/include/llvm/IR/Instruction.h
M llvm/include/llvm/IR/ValueSymbolTable.h
M llvm/lib/IR/BasicBlock.cpp
M llvm/lib/IR/Instruction.cpp
M llvm/unittests/ADT/IListBaseTest.cpp
M llvm/unittests/ADT/IListIteratorBitsTest.cpp
M llvm/unittests/ADT/IListIteratorTest.cpp
M llvm/unittests/ADT/IListNodeBaseTest.cpp
M llvm/unittests/ADT/IListNodeTest.cpp
Log Message:
-----------
[LLVM] Add option to store Parent-pointer in ilist_node_base (#94224)
This patch adds a new option for `ilist`, `ilist_parent<ParentTy>`, that
enables storing an additional pointer in the `ilist_node_base` type to a
specified "parent" type, and uses that option for `Instruction`.
This is distinct from the `ilist_node_with_parent` class, despite their
apparent similarities. The `ilist_node_with_parent` class is a subclass
of `ilist_node` that requires its own subclasses to define a `getParent`
method, which is then used by the owning `ilist` for some of its
operations; it is purely an interface declaration. The `ilist_parent`
option on the other hand is concerned with data, adding a parent field
to the `ilist_node_base` class.
Currently, we can use `BasicBlock::iterator` to insert instructions,
_except_ when either the iterator is invalid (`NodePtr=0x0`), or when
the iterator points to a sentinel value (`BasicBlock::end()`). This patch
results in the sentinel value also having a valid pointer to its owning
basic block, which allows us to use iterators for all insertions,
without needing to store or pass an extra `BasicBlock *BB` argument
alongside it.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list