@@ -2283,10 +2283,8 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
2283
2283
}
2284
2284
case MCD::OPC_CheckField: {
2285
2285
// Decode the start value.
2286
- unsigned Len;
2287
- unsigned Start = decodeULEB128(++Ptr, &Len);
2288
- Ptr += Len;
2289
- Len = *Ptr;)" ;
2286
+ unsigned Start = decodeULEB128AndInc(++Ptr);
2287
+ unsigned Len = *Ptr;)" ;
2290
2288
if (IsVarLenInst)
2291
2289
OS << " \n makeUp(insn, Start + Len);" ;
2292
2290
OS << R"(
@@ -2311,10 +2309,8 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
2311
2309
break;
2312
2310
}
2313
2311
case MCD::OPC_CheckPredicate: {
2314
- unsigned Len;
2315
2312
// Decode the Predicate Index value.
2316
- unsigned PIdx = decodeULEB128(++Ptr, &Len);
2317
- Ptr += Len;
2313
+ unsigned PIdx = decodeULEB128AndInc(++Ptr);
2318
2314
// NumToSkip is a plain 24-bit integer.
2319
2315
unsigned NumToSkip = *Ptr++;
2320
2316
NumToSkip |= (*Ptr++) << 8;
@@ -2330,18 +2326,15 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
2330
2326
break;
2331
2327
}
2332
2328
case MCD::OPC_Decode: {
2333
- unsigned Len;
2334
2329
// Decode the Opcode value.
2335
- unsigned Opc = decodeULEB128(++Ptr, &Len);
2336
- Ptr += Len;
2337
- unsigned DecodeIdx = decodeULEB128(Ptr, &Len);
2338
- Ptr += Len;
2330
+ unsigned Opc = decodeULEB128AndInc(++Ptr);
2331
+ unsigned DecodeIdx = decodeULEB128AndInc(Ptr);
2339
2332
2340
2333
MI.clear();
2341
2334
MI.setOpcode(Opc);
2342
2335
bool DecodeComplete;)" ;
2343
2336
if (IsVarLenInst) {
2344
- OS << " \n Len = InstrLenTable[Opc];\n "
2337
+ OS << " \n unsigned Len = InstrLenTable[Opc];\n "
2345
2338
<< " makeUp(insn, Len);" ;
2346
2339
}
2347
2340
OS << R"(
@@ -2354,12 +2347,9 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
2354
2347
return S;
2355
2348
}
2356
2349
case MCD::OPC_TryDecode: {
2357
- unsigned Len;
2358
2350
// Decode the Opcode value.
2359
- unsigned Opc = decodeULEB128(++Ptr, &Len);
2360
- Ptr += Len;
2361
- unsigned DecodeIdx = decodeULEB128(Ptr, &Len);
2362
- Ptr += Len;
2351
+ unsigned Opc = decodeULEB128AndInc(++Ptr);
2352
+ unsigned DecodeIdx = decodeULEB128AndInc(Ptr);
2363
2353
// NumToSkip is a plain 24-bit integer.
2364
2354
unsigned NumToSkip = *Ptr++;
2365
2355
NumToSkip |= (*Ptr++) << 8;
@@ -2391,11 +2381,8 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
2391
2381
}
2392
2382
case MCD::OPC_SoftFail: {
2393
2383
// Decode the mask values.
2394
- unsigned Len;
2395
- uint64_t PositiveMask = decodeULEB128(++Ptr, &Len);
2396
- Ptr += Len;
2397
- uint64_t NegativeMask = decodeULEB128(Ptr, &Len);
2398
- Ptr += Len;
2384
+ uint64_t PositiveMask = decodeULEB128AndInc(++Ptr);
2385
+ uint64_t NegativeMask = decodeULEB128AndInc(Ptr);
2399
2386
bool Fail = (insn & PositiveMask) != 0 || (~insn & NegativeMask) != 0;
2400
2387
if (Fail)
2401
2388
S = MCDisassembler::SoftFail;
0 commit comments