From 0f35dbc4d98da6b1e251ac8148a9d20d6276012b Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 19 Aug 2013 18:57:00 +0000 Subject: include/opcode/ * mips.h (OP_OPTIONAL_REG): New mips_operand_type. (mips_optional_operand_p): New function. opcodes/ * mips-formats.h (OPTIONAL_REG, OPTIONAL_MAPPED_REG): New macros. * micromips-opc.c (decode_micromips_operand): Use OPTIONAL_REG and OPTIONAL_MAPPED_REG. * mips-opc.c (decode_mips_operand): Likewise. * mips16-opc.c (decode_mips16_operand): Likewise. * mips-dis.c (print_insn_arg): Handle OP_OPTIONAL_REG. gas/ * config/tc-mips.c (operand_reg_mask, match_operand): Handle OP_OPTIONAL_REG. (mips_ip, mips16_ip): Use mips_optional_operand_p to check for optional operands. --- include/opcode/mips.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/opcode/mips.h') diff --git a/include/opcode/mips.h b/include/opcode/mips.h index ae6983b..6860fa7 100644 --- a/include/opcode/mips.h +++ b/include/opcode/mips.h @@ -346,6 +346,10 @@ enum mips_operand_type { /* Described by mips_reg_operand. */ OP_REG, + /* Like OP_REG, but can be omitted if the register is the same as the + previous operand. */ + OP_OPTIONAL_REG, + /* Described by mips_reg_pair_operand. */ OP_REG_PAIR, @@ -574,6 +578,15 @@ struct mips_pcrel_operand unsigned int flip_isa_bit : 1; }; +/* Return true if the assembly syntax allows OPERAND to be omitted. */ + +static inline bfd_boolean +mips_optional_operand_p (const struct mips_operand *operand) +{ + return (operand->type == OP_OPTIONAL_REG + || operand->type == OP_REPEAT_PREV_REG); +} + /* Return a version of INSN in which the field specified by OPERAND has value UVAL. */ -- cgit v1.1