@@ -319,8 +319,8 @@ static raw_ostream &operator<<(raw_ostream &OS, const EncodingAndInst &Value) {
319319}
320320
321321// Prints the bit value for each position.
322- static void dumpBits (raw_ostream &OS, const BitsInit &Bits) {
323- for (const Init *Bit : reverse (Bits.getBits ()))
322+ static void dumpBits (raw_ostream &OS, const BitsInit &Bits, unsigned BitWidth ) {
323+ for (const Init *Bit : reverse (Bits.getBits (). take_front (BitWidth) ))
324324 OS << BitValue (Bit);
325325}
326326
@@ -389,16 +389,16 @@ class FilterChooser;
389389// /
390390// / An example of a conflict is
391391// /
392- // / Conflict:
393- // / 111101000.00 ........00010000 ....
394- // / 111101000.00 ........0001 ........
395- // / 1111010...00 ........0001 ........
396- // / 1111010...00....................
397- // / 1111010................. ........
398- // / 1111. ................... ........
399- // / . ........................... ....
400- // / VST4q8a 111101000_00________00010000____
401- // / VST4q8b 111101000_00________00010000____
392+ // / Decoding Conflict:
393+ // / . ........................... ....
394+ // / 1111. ................... ........
395+ // / 1111010................. ........
396+ // / 1111010...00....................
397+ // / 1111010...00 ........0001 ........
398+ // / 111101000.00 ........0001 ........
399+ // / 111101000.00 ........00010000 ....
400+ // / 111101000_00________00010000____ VST4q8a
401+ // / 111101000_00________00010000____ VST4q8b
402402// /
403403// / The Debug output shows the path that the decoding tree follows to reach the
404404// / the conclusion that there is a conflict. VST4q8a is a vst4 to double-spaced
@@ -582,7 +582,7 @@ class FilterChooser {
582582
583583 // / dumpStack - dumpStack traverses the filter chooser chain and calls
584584 // / dumpFilterArray on each filter chooser up to the top level one.
585- void dumpStack (raw_ostream &OS, const char *prefix ) const ;
585+ void dumpStack (raw_ostream &OS, indent Indent ) const ;
586586
587587 bool PositionFiltered (unsigned Idx) const {
588588 return FilterBitValues[Idx].isSet ();
@@ -701,9 +701,8 @@ void Filter::recurse() {
701701 std::vector<BitValue> BitValueArray (Owner.FilterBitValues );
702702
703703 if (!VariableInstructions.empty ()) {
704- // Conservatively marks each segment position as BIT_UNSET.
705704 for (unsigned bitIndex = 0 ; bitIndex < NumBits; ++bitIndex)
706- BitValueArray[StartBit + bitIndex] = BitValue::BIT_UNSET ;
705+ BitValueArray[StartBit + bitIndex] = BitValue::BIT_UNFILTERED ;
707706
708707 // Delegates to an inferior filter chooser for further processing on this
709708 // group of instructions whose segment values are variable.
@@ -1118,15 +1117,12 @@ void FilterChooser::dumpFilterArray(raw_ostream &OS,
11181117
11191118// / dumpStack - dumpStack traverses the filter chooser chain and calls
11201119// / dumpFilterArray on each filter chooser up to the top level one.
1121- void FilterChooser::dumpStack (raw_ostream &OS, const char *prefix) const {
1122- const FilterChooser *current = this ;
1123-
1124- while (current) {
1125- OS << prefix;
1126- dumpFilterArray (OS, current->FilterBitValues );
1127- OS << ' \n ' ;
1128- current = current->Parent ;
1129- }
1120+ void FilterChooser::dumpStack (raw_ostream &OS, indent Indent) const {
1121+ if (Parent)
1122+ Parent->dumpStack (OS, Indent);
1123+ OS << Indent;
1124+ dumpFilterArray (OS, FilterBitValues);
1125+ OS << ' \n ' ;
11301126}
11311127
11321128// Calculates the island(s) needed to decode the instruction.
@@ -1765,13 +1761,16 @@ void FilterChooser::doFilter() {
17651761 // Print out useful conflict information for postmortem analysis.
17661762 errs () << " Decoding Conflict:\n " ;
17671763
1768- dumpStack (errs (), " \t\t " );
1764+ // Dump filters.
1765+ indent Indent (4 );
1766+ dumpStack (errs (), Indent);
17691767
1770- for (auto Opcode : Opcodes) {
1768+ // Dump encodings.
1769+ for (EncodingIDAndOpcode Opcode : Opcodes) {
17711770 const EncodingAndInst &Enc = AllInstructions[Opcode.EncodingID ];
1772- errs () << ' \t ' << Enc << ' ' ;
1773- dumpBits (errs (), getBitsField (*Enc.EncodingDef , " Inst" ));
1774- errs () << ' \n ' ;
1771+ errs () << Indent ;
1772+ dumpBits (errs (), getBitsField (*Enc.EncodingDef , " Inst" ), BitWidth );
1773+ errs () << " " << Enc << ' \n ' ;
17751774 }
17761775 PrintFatalError (" Decoding conflict encountered" );
17771776}
0 commit comments