@@ -849,8 +849,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
849849
850850 // ULEB128 encoded start value.
851851 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);
854853 assert (ErrMsg == nullptr && " ULEB128 value too large!" );
855854 emitULEB128 (I, OS);
856855
@@ -904,8 +903,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
904903 ++I;
905904 // Decode the Opcode value.
906905 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);
909907 assert (ErrMsg == nullptr && " ULEB128 value too large!" );
910908
911909 OS << Indent << " MCD::OPC_" << (IsTry ? " Try" : " " ) << " Decode, " ;
@@ -934,34 +932,22 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
934932 }
935933 case MCD::OPC_SoftFail: {
936934 ++I;
937- 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 ) {
947- OS << " /* 0x" ;
948- OS.write_hex (Value);
949- OS << " */" ;
950- }
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 ) {
960- OS << " /* 0x" ;
961- OS.write_hex (Value);
962- OS << " */" ;
963- }
964- OS << " ,\n " ;
935+ OS << Indent << " MCD::OPC_SoftFail, " ;
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+
942+ // Decode the negative mask.
943+ uint64_t NegativeMask = decodeULEB128 (&*I, nullptr , &*E, &ErrMsg);
944+ assert (ErrMsg == nullptr && " ULEB128 value too large!" );
945+ emitULEB128 (I, OS);
946+ OS << " // +ve mask: 0x" ;
947+ OS.write_hex (PositiveMask);
948+ OS << " , -ve mask: 0x" ;
949+ OS.write_hex (NegativeMask);
950+ OS << ' \n ' ;
965951 break ;
966952 }
967953 case MCD::OPC_Fail: {
0 commit comments