@@ -1548,7 +1548,7 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
1548
1548
ScopeStack.push_back(SkipTo);
1549
1549
LLVM_DEBUG(dbgs() << Loc << ": OPC_Scope(" << SkipTo - DecodeTable
1550
1550
<< ")\n");
1551
- break ;
1551
+ continue ;
1552
1552
}
1553
1553
case OPC_ExtractField: {
1554
1554
// Decode the start value.
@@ -1560,7 +1560,7 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
1560
1560
CurFieldValue = fieldFromInstruction(insn, Start, Len);
1561
1561
LLVM_DEBUG(dbgs() << Loc << ": OPC_ExtractField(" << Start << ", "
1562
1562
<< Len << "): " << CurFieldValue << "\n");
1563
- break ;
1563
+ continue ;
1564
1564
}
1565
1565
case OPC_FilterValueOrSkip: {
1566
1566
// Decode the field value.
@@ -1572,12 +1572,11 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
1572
1572
LLVM_DEBUG(dbgs() << Loc << ": OPC_FilterValueOrSkip(" << Val << ", "
1573
1573
<< SkipTo - DecodeTable << ") "
1574
1574
<< (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;
1581
1580
}
1582
1581
case OPC_FilterValue: {
1583
1582
// Decode the field value.
@@ -1586,15 +1585,8 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
1586
1585
1587
1586
LLVM_DEBUG(dbgs() << Loc << ": OPC_FilterValue(" << Val << ") "
1588
1587
<< (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;
1598
1590
break;
1599
1591
}
1600
1592
case OPC_CheckField: {
@@ -1615,14 +1607,8 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
1615
1607
<< ", " << ExpectedValue << "): FieldValue = "
1616
1608
<< FieldValue << ", ExpectedValue = " << ExpectedValue
1617
1609
<< ": " << (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;
1626
1612
break;
1627
1613
})" ;
1628
1614
if (TableInfo.HasCheckPredicate ) {
@@ -1635,15 +1621,8 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
1635
1621
1636
1622
LLVM_DEBUG(dbgs() << Loc << ": OPC_CheckPredicate(" << PIdx << "): "
1637
1623
<< (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;
1647
1626
break;
1648
1627
})" ;
1649
1628
}
@@ -1672,12 +1651,6 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
1672
1651
return S;
1673
1652
}
1674
1653
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');
1681
1654
// Reset decode status. This also drops a SoftFail status that could be
1682
1655
// set before the decode attempt.
1683
1656
S = MCDisassembler::Success;
@@ -1693,11 +1666,17 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
1693
1666
if (Failed)
1694
1667
S = MCDisassembler::SoftFail;
1695
1668
LLVM_DEBUG(dbgs() << Loc << ": OPC_SoftFail: " << (Failed ? "FAIL\n" : "PASS\n"));
1696
- break ;
1669
+ continue ;
1697
1670
})" ;
1698
1671
}
1699
1672
OS << R"(
1700
1673
}
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');
1701
1680
}
1702
1681
llvm_unreachable("bogosity detected in disassembler state machine!");
1703
1682
}
0 commit comments