Skip to content

Commit 8d27b09

Browse files
committed
RISC-V: move comment describing rules for riscv_opcodes[]
It makes little sense to have this comment meanwhile over a hundred lines ahead of the array. In fact until spotting the comment, I was wondering why those pretty important aspects aren't spelled out anywhere.
1 parent 2f98b09 commit 8d27b09

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

opcodes/riscv-opc.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,6 @@ const float riscv_fli_numval[32] =
131131
0x1p+3, 0x1p+4, 0x1p+7, 0x1p+8, 0x1p+15, 0x1p+16, 0x0p+0, 0x0p+0
132132
};
133133

134-
/* The order of overloaded instructions matters. Label arguments and
135-
register arguments look the same. Instructions that can have either
136-
for arguments must apear in the correct order in this table for the
137-
assembler to pick the right one. In other words, entries with
138-
immediate operands must apear after the same instruction with
139-
registers.
140-
141-
Because of the lookup algorithm used, entries with the same opcode
142-
name must be contiguous. */
143-
144134
#define MASK_RS1 (OP_MASK_RS1 << OP_SH_RS1)
145135
#define MASK_RS2 (OP_MASK_RS2 << OP_SH_RS2)
146136
#define MASK_RD (OP_MASK_RD << OP_SH_RD)
@@ -329,6 +319,16 @@ match_th_load_pair(const struct riscv_opcode *op,
329319
return rd1 != rd2 && rd1 != rs && rd2 != rs && match_opcode (op, insn);
330320
}
331321

322+
/* The order of overloaded instructions matters. Label arguments and
323+
register arguments look the same. Instructions that can have either
324+
for arguments must apear in the correct order in this table for the
325+
assembler to pick the right one. In other words, entries with
326+
immediate operands must apear after the same instruction with
327+
registers.
328+
329+
Because of the lookup algorithm used, entries with the same opcode
330+
name must be contiguous. */
331+
332332
const struct riscv_opcode riscv_opcodes[] =
333333
{
334334
/* name, xlen, isa, operands, match, mask, match_func, pinfo. */

0 commit comments

Comments
 (0)