@@ -808,19 +808,15 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
808
808
Indent += 2 ;
809
809
810
810
// Emit ULEB128 encoded value to OS, returning the number of bytes emitted.
811
- auto emitULEB128 = [](DecoderTable::const_iterator I,
811
+ auto emitULEB128 = [](DecoderTable::const_iterator & I,
812
812
formatted_raw_ostream &OS) {
813
- unsigned Len = 0 ;
814
- while (*I >= 128 ) {
813
+ while (*I >= 128 )
815
814
OS << (unsigned )*I++ << " , " ;
816
- Len++;
817
- }
818
815
OS << (unsigned )*I++ << " , " ;
819
- return Len + 1 ;
820
816
};
821
817
822
818
// Emit 24-bit numtoskip value to OS, returning the NumToSkip value.
823
- auto emitNumToSkip = [](DecoderTable::const_iterator I,
819
+ auto emitNumToSkip = [](DecoderTable::const_iterator & I,
824
820
formatted_raw_ostream &OS) {
825
821
uint8_t Byte = *I++;
826
822
uint32_t NumToSkip = Byte;
@@ -857,7 +853,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
857
853
unsigned Start = decodeULEB128 (Table.data () + Pos + 1 , nullptr ,
858
854
Table.data () + Table.size (), &ErrMsg);
859
855
assert (ErrMsg == nullptr && " ULEB128 value too large!" );
860
- I += emitULEB128 (I, OS);
856
+ emitULEB128 (I, OS);
861
857
862
858
unsigned Len = *I++;
863
859
OS << Len << " , // Inst{" ;
@@ -870,39 +866,36 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
870
866
++I;
871
867
OS << Indent << " MCD::OPC_FilterValue, " ;
872
868
// The filter value is ULEB128 encoded.
873
- I += emitULEB128 (I, OS);
869
+ emitULEB128 (I, OS);
874
870
875
871
// 24-bit numtoskip value.
876
872
uint32_t NumToSkip = emitNumToSkip (I, OS);
877
- I += 3 ;
878
873
OS << " // Skip to: " << ((I - Table.begin ()) + NumToSkip) << " \n " ;
879
874
break ;
880
875
}
881
876
case MCD::OPC_CheckField: {
882
877
++I;
883
878
OS << Indent << " MCD::OPC_CheckField, " ;
884
879
// ULEB128 encoded start value.
885
- I += emitULEB128 (I, OS);
880
+ emitULEB128 (I, OS);
886
881
// 8-bit length.
887
882
unsigned Len = *I++;
888
883
OS << Len << " , " ;
889
884
// ULEB128 encoded field value.
890
- I += emitULEB128 (I, OS);
885
+ emitULEB128 (I, OS);
891
886
892
887
// 24-bit numtoskip value.
893
888
uint32_t NumToSkip = emitNumToSkip (I, OS);
894
- I += 3 ;
895
889
OS << " // Skip to: " << ((I - Table.begin ()) + NumToSkip) << " \n " ;
896
890
break ;
897
891
}
898
892
case MCD::OPC_CheckPredicate: {
899
893
++I;
900
894
OS << Indent << " MCD::OPC_CheckPredicate, " ;
901
- I += emitULEB128 (I, OS);
895
+ emitULEB128 (I, OS);
902
896
903
897
// 24-bit numtoskip value.
904
898
uint32_t NumToSkip = emitNumToSkip (I, OS);
905
- I += 3 ;
906
899
OS << " // Skip to: " << ((I - Table.begin ()) + NumToSkip) << " \n " ;
907
900
break ;
908
901
}
@@ -917,10 +910,10 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
917
910
assert (ErrMsg == nullptr && " ULEB128 value too large!" );
918
911
919
912
OS << Indent << " MCD::OPC_" << (IsTry ? " Try" : " " ) << " Decode, " ;
920
- I += emitULEB128 (I, OS);
913
+ emitULEB128 (I, OS);
921
914
922
915
// Decoder index.
923
- I += emitULEB128 (I, OS);
916
+ emitULEB128 (I, OS);
924
917
925
918
auto EncI = OpcodeToEncodingID.find (Opc);
926
919
assert (EncI != OpcodeToEncodingID.end () && " no encoding entry" );
@@ -935,7 +928,6 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
935
928
936
929
// 24-bit numtoskip value.
937
930
uint32_t NumToSkip = emitNumToSkip (I, OS);
938
- I += 3 ;
939
931
940
932
OS << " // Opcode: " << NumberedEncodings[EncodingID]
941
933
<< " , skip to: " << ((I - Table.begin ()) + NumToSkip) << " \n " ;
0 commit comments