@@ -1548,7 +1548,7 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
15481548 ScopeStack.push_back(SkipTo);
15491549 LLVM_DEBUG(dbgs() << Loc << ": OPC_Scope(" << SkipTo - DecodeTable
15501550 << ")\n");
1551- break ;
1551+ continue ;
15521552 }
15531553 case OPC_ExtractField: {
15541554 // Decode the start value.
@@ -1560,7 +1560,7 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
15601560 CurFieldValue = fieldFromInstruction(insn, Start, Len);
15611561 LLVM_DEBUG(dbgs() << Loc << ": OPC_ExtractField(" << Start << ", "
15621562 << Len << "): " << CurFieldValue << "\n");
1563- break ;
1563+ continue ;
15641564 }
15651565 case OPC_FilterValueOrSkip: {
15661566 // Decode the field value.
@@ -1572,12 +1572,11 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
15721572 LLVM_DEBUG(dbgs() << Loc << ": OPC_FilterValueOrSkip(" << Val << ", "
15731573 << SkipTo - DecodeTable << ") "
15741574 << (Failed ? "FAIL, " : "PASS\n"));
1575-
1576- if (Failed) {
1577- Ptr = SkipTo;
1578- LLVM_DEBUG(dbgs() << "continuing at " << Ptr - DecodeTable << '\n');
1579- }
1580- break;
1575+ if (!Failed)
1576+ continue;
1577+ Ptr = SkipTo;
1578+ LLVM_DEBUG(dbgs() << "continuing at " << Ptr - DecodeTable << '\n');
1579+ continue;
15811580 }
15821581 case OPC_FilterValue: {
15831582 // Decode the field value.
@@ -1586,15 +1585,8 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
15861585
15871586 LLVM_DEBUG(dbgs() << Loc << ": OPC_FilterValue(" << Val << ") "
15881587 << (Failed ? "FAIL, " : "PASS\n"));
1589-
1590- if (Failed) {
1591- if (ScopeStack.empty()) {
1592- LLVM_DEBUG(dbgs() << "returning Fail\n");
1593- return MCDisassembler::Fail;
1594- }
1595- Ptr = ScopeStack.pop_back_val();
1596- LLVM_DEBUG(dbgs() << "continuing at " << Ptr - DecodeTable << '\n');
1597- }
1588+ if (!Failed)
1589+ continue;
15981590 break;
15991591 }
16001592 case OPC_CheckField: {
@@ -1615,14 +1607,8 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
16151607 << ", " << ExpectedValue << "): FieldValue = "
16161608 << FieldValue << ", ExpectedValue = " << ExpectedValue
16171609 << ": " << (Failed ? "FAIL, " : "PASS\n"););
1618- if (Failed) {
1619- if (ScopeStack.empty()) {
1620- LLVM_DEBUG(dbgs() << "returning Fail\n");
1621- return MCDisassembler::Fail;
1622- }
1623- Ptr = ScopeStack.pop_back_val();
1624- LLVM_DEBUG(dbgs() << "continuing at " << Ptr - DecodeTable << '\n');
1625- }
1610+ if (!Failed)
1611+ continue;
16261612 break;
16271613 })" ;
16281614 if (TableInfo.HasCheckPredicate ) {
@@ -1635,15 +1621,8 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
16351621
16361622 LLVM_DEBUG(dbgs() << Loc << ": OPC_CheckPredicate(" << PIdx << "): "
16371623 << (Failed ? "FAIL, " : "PASS\n"););
1638-
1639- if (Failed) {
1640- if (ScopeStack.empty()) {
1641- LLVM_DEBUG(dbgs() << "returning Fail\n");
1642- return MCDisassembler::Fail;
1643- }
1644- Ptr = ScopeStack.pop_back_val();
1645- LLVM_DEBUG(dbgs() << "continuing at " << Ptr - DecodeTable << '\n');
1646- }
1624+ if (!Failed)
1625+ continue;
16471626 break;
16481627 })" ;
16491628 }
@@ -1672,12 +1651,6 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
16721651 return S;
16731652 }
16741653 assert(S == MCDisassembler::Fail);
1675- if (ScopeStack.empty()) {
1676- LLVM_DEBUG(dbgs() << "returning Fail\n");
1677- return MCDisassembler::Fail;
1678- }
1679- Ptr = ScopeStack.pop_back_val();
1680- LLVM_DEBUG(dbgs() << "continuing at " << Ptr - DecodeTable << '\n');
16811654 // Reset decode status. This also drops a SoftFail status that could be
16821655 // set before the decode attempt.
16831656 S = MCDisassembler::Success;
@@ -1693,11 +1666,17 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
16931666 if (Failed)
16941667 S = MCDisassembler::SoftFail;
16951668 LLVM_DEBUG(dbgs() << Loc << ": OPC_SoftFail: " << (Failed ? "FAIL\n" : "PASS\n"));
1696- break ;
1669+ continue ;
16971670 })" ;
16981671 }
16991672 OS << R"(
17001673 }
1674+ if (ScopeStack.empty()) {
1675+ LLVM_DEBUG(dbgs() << "returning Fail\n");
1676+ return MCDisassembler::Fail;
1677+ }
1678+ Ptr = ScopeStack.pop_back_val();
1679+ LLVM_DEBUG(dbgs() << "continuing at " << Ptr - DecodeTable << '\n');
17011680 }
17021681 llvm_unreachable("bogosity detected in disassembler state machine!");
17031682}
0 commit comments