@@ -228,7 +228,6 @@ struct DecoderTableInfo {
228
228
DecoderSet Decoders;
229
229
bool HasCheckPredicate;
230
230
bool HasSoftFail;
231
- bool HasTryDecode;
232
231
233
232
void insertPredicate (StringRef Predicate) {
234
233
Predicates.insert (CachedHashString (Predicate));
@@ -624,7 +623,6 @@ static StringRef getDecoderOpName(DecoderOps Op) {
624
623
CASE (OPC_CheckField);
625
624
CASE (OPC_CheckPredicate);
626
625
CASE (OPC_Decode);
627
- CASE (OPC_TryDecode);
628
626
CASE (OPC_SoftFail);
629
627
}
630
628
#undef CASE
@@ -792,8 +790,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS,
792
790
OS << " if !checkPredicate(" << PIdx << " ) pop scope" ;
793
791
break ;
794
792
}
795
- case OPC_Decode:
796
- case OPC_TryDecode: {
793
+ case OPC_Decode: {
797
794
// Decode the Opcode value.
798
795
unsigned Opc = DecodeAndEmitULEB128 (I, OS);
799
796
@@ -1164,22 +1161,10 @@ void DecoderTableBuilder::emitSingletonTableEntry(
1164
1161
TableInfo.insertDecoder (Decoder);
1165
1162
unsigned DecoderIndex = TableInfo.getDecoderIndex (Decoder);
1166
1163
1167
- // Produce OPC_Decode or OPC_TryDecode opcode based on the information
1168
- // whether the instruction decoder is complete or not. If it is complete
1169
- // then it handles all possible values of remaining variable/unfiltered bits
1170
- // and for any value can determine if the bitpattern is a valid instruction
1171
- // or not. This means OPC_Decode will be the final step in the decoding
1172
- // process. If it is not complete, then the Fail return code from the
1173
- // decoder method indicates that additional processing should be done to see
1174
- // if there is any other instruction that also matches the bitpattern and
1175
- // can decode it.
1176
- const DecoderOps DecoderOp =
1177
- Encoding.hasCompleteDecoder () ? OPC_Decode : OPC_TryDecode;
1178
- TableInfo.Table .insertOpcode (DecoderOp);
1164
+ TableInfo.Table .insertOpcode (MCD::OPC_Decode);
1179
1165
const Record *InstDef = Encodings[EncodingID].getInstruction ()->TheDef ;
1180
1166
TableInfo.Table .insertULEB128 (Target.getInstrIntValue (InstDef));
1181
1167
TableInfo.Table .insertULEB128 (DecoderIndex);
1182
- TableInfo.HasTryDecode |= DecoderOp == OPC_TryDecode;
1183
1168
}
1184
1169
1185
1170
std::unique_ptr<Filter>
@@ -1689,48 +1674,28 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
1689
1674
<< " makeUp(insn, Len);" ;
1690
1675
}
1691
1676
OS << R"(
1692
- S = decodeToMCInst(DecodeIdx, S, insn, MI, Address, DisAsm, DecodeComplete);
1693
- assert(DecodeComplete);
1694
-
1677
+ S = decodeToMCInst(DecodeIdx, S, insn, MI, Address, DisAsm,
1678
+ DecodeComplete);
1695
1679
LLVM_DEBUG(dbgs() << Loc << ": OPC_Decode: opcode " << Opc
1696
- << ", using decoder " << DecodeIdx << ": "
1697
- << (S != MCDisassembler::Fail ? "PASS\n" : "FAIL\n"));
1698
- return S;
1699
- })" ;
1700
- if (TableInfo.HasTryDecode ) {
1701
- OS << R"(
1702
- case OPC_TryDecode: {
1703
- // Decode the Opcode value.
1704
- unsigned Opc = decodeULEB128AndIncUnsafe(Ptr);
1705
- unsigned DecodeIdx = decodeULEB128AndIncUnsafe(Ptr);
1706
-
1707
- // Perform the decode operation.
1708
- MCInst TmpMI;
1709
- TmpMI.setOpcode(Opc);
1710
- bool DecodeComplete;
1711
- S = decodeToMCInst(DecodeIdx, S, insn, TmpMI, Address, DisAsm, DecodeComplete);
1712
- LLVM_DEBUG(dbgs() << Loc << ": OPC_TryDecode: opcode " << Opc
1713
- << ", using decoder " << DecodeIdx << ": ");
1680
+ << ", using decoder " << DecodeIdx << ": "
1681
+ << (S ? "PASS, " : "FAIL, "));
1714
1682
1715
1683
if (DecodeComplete) {
1716
- // Decoding complete.
1717
- LLVM_DEBUG(dbgs() << (S != MCDisassembler::Fail ? "PASS\n" : "FAIL\n"));
1718
- MI = TmpMI;
1684
+ LLVM_DEBUG(dbgs() << "decoding complete\n");
1719
1685
return S;
1720
1686
}
1721
1687
assert(S == MCDisassembler::Fail);
1722
1688
if (ScopeStack.empty()) {
1723
- LLVM_DEBUG(dbgs() << "FAIL, returning FAIL \n");
1689
+ LLVM_DEBUG(dbgs() << "returning Fail \n");
1724
1690
return MCDisassembler::Fail;
1725
1691
}
1726
1692
Ptr = ScopeStack.pop_back_val();
1727
- LLVM_DEBUG(dbgs() << "FAIL, continuing at " << Ptr - DecodeTable << '\n');
1693
+ LLVM_DEBUG(dbgs() << "continuing at " << Ptr - DecodeTable << '\n');
1728
1694
// Reset decode status. This also drops a SoftFail status that could be
1729
1695
// set before the decode attempt.
1730
1696
S = MCDisassembler::Success;
1731
1697
break;
1732
1698
})" ;
1733
- }
1734
1699
if (TableInfo.HasSoftFail ) {
1735
1700
OS << R"(
1736
1701
case OPC_SoftFail: {
0 commit comments