summaryrefslogtreecommitdiff
path: root/opcodes/arc-opc.c
diff options
context:
space:
mode:
authorGraham Markall <graham.markall@embecosm.com>2016-09-29 19:25:25 +0100
committerGraham Markall <graham.markall@embecosm.com>2016-11-03 17:14:37 +0000
commit06fe285fd293e999481ec8f5c619658aa5e3b48b (patch)
tree14ea247fc401bb535b89c9f226cd7beeb6a25f25 /opcodes/arc-opc.c
parent91fdca6f26cf33573364b5bd313ed4bed6a547cc (diff)
downloadbinutils-gdb-06fe285fd293e999481ec8f5c619658aa5e3b48b.tar.gz
arc: Replace ARC_SHORT macro with arc_opcode_len function
In preparation for moving to a world where arc instructions can be 2, 4, 6, or 8 bytes in length, replace the ARC_SHORT macro (which is either true of false) with an arc_opcode_len function that returns a length in bytes. There should be no functional change after this commit. gas/ChangeLog: * config/tc-arc.c (assemble_insn): Replace use of ARC_SHORT with arc_opcode_len. include/ChangeLog: * opcode/arc.h (arc_opcode_len): Declare. (ARC_SHORT): Delete. opcodes/ChangeLog: * arc-dis.c (find_format_from_table): Replace use of ARC_SHORT with arc_opcode_len. (find_format_long_instructions): Likewise. * arc-opc.c (arc_opcode_len): New function.
Diffstat (limited to 'opcodes/arc-opc.c')
-rw-r--r--opcodes/arc-opc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/opcodes/arc-opc.c b/opcodes/arc-opc.c
index 65373104687..9eb58d3f639 100644
--- a/opcodes/arc-opc.c
+++ b/opcodes/arc-opc.c
@@ -2648,3 +2648,13 @@ const struct arc_long_opcode arc_long_opcodes[] =
};
const unsigned arc_num_long_opcodes = ARRAY_SIZE (arc_long_opcodes);
+
+/* Return length of instruction represented by OPCODE in bytes. */
+
+int
+arc_opcode_len (const struct arc_opcode *opcode)
+{
+ if (opcode->mask < 0x10000ull)
+ return 2;
+ return 4;
+}