@@ -849,8 +849,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
849
849
850
850
// ULEB128 encoded start value.
851
851
const char *ErrMsg = nullptr ;
852
- unsigned Start = decodeULEB128 (Table.data () + Pos + 1 , nullptr ,
853
- Table.data () + Table.size (), &ErrMsg);
852
+ unsigned Start = decodeULEB128 (&*I, nullptr , &*E, &ErrMsg);
854
853
assert (ErrMsg == nullptr && " ULEB128 value too large!" );
855
854
emitULEB128 (I, OS);
856
855
@@ -904,8 +903,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
904
903
++I;
905
904
// Decode the Opcode value.
906
905
const char *ErrMsg = nullptr ;
907
- unsigned Opc = decodeULEB128 (Table.data () + Pos + 1 , nullptr ,
908
- Table.data () + Table.size (), &ErrMsg);
906
+ unsigned Opc = decodeULEB128 (&*I, nullptr , &*E, &ErrMsg);
909
907
assert (ErrMsg == nullptr && " ULEB128 value too large!" );
910
908
911
909
OS << Indent << " MCD::OPC_" << (IsTry ? " Try" : " " ) << " Decode, " ;
@@ -935,30 +933,23 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
935
933
case MCD::OPC_SoftFail: {
936
934
++I;
937
935
OS << Indent << " MCD::OPC_SoftFail" ;
938
- // Positive mask
939
- uint64_t Value = 0 ;
940
- unsigned Shift = 0 ;
941
- do {
942
- OS << " , " << (unsigned )*I;
943
- Value += ((uint64_t )(*I & 0x7f )) << Shift;
944
- Shift += 7 ;
945
- } while (*I++ >= 128 );
946
- if (Value > 127 ) {
936
+ // Decode the positive mask.
937
+ const char *ErrMsg = nullptr ;
938
+ uint64_t PositiveMask = decodeULEB128 (&*I, nullptr , &*E, &ErrMsg);
939
+ assert (ErrMsg == nullptr && " ULEB128 value too large!" );
940
+ emitULEB128 (I, OS);
941
+ if (PositiveMask > 127 ) {
947
942
OS << " /* 0x" ;
948
- OS.write_hex (Value );
943
+ OS.write_hex (PositiveMask );
949
944
OS << " */" ;
950
945
}
951
- // Negative mask
952
- Value = 0 ;
953
- Shift = 0 ;
954
- do {
955
- OS << " , " << (unsigned )*I;
956
- Value += ((uint64_t )(*I & 0x7f )) << Shift;
957
- Shift += 7 ;
958
- } while (*I++ >= 128 );
959
- if (Value > 127 ) {
946
+ // Decode the negative mask.
947
+ uint64_t NegativeMask = decodeULEB128 (&*I, nullptr , &*E, &ErrMsg);
948
+ assert (ErrMsg == nullptr && " ULEB128 value too large!" );
949
+ emitULEB128 (I, OS);
950
+ if (NegativeMask > 127 ) {
960
951
OS << " /* 0x" ;
961
- OS.write_hex (Value );
952
+ OS.write_hex (NegativeMask );
962
953
OS << " */" ;
963
954
}
964
955
OS << " ,\n " ;
0 commit comments