Skip to content

Commit 5846381

Browse files
committed
[RISCV] Move definitions of decodeZcmpRlist/decodeXqccmpRlistS0 to their declarations. NFC
These don't need anything from RISCVDisassemblerTables.inc so we can define them earlier.
1 parent 2762a07 commit 5846381

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -534,15 +534,25 @@ static DecodeStatus decodeRTZArg(MCInst &Inst, uint32_t Imm, int64_t Address,
534534
return MCDisassembler::Success;
535535
}
536536

537-
static DecodeStatus decodeXTHeadMemPair(MCInst &Inst, uint32_t Insn,
538-
uint64_t Address,
539-
const MCDisassembler *Decoder);
540-
541537
static DecodeStatus decodeZcmpRlist(MCInst &Inst, uint32_t Imm,
542538
uint64_t Address,
543-
const MCDisassembler *Decoder);
539+
const MCDisassembler *Decoder) {
540+
bool IsRVE = Decoder->getSubtargetInfo().hasFeature(RISCV::FeatureStdExtE);
541+
if (Imm < RISCVZC::RA || (IsRVE && Imm >= RISCVZC::RA_S0_S2))
542+
return MCDisassembler::Fail;
543+
Inst.addOperand(MCOperand::createImm(Imm));
544+
return MCDisassembler::Success;
545+
}
544546

545547
static DecodeStatus decodeXqccmpRlistS0(MCInst &Inst, uint32_t Imm,
548+
uint64_t Address,
549+
const MCDisassembler *Decoder) {
550+
if (Imm < RISCVZC::RA_S0)
551+
return MCDisassembler::Fail;
552+
return decodeZcmpRlist(Inst, Imm, Address, Decoder);
553+
}
554+
555+
static DecodeStatus decodeXTHeadMemPair(MCInst &Inst, uint32_t Insn,
546556
uint64_t Address,
547557
const MCDisassembler *Decoder);
548558

@@ -592,24 +602,6 @@ static DecodeStatus decodeXTHeadMemPair(MCInst &Inst, uint32_t Insn,
592602
return S;
593603
}
594604

595-
static DecodeStatus decodeZcmpRlist(MCInst &Inst, uint32_t Imm,
596-
uint64_t Address,
597-
const MCDisassembler *Decoder) {
598-
bool IsRVE = Decoder->getSubtargetInfo().hasFeature(RISCV::FeatureStdExtE);
599-
if (Imm < RISCVZC::RA || (IsRVE && Imm >= RISCVZC::RA_S0_S2))
600-
return MCDisassembler::Fail;
601-
Inst.addOperand(MCOperand::createImm(Imm));
602-
return MCDisassembler::Success;
603-
}
604-
605-
static DecodeStatus decodeXqccmpRlistS0(MCInst &Inst, uint32_t Imm,
606-
uint64_t Address,
607-
const MCDisassembler *Decoder) {
608-
if (Imm < RISCVZC::RA_S0)
609-
return MCDisassembler::Fail;
610-
return decodeZcmpRlist(Inst, Imm, Address, Decoder);
611-
}
612-
613605
// Add implied SP operand for C.*SP compressed instructions. The SP operand
614606
// isn't explicitly encoded in the instruction.
615607
void RISCVDisassembler::addSPOperands(MCInst &MI) const {

0 commit comments

Comments
 (0)