[all-commits] [llvm/llvm-project] 8d971c: Reapply "[TableGen] Introduce MatcherList to manag...
Craig Topper via All-commits
all-commits at lists.llvm.org
Sat Feb 14 23:37:07 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8d971c0360f91729cc5120ffd361f7b55e97f2ab
https://github.com/llvm/llvm-project/commit/8d971c0360f91729cc5120ffd361f7b55e97f2ab
Author: Craig Topper <craig.topper at sifive.com>
Date: 2026-02-14 (Sat, 14 Feb 2026)
Changed paths:
M llvm/utils/TableGen/DAGISelEmitter.cpp
M llvm/utils/TableGen/DAGISelMatcher.cpp
M llvm/utils/TableGen/DAGISelMatcher.h
M llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
M llvm/utils/TableGen/DAGISelMatcherGen.cpp
M llvm/utils/TableGen/DAGISelMatcherOpt.cpp
Log Message:
-----------
Reapply "[TableGen] Introduce MatcherList to manage a linked list of Matchers. NFC (#177875)"
With fixes to the slice_after functions to avoid dereferencing the
before_begin() iterator. Deferencing the iterator casts a pointer
to the BeforeBegin object to Matcher*, but the BeforeBegin object
is not a Matcher. This caused a failure when built with gcc.
Original commit message:
The previous memory management involved passing around references to the
std::unique_ptr next pointer in each Matcher. Scopes and
SwitchOpcode/SwitchType did not use std::unique_ptr internally, but
would sometimes need to have the pointers to their children moved to
temporary std::unique_ptrs that may be modified and then put back into
the Scope/Switch. Other code used manual deletion.
This patch introduces a MatcherList object that encapsulates list
management and ownership. The interface is based on std::forward_list
using the libcxx implementation for reference.
Once a Matcher is added to a MatcherList it can only be in that list or
spliced into another list. This ensures it is always owned by a list
that will be responsible for deleting it.
Scope and SwitchOpcode/Type children are now MatcherLists rather than
Matcher*. A nice side effect of this is that we no longer need a Size
field in each Matcher to store the size of Scope/Switch children during
emission. This field was only used for the Matcher that the Scope/Switch
children pointed to. Now we can store it in the MatcherList instead.
There is no change to the generated output.
There's still a little bit of cleanup that can be done in follow ups. For example,
renaming "TheMatcher" and merging FactorScope and FactorNodes together.
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