@@ -523,13 +523,13 @@ static DecodeStatus decodeCSSPushPopchk(MCInst &Inst, uint32_t Insn,
523
523
static DecodeStatus decodeRVCInstrRdRs1ImmZero (MCInst &Inst, uint32_t Insn,
524
524
uint64_t Address,
525
525
const MCDisassembler *Decoder) {
526
+ DecodeStatus S = MCDisassembler::Success;
526
527
uint32_t Rd = fieldFromInstruction (Insn, 7 , 5 );
527
- [[maybe_unused]] DecodeStatus Result =
528
- DecodeGPRNoX0RegisterClass (Inst, Rd, Address, Decoder);
529
- assert (Result == MCDisassembler::Success && " Invalid register" );
528
+ if (!Check (S, DecodeGPRNoX0RegisterClass (Inst, Rd, Address, Decoder)))
529
+ return MCDisassembler::Fail;
530
530
Inst.addOperand (Inst.getOperand (0 ));
531
531
Inst.addOperand (MCOperand::createImm (0 ));
532
- return MCDisassembler::Success ;
532
+ return S ;
533
533
}
534
534
535
535
static DecodeStatus decodeCSSPushPopchk (MCInst &Inst, uint32_t Insn,
@@ -569,34 +569,44 @@ decodeRVCInstrRdRs1UImmLog2XLenNonZero(MCInst &Inst, uint32_t Insn,
569
569
static DecodeStatus decodeRVCInstrRdRs2 (MCInst &Inst, uint32_t Insn,
570
570
uint64_t Address,
571
571
const MCDisassembler *Decoder) {
572
+ DecodeStatus S = MCDisassembler::Success;
572
573
uint32_t Rd = fieldFromInstruction (Insn, 7 , 5 );
573
574
uint32_t Rs2 = fieldFromInstruction (Insn, 2 , 5 );
574
- DecodeGPRRegisterClass (Inst, Rd, Address, Decoder);
575
- DecodeGPRRegisterClass (Inst, Rs2, Address, Decoder);
576
- return MCDisassembler::Success;
575
+ if (!Check (S, DecodeGPRRegisterClass (Inst, Rd, Address, Decoder)))
576
+ return MCDisassembler::Fail;
577
+ if (!Check (S, DecodeGPRRegisterClass (Inst, Rs2, Address, Decoder)))
578
+ return MCDisassembler::Fail;
579
+ return S;
577
580
}
578
581
579
582
static DecodeStatus decodeRVCInstrRdRs1Rs2 (MCInst &Inst, uint32_t Insn,
580
583
uint64_t Address,
581
584
const MCDisassembler *Decoder) {
585
+ DecodeStatus S = MCDisassembler::Success;
582
586
uint32_t Rd = fieldFromInstruction (Insn, 7 , 5 );
583
587
uint32_t Rs2 = fieldFromInstruction (Insn, 2 , 5 );
584
- DecodeGPRRegisterClass (Inst, Rd, Address, Decoder);
588
+ if (!Check (S, DecodeGPRRegisterClass (Inst, Rd, Address, Decoder)))
589
+ return MCDisassembler::Fail;
585
590
Inst.addOperand (Inst.getOperand (0 ));
586
- DecodeGPRRegisterClass (Inst, Rs2, Address, Decoder);
587
- return MCDisassembler::Success;
591
+ if (!Check (S, DecodeGPRRegisterClass (Inst, Rs2, Address, Decoder)))
592
+ return MCDisassembler::Fail;
593
+ return S;
588
594
}
589
595
590
596
static DecodeStatus decodeXTHeadMemPair (MCInst &Inst, uint32_t Insn,
591
597
uint64_t Address,
592
598
const MCDisassembler *Decoder) {
599
+ DecodeStatus S = MCDisassembler::Success;
593
600
uint32_t Rd1 = fieldFromInstruction (Insn, 7 , 5 );
594
601
uint32_t Rs1 = fieldFromInstruction (Insn, 15 , 5 );
595
602
uint32_t Rd2 = fieldFromInstruction (Insn, 20 , 5 );
596
603
uint32_t UImm2 = fieldFromInstruction (Insn, 25 , 2 );
597
- DecodeGPRRegisterClass (Inst, Rd1, Address, Decoder);
598
- DecodeGPRRegisterClass (Inst, Rd2, Address, Decoder);
599
- DecodeGPRRegisterClass (Inst, Rs1, Address, Decoder);
604
+ if (!Check (S, DecodeGPRRegisterClass (Inst, Rd1, Address, Decoder)))
605
+ return MCDisassembler::Fail;
606
+ if (!Check (S, DecodeGPRRegisterClass (Inst, Rd2, Address, Decoder)))
607
+ return MCDisassembler::Fail;
608
+ if (!Check (S, DecodeGPRRegisterClass (Inst, Rs1, Address, Decoder)))
609
+ return MCDisassembler::Fail;
600
610
[[maybe_unused]] DecodeStatus Result =
601
611
decodeUImmOperand<2 >(Inst, UImm2, Address, Decoder);
602
612
assert (Result == MCDisassembler::Success && " Invalid immediate" );
@@ -610,7 +620,7 @@ static DecodeStatus decodeXTHeadMemPair(MCInst &Inst, uint32_t Insn,
610
620
else
611
621
Inst.addOperand (MCOperand::createImm (4 ));
612
622
613
- return MCDisassembler::Success ;
623
+ return S ;
614
624
}
615
625
616
626
static DecodeStatus decodeZcmpRlist (MCInst &Inst, uint32_t Imm,
0 commit comments