@@ -228,7 +228,6 @@ struct DecoderTableInfo {
228228 DecoderSet Decoders;
229229 bool HasCheckPredicate;
230230 bool HasSoftFail;
231- bool HasTryDecode;
232231
233232 void insertPredicate (StringRef Predicate) {
234233 Predicates.insert (CachedHashString (Predicate));
@@ -624,7 +623,6 @@ static StringRef getDecoderOpName(DecoderOps Op) {
624623 CASE (OPC_CheckField);
625624 CASE (OPC_CheckPredicate);
626625 CASE (OPC_Decode);
627- CASE (OPC_TryDecode);
628626 CASE (OPC_SoftFail);
629627 }
630628#undef CASE
@@ -792,8 +790,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS,
792790 OS << " if !checkPredicate(" << PIdx << " ) pop scope" ;
793791 break ;
794792 }
795- case OPC_Decode:
796- case OPC_TryDecode: {
793+ case OPC_Decode: {
797794 // Decode the Opcode value.
798795 unsigned Opc = DecodeAndEmitULEB128 (I, OS);
799796
@@ -1164,22 +1161,10 @@ void DecoderTableBuilder::emitSingletonTableEntry(
11641161 TableInfo.insertDecoder (Decoder);
11651162 unsigned DecoderIndex = TableInfo.getDecoderIndex (Decoder);
11661163
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);
11791165 const Record *InstDef = Encodings[EncodingID].getInstruction ()->TheDef ;
11801166 TableInfo.Table .insertULEB128 (Target.getInstrIntValue (InstDef));
11811167 TableInfo.Table .insertULEB128 (DecoderIndex);
1182- TableInfo.HasTryDecode |= DecoderOp == OPC_TryDecode;
11831168}
11841169
11851170std::unique_ptr<Filter>
@@ -1689,48 +1674,28 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
16891674 << " makeUp(insn, Len);" ;
16901675 }
16911676 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);
16951679 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, "));
17141682
17151683 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");
17191685 return S;
17201686 }
17211687 assert(S == MCDisassembler::Fail);
17221688 if (ScopeStack.empty()) {
1723- LLVM_DEBUG(dbgs() << "FAIL, returning FAIL \n");
1689+ LLVM_DEBUG(dbgs() << "returning Fail \n");
17241690 return MCDisassembler::Fail;
17251691 }
17261692 Ptr = ScopeStack.pop_back_val();
1727- LLVM_DEBUG(dbgs() << "FAIL, continuing at " << Ptr - DecodeTable << '\n');
1693+ LLVM_DEBUG(dbgs() << "continuing at " << Ptr - DecodeTable << '\n');
17281694 // Reset decode status. This also drops a SoftFail status that could be
17291695 // set before the decode attempt.
17301696 S = MCDisassembler::Success;
17311697 break;
17321698 })" ;
1733- }
17341699 if (TableInfo.HasSoftFail ) {
17351700 OS << R"(
17361701 case OPC_SoftFail: {
0 commit comments