@@ -748,23 +748,20 @@ DecodeStatus RISCVDisassembler::getInstruction16(MCInst &MI, uint64_t &Size,
748748
749749 uint32_t Insn = support::endian::read16le (Bytes.data ());
750750
751- TRY_TO_DECODE_FEATURE_ANY (XqciFeatureGroup, DecoderTableXqci16,
752- " Qualcomm uC 16bit" );
753- TRY_TO_DECODE_FEATURE (
754- RISCV::FeatureVendorXqccmp, DecoderTableXqccmp16,
755- " Xqccmp (Qualcomm 16-bit Push/Pop & Double Move Instructions)" );
756- TRY_TO_DECODE_AND_ADD_SP (STI.hasFeature (RISCV::FeatureVendorXwchc),
757- DecoderTableXwchc16, " WCH QingKe XW" );
758-
759- // DecoderTableZicfiss16 must be checked before DecoderTable16.
760- TRY_TO_DECODE (true , DecoderTableZicfiss16, " RVZicfiss (Shadow Stack)" );
761- TRY_TO_DECODE_AND_ADD_SP (true , DecoderTable16,
762- " RISCV_C (16-bit Instruction)" );
763- TRY_TO_DECODE_AND_ADD_SP (true , DecoderTableRISCV32Only_16,
764- " RISCV32Only_16 (16-bit Instruction)" );
765- // Zc* instructions incompatible with Zcf or Zcd.
766- TRY_TO_DECODE_AND_ADD_SP (true , DecoderTableZcOverlap16,
767- " ZcOverlap (16-bit Instructions overlapping with Zcf/Zcd)" );
751+ for (const DecoderListEntry &Entry : DecoderList16) {
752+ if (!Entry.haveContainedFeatures (STI.getFeatureBits ()))
753+ continue ;
754+
755+ LLVM_DEBUG (dbgs () << " Trying " << Entry.Desc << " table:\n " );
756+ DecodeStatus Result =
757+ decodeInstruction (Entry.Table , MI, Insn, Address, this , STI);
758+ if (Result == MCDisassembler::Fail)
759+ continue ;
760+
761+ addSPOperands (MI);
762+
763+ return Result;
764+ }
768765
769766 return MCDisassembler::Fail;
770767}
0 commit comments