Skip to content

Commit ff033d1

Browse files
committed
[TableGen] Use reference instead of pointer for FilterChooser in Filter. NFC
1 parent 7dd5f23 commit ff033d1

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

llvm/utils/TableGen/DecoderEmitter.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,7 @@ class FilterChooser;
306306
/// version and return the Opcode since the two have the same Asm format string.
307307
class Filter {
308308
protected:
309-
const FilterChooser
310-
*Owner; // points to the FilterChooser who owns this filter
309+
const FilterChooser &Owner; // FilterChooser who owns this filter
311310
unsigned StartBit; // the starting bit position
312311
unsigned NumBits; // number of bits to filter
313312
bool Mixed; // a mixed region contains both set and unset bits
@@ -329,7 +328,8 @@ class Filter {
329328

330329
public:
331330
Filter(Filter &&f);
332-
Filter(FilterChooser &owner, unsigned startBit, unsigned numBits, bool mixed);
331+
Filter(const FilterChooser &owner, unsigned startBit, unsigned numBits,
332+
bool mixed);
333333

334334
~Filter() = default;
335335

@@ -589,22 +589,22 @@ Filter::Filter(Filter &&f)
589589
FilterChooserMap(std::move(f.FilterChooserMap)),
590590
NumFiltered(f.NumFiltered), LastOpcFiltered(f.LastOpcFiltered) {}
591591

592-
Filter::Filter(FilterChooser &owner, unsigned startBit, unsigned numBits,
592+
Filter::Filter(const FilterChooser &owner, unsigned startBit, unsigned numBits,
593593
bool mixed)
594-
: Owner(&owner), StartBit(startBit), NumBits(numBits), Mixed(mixed) {
595-
assert(StartBit + NumBits - 1 < Owner->BitWidth);
594+
: Owner(owner), StartBit(startBit), NumBits(numBits), Mixed(mixed) {
595+
assert(StartBit + NumBits - 1 < Owner.BitWidth);
596596

597597
NumFiltered = 0;
598598
LastOpcFiltered = {0, 0};
599599

600-
for (const auto &OpcPair : Owner->Opcodes) {
600+
for (const auto &OpcPair : Owner.Opcodes) {
601601
insn_t Insn;
602602

603603
// Populates the insn given the uid.
604-
Owner->insnWithID(Insn, OpcPair.EncodingID);
604+
Owner.insnWithID(Insn, OpcPair.EncodingID);
605605

606606
// Scans the segment for possibly well-specified encoding bits.
607-
auto [Ok, Field] = Owner->fieldFromInsn(Insn, StartBit, NumBits);
607+
auto [Ok, Field] = Owner.fieldFromInsn(Insn, StartBit, NumBits);
608608

609609
if (Ok) {
610610
// The encoding bits are well-known. Lets add the uid of the
@@ -631,7 +631,7 @@ Filter::Filter(FilterChooser &owner, unsigned startBit, unsigned numBits,
631631
// match the remaining undecoded encoding bits against the singleton.
632632
void Filter::recurse() {
633633
// Starts by inheriting our parent filter chooser's filter bit values.
634-
std::vector<bit_value_t> BitValueArray(Owner->FilterBitValues);
634+
std::vector<bit_value_t> BitValueArray(Owner.FilterBitValues);
635635

636636
if (!VariableInstructions.empty()) {
637637
// Conservatively marks each segment position as BIT_UNSET.
@@ -642,9 +642,9 @@ void Filter::recurse() {
642642
// group of instructions whose segment values are variable.
643643
FilterChooserMap.try_emplace(
644644
NO_FIXED_SEGMENTS_SENTINEL,
645-
std::make_unique<FilterChooser>(Owner->AllInstructions,
646-
VariableInstructions, Owner->Operands,
647-
BitValueArray, *Owner));
645+
std::make_unique<FilterChooser>(Owner.AllInstructions,
646+
VariableInstructions, Owner.Operands,
647+
BitValueArray, Owner));
648648
}
649649

650650
// No need to recurse for a singleton filtered instruction.
@@ -667,10 +667,10 @@ void Filter::recurse() {
667667

668668
// Delegates to an inferior filter chooser for further processing on this
669669
// category of instructions.
670-
FilterChooserMap.try_emplace(Inst.first,
671-
std::make_unique<FilterChooser>(
672-
Owner->AllInstructions, Inst.second,
673-
Owner->Operands, BitValueArray, *Owner));
670+
FilterChooserMap.try_emplace(
671+
Inst.first,
672+
std::make_unique<FilterChooser>(Owner.AllInstructions, Inst.second,
673+
Owner.Operands, BitValueArray, Owner));
674674
}
675675
}
676676

0 commit comments

Comments
 (0)