@@ -533,10 +533,10 @@ class FilterChooser {
533
533
534
534
protected:
535
535
// Populates the insn given the uid.
536
- void insnWithID (insn_t &Insn, unsigned Opcode) const {
536
+ insn_t insnWithID (unsigned Opcode) const {
537
537
const Record *EncodingDef = AllInstructions[Opcode].EncodingDef ;
538
538
const BitsInit &Bits = getBitsField (*EncodingDef, " Inst" );
539
- Insn. resize (std::max (BitWidth, Bits.getNumBits ()), BitValue::BIT_UNSET);
539
+ insn_t Insn (std::max (BitWidth, Bits.getNumBits ()), BitValue::BIT_UNSET);
540
540
// We may have a SoftFail bitmask, which specifies a mask where an encoding
541
541
// may differ from the value in "Inst" and yet still be valid, but the
542
542
// disassembler should return SoftFail instead of Success.
@@ -550,6 +550,7 @@ class FilterChooser {
550
550
else
551
551
Insn[i] = BitValue (Bits, i);
552
552
}
553
+ return Insn;
553
554
}
554
555
555
556
// Populates the field of the insn given the start position and the number of
@@ -582,7 +583,7 @@ class FilterChooser {
582
583
// This returns a list of undecoded bits of an instructions, for example,
583
584
// Inst{20} = 1 && Inst{3-0} == 0b1111 represents two islands of yet-to-be
584
585
// decoded bits in order to verify that the instruction matches the Opcode.
585
- unsigned getIslands ( std::vector<Island> &Islands, const insn_t &Insn) const ;
586
+ std::vector<Island> getIslands ( const insn_t &Insn) const ;
586
587
587
588
// Emits code to check the Predicates member of an instruction are true.
588
589
// Returns true if predicate matches were emitted, false otherwise.
@@ -658,10 +659,8 @@ Filter::Filter(const FilterChooser &owner, unsigned startBit, unsigned numBits)
658
659
LastOpcFiltered = {0 , 0 };
659
660
660
661
for (const auto &OpcPair : Owner.Opcodes ) {
661
- insn_t Insn;
662
-
663
662
// Populates the insn given the uid.
664
- Owner.insnWithID (Insn, OpcPair.EncodingID );
663
+ insn_t Insn = Owner.insnWithID (OpcPair.EncodingID );
665
664
666
665
// Scans the segment for possibly well-specified encoding bits.
667
666
auto [Ok, Field] = Owner.fieldFromInsn (Insn, StartBit, NumBits);
@@ -1162,8 +1161,9 @@ void FilterChooser::dumpStack(raw_ostream &OS, const char *prefix) const {
1162
1161
// This returns a list of undecoded bits of an instructions, for example,
1163
1162
// Inst{20} = 1 && Inst{3-0} == 0b1111 represents two islands of yet-to-be
1164
1163
// decoded bits in order to verify that the instruction matches the Opcode.
1165
- unsigned FilterChooser::getIslands (std::vector<Island> &Islands,
1166
- const insn_t &Insn) const {
1164
+ std::vector<FilterChooser::Island>
1165
+ FilterChooser::getIslands (const insn_t &Insn) const {
1166
+ std::vector<Island> Islands;
1167
1167
uint64_t FieldVal;
1168
1168
unsigned StartBit;
1169
1169
@@ -1203,7 +1203,7 @@ unsigned FilterChooser::getIslands(std::vector<Island> &Islands,
1203
1203
if (State == 2 )
1204
1204
Islands.push_back ({StartBit, BitWidth - StartBit, FieldVal});
1205
1205
1206
- return Islands. size () ;
1206
+ return Islands;
1207
1207
}
1208
1208
1209
1209
bool FilterChooser::emitBinaryParser (raw_ostream &OS, indent Indent,
@@ -1452,12 +1452,10 @@ void FilterChooser::emitSoftFailTableEntry(DecoderTableInfo &TableInfo,
1452
1452
// Emits table entries to decode the singleton.
1453
1453
void FilterChooser::emitSingletonTableEntry (DecoderTableInfo &TableInfo,
1454
1454
EncodingIDAndOpcode Opc) const {
1455
- std::vector<Island> Islands;
1456
- insn_t Insn;
1457
- insnWithID (Insn, Opc.EncodingID );
1455
+ insn_t Insn = insnWithID (Opc.EncodingID );
1458
1456
1459
1457
// Look for islands of undecoded bits of the singleton.
1460
- getIslands ( Islands, Insn);
1458
+ std::vector<Island> Islands = getIslands ( Insn);
1461
1459
1462
1460
// Emit the predicate table entry if one is needed.
1463
1461
emitPredicateTableEntry (TableInfo, Opc.EncodingID );
@@ -1569,13 +1567,11 @@ bool FilterChooser::filterProcessor(bool AllowMixed, bool Greedy) {
1569
1567
assert (numInstructions == 3 );
1570
1568
1571
1569
for (const auto &Opcode : Opcodes) {
1572
- std::vector<Island> Islands;
1573
- insn_t Insn;
1574
-
1575
- insnWithID (Insn, Opcode.EncodingID );
1570
+ insn_t Insn = insnWithID (Opcode.EncodingID );
1576
1571
1577
1572
// Look for islands of undecoded bits of any instruction.
1578
- if (getIslands (Islands, Insn) > 0 ) {
1573
+ std::vector<Island> Islands = getIslands (Insn);
1574
+ if (!Islands.empty ()) {
1579
1575
// Found an instruction with island(s). Now just assign a filter.
1580
1576
runSingleFilter (Islands[0 ].StartBit , Islands[0 ].NumBits );
1581
1577
return true ;
@@ -1611,9 +1607,7 @@ bool FilterChooser::filterProcessor(bool AllowMixed, bool Greedy) {
1611
1607
bitAttrs[BitIndex] = ATTR_FILTERED;
1612
1608
1613
1609
for (const auto &OpcPair : Opcodes) {
1614
- insn_t insn;
1615
-
1616
- insnWithID (insn, OpcPair.EncodingID );
1610
+ insn_t insn = insnWithID (OpcPair.EncodingID );
1617
1611
1618
1612
for (BitIndex = 0 ; BitIndex < BitWidth; ++BitIndex) {
1619
1613
switch (bitAttrs[BitIndex]) {
0 commit comments