[llvm] [TableGen][DecoderEmitter] Avoid using a sentinel value (PR #153986)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 16 19:23:33 PDT 2025
================
@@ -746,46 +744,30 @@ void Filter::emitTableEntry(DecoderTableInfo &TableInfo) const {
TableInfo.Table.insertULEB128(StartBit);
TableInfo.Table.push_back(NumBits);
- // If the NO_FIXED_SEGMENTS_SENTINEL is present, we need to add a new scope
- // for this filter. Otherwise, we can skip adding a new scope and any
- // patching added will automatically be added to the enclosing scope.
-
- // If NO_FIXED_SEGMENTS_SENTINEL is present, it will be last entry in
- // FilterChooserMap.
-
+ // If VariableFC is present, we need to add a new scope for this filter.
+ // Otherwise, we can skip adding a new scope and any patching added will
+ // automatically be added to the enclosing scope.
const uint64_t LastFilter = FilterChooserMap.rbegin()->first;
- bool HasFallthrough = LastFilter == NO_FIXED_SEGMENTS_SENTINEL;
- if (HasFallthrough)
- TableInfo.pushScope();
+ if (VariableFC)
+ TableInfo.FixupStack.emplace_back();
DecoderTable &Table = TableInfo.Table;
size_t PrevFilter = 0;
for (const auto &[FilterVal, Delegate] : FilterChooserMap) {
- // Field value NO_FIXED_SEGMENTS_SENTINEL implies a non-empty set of
- // variable instructions. See also recurse().
- if (FilterVal == NO_FIXED_SEGMENTS_SENTINEL) {
----------------
s-barannikov wrote:
This was effectively moved below the loop. Hiding whitespace changes makes it a little easier to review.
https://github.com/llvm/llvm-project/pull/153986
More information about the llvm-commits
mailing list