summaryrefslogtreecommitdiff
path: root/opcodes/mips-formats.h
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@nildram.co.uk>2013-08-19 18:56:59 +0000
committerRichard Sandiford <rsandifo@nildram.co.uk>2013-08-19 18:56:59 +0000
commitbec029bce1bf374e05b16b6ba4714d5dba1633a4 (patch)
treea003046d538e88bcd095ce386572580fec869922 /opcodes/mips-formats.h
parentac0f0fea863a323ae0f6ef70996a0cedaf4b0220 (diff)
downloadbinutils-redhat-bec029bce1bf374e05b16b6ba4714d5dba1633a4.tar.gz
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.
Diffstat (limited to 'opcodes/mips-formats.h')
-rw-r--r--opcodes/mips-formats.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/opcodes/mips-formats.h b/opcodes/mips-formats.h
index 49a0623da5..4b5aaaf31a 100644
--- a/opcodes/mips-formats.h
+++ b/opcodes/mips-formats.h
@@ -69,6 +69,14 @@
return &op.root; \
}
+#define OPTIONAL_REG(SIZE, LSB, BANK) \
+ { \
+ static const struct mips_reg_operand op = { \
+ { OP_OPTIONAL_REG, SIZE, LSB }, OP_REG_##BANK, 0 \
+ }; \
+ return &op.root; \
+ }
+
#define MAPPED_REG(SIZE, LSB, BANK, MAP) \
{ \
typedef char ATTRIBUTE_UNUSED \
@@ -79,6 +87,16 @@
return &op.root; \
}
+#define OPTIONAL_MAPPED_REG(SIZE, LSB, BANK, MAP) \
+ { \
+ typedef char ATTRIBUTE_UNUSED \
+ static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
+ static const struct mips_reg_operand op = { \
+ { OP_OPTIONAL_REG, SIZE, LSB }, OP_REG_##BANK, MAP \
+ }; \
+ return &op.root; \
+ }
+
#define REG_PAIR(SIZE, LSB, BANK, MAP) \
{ \
typedef char ATTRIBUTE_UNUSED \