[all-commits] [llvm/llvm-project] 396139: [TableGen] Introduce MatcherList to manage a linke...
Craig Topper via All-commits
all-commits at lists.llvm.org
Fri Feb 13 17:57:10 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 39613943855e6a82b1bb4c3d16fbaf2289a5d739
https://github.com/llvm/llvm-project/commit/39613943855e6a82b1bb4c3d16fbaf2289a5d739
Author: Craig Topper <craig.topper at sifive.com>
Date: 2026-02-13 (Fri, 13 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:
-----------
[TableGen] Introduce MatcherList to manage a linked list of Matchers. NFC (#177875)
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