disas/riscv: Use rv_codec_illegal for pseudos
The codec is never used, since we arrive into pseudos from a decoding of another opcode. Assert that rv_codec_illegal is never decoded. Use rv_codec_none for rv_op_illegal. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260812223142.349142-33-richard.henderson@linaro.org> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Richard Henderson committed
Aug 12, 2026 at 15:31 UTC
73a0f25feba58f356ba65d5b888b60744331f62a
1 file changed
+34
-34
disas/riscv.c
+34
-34
@@ -1599,7 +1599,7 @@ static uint32_t operand_lpl(rv_inst inst)
1599
/* instruction metadata */
1600
1601
static const rv_opcode_data rvi_opcode_data[] = {
1602
- { "illegal", rv_codec_illegal, rv_fmt_none },
1602
+ { "illegal", rv_codec_none, rv_fmt_none },
1603
{ "lui", rv_codec_u, rv_fmt_rd_uimm },
1604
{ "auipc", rv_codec_u, rv_fmt_rd_uoffset },
1605
{ "jal", rv_codec_uj, rv_fmt_rd_offset, rvcp_jal },
@@ -1872,38 +1872,38 @@ static const rv_opcode_data rvi_opcode_data[] = {
1872
{ "c.sq", rv_codec_cs_sq, NULL, DECOMP(rv_op_sq) },
1873
{ "c.lqsp", rv_codec_ci_lqsp, NULL, DECOMP(rv_op_lq) },
1874
{ "c.sqsp", rv_codec_css_sqsp, NULL, DECOMP(rv_op_sq) },
1875
- { "nop", rv_codec_i, rv_fmt_none },
1876
- { "mv", rv_codec_i, rv_fmt_rd_rs1, rvcp_mv },
1877
- { "not", rv_codec_i, rv_fmt_rd_rs1 },
1878
- { "neg", rv_codec_r, rv_fmt_rd_rs2 },
1879
- { "negw", rv_codec_r, rv_fmt_rd_rs2 },
1880
- { "sext.w", rv_codec_i, rv_fmt_rd_rs1 },
1881
- { "seqz", rv_codec_i, rv_fmt_rd_rs1 },
1882
- { "snez", rv_codec_r, rv_fmt_rd_rs2 },
1883
- { "sltz", rv_codec_r, rv_fmt_rd_rs1 },
1884
- { "sgtz", rv_codec_r, rv_fmt_rd_rs2 },
1885
- { "fmv.s", rv_codec_r, rv_fmt_frd_frs1 },
1886
- { "fabs.s", rv_codec_r, rv_fmt_frd_frs1 },
1887
- { "fneg.s", rv_codec_r, rv_fmt_frd_frs1 },
1888
- { "fmv.d", rv_codec_r, rv_fmt_frd_frs1 },
1889
- { "fabs.d", rv_codec_r, rv_fmt_frd_frs1 },
1890
- { "fneg.d", rv_codec_r, rv_fmt_frd_frs1 },
1891
- { "fmv.q", rv_codec_r, rv_fmt_frd_frs1 },
1892
- { "fabs.q", rv_codec_r, rv_fmt_frd_frs1 },
1893
- { "fneg.q", rv_codec_r, rv_fmt_frd_frs1 },
1894
- { "beqz", rv_codec_sb, rv_fmt_rs1_offset },
1895
- { "bnez", rv_codec_sb, rv_fmt_rs1_offset },
1896
- { "blez", rv_codec_sb, rv_fmt_rs2_offset },
1897
- { "bgez", rv_codec_sb, rv_fmt_rs1_offset },
1898
- { "bltz", rv_codec_sb, rv_fmt_rs1_offset },
1899
- { "bgtz", rv_codec_sb, rv_fmt_rs2_offset },
1900
- { "jal", rv_codec_none, rv_fmt_offset }, /* rv_op_jal_ra */
1901
- { "jalr", rv_codec_none, rv_fmt_rs1 }, /* rv_op_jalr_ra */
1875
+ { "nop", rv_codec_illegal, rv_fmt_none },
1876
+ { "mv", rv_codec_illegal, rv_fmt_rd_rs1, rvcp_mv },
1877
+ { "not", rv_codec_illegal, rv_fmt_rd_rs1 },
1878
+ { "neg", rv_codec_illegal, rv_fmt_rd_rs2 },
1879
+ { "negw", rv_codec_illegal, rv_fmt_rd_rs2 },
1880
+ { "sext.w", rv_codec_illegal, rv_fmt_rd_rs1 },
1881
+ { "seqz", rv_codec_illegal, rv_fmt_rd_rs1 },
1882
+ { "snez", rv_codec_illegal, rv_fmt_rd_rs2 },
1883
+ { "sltz", rv_codec_illegal, rv_fmt_rd_rs1 },
1884
+ { "sgtz", rv_codec_illegal, rv_fmt_rd_rs2 },
1885
+ { "fmv.s", rv_codec_illegal, rv_fmt_frd_frs1 },
1886
+ { "fabs.s", rv_codec_illegal, rv_fmt_frd_frs1 },
1887
+ { "fneg.s", rv_codec_illegal, rv_fmt_frd_frs1 },
1888
+ { "fmv.d", rv_codec_illegal, rv_fmt_frd_frs1 },
1889
+ { "fabs.d", rv_codec_illegal, rv_fmt_frd_frs1 },
1890
+ { "fneg.d", rv_codec_illegal, rv_fmt_frd_frs1 },
1891
+ { "fmv.q", rv_codec_illegal, rv_fmt_frd_frs1 },
1892
+ { "fabs.q", rv_codec_illegal, rv_fmt_frd_frs1 },
1893
+ { "fneg.q", rv_codec_illegal, rv_fmt_frd_frs1 },
1894
+ { "beqz", rv_codec_illegal, rv_fmt_rs1_offset },
1895
+ { "bnez", rv_codec_illegal, rv_fmt_rs1_offset },
1896
+ { "blez", rv_codec_illegal, rv_fmt_rs2_offset },
1897
+ { "bgez", rv_codec_illegal, rv_fmt_rs1_offset },
1898
+ { "bltz", rv_codec_illegal, rv_fmt_rs1_offset },
1899
+ { "bgtz", rv_codec_illegal, rv_fmt_rs2_offset },
1900
+ { "jal", rv_codec_illegal, rv_fmt_offset }, /* rv_op_jal_ra */
1901
+ { "jalr", rv_codec_illegal, rv_fmt_rs1 }, /* rv_op_jalr_ra */
1902
{ },
1903
{ },
1904
- { "j", rv_codec_uj, rv_fmt_offset },
1905
- { "ret", rv_codec_i, rv_fmt_none },
1906
- { "jr", rv_codec_i, rv_fmt_rs1, rvcp_jr },
1904
+ { "j", rv_codec_illegal, rv_fmt_offset },
1905
+ { "ret", rv_codec_illegal, rv_fmt_none },
1906
+ { "jr", rv_codec_illegal, rv_fmt_rs1, rvcp_jr },
1907
{ "rdcycle", rv_codec_i_csr, rv_fmt_rd },
1908
{ "rdtime", rv_codec_i_csr, rv_fmt_rd },
1909
{ "rdinstret", rv_codec_i_csr, rv_fmt_rd },
@@ -4551,8 +4551,6 @@ static void decode_inst_operands(rv_decode *dec, rv_isa isa,
4551
rv_inst inst = dec->inst;
4552
4553
switch (op->codec) {
4554
- case rv_codec_illegal:
4555
- break;
4554
case rv_codec_none:
4555
dec->rd = dec->rs1 = dec->rs2 = rv_ireg_zero;
4556
dec->imm = 0;
@@ -4946,7 +4944,9 @@ static void decode_inst_operands(rv_decode *dec, rv_isa isa,
4944
dec->rs1 = dec->rs2 = operand_crs1(inst);
4945
dec->imm = 0;
4946
break;
4949
- };
4947
+ default:
4948
+ g_assert_not_reached();
4949
+ }
4950
}
4951
4952
/* check constraint */