summaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@nildram.co.uk>2011-06-29 20:42:47 +0000
committerRichard Sandiford <rsandifo@nildram.co.uk>2011-06-29 20:42:47 +0000
commit6f3f1b51b0861ff10eba0f244c3fb2e032146f78 (patch)
tree8c3a4611202f1089f124c45edfd19e7806332ee3 /gas
parent89f454582d5e7429f543acde7d7469070b4334a0 (diff)
downloadbinutils-redhat-6f3f1b51b0861ff10eba0f244c3fb2e032146f78.tar.gz
gas/
* config/tc-mips.c (find_altered_mips16_opcode): New function. (append_insn): Use it. opcodes/ * mips16-opc.c (jalrc, jrc): Move earlier in file.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-mips.c19
2 files changed, 24 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index a2ddcda3d2..40f56222fd 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
2011-06-29 Richard Sandiford <rdsandiford@googlemail.com>
+ * config/tc-mips.c (find_altered_mips16_opcode): New function.
+ (append_insn): Use it.
+
+2011-06-29 Richard Sandiford <rdsandiford@googlemail.com>
+
* config/tc-mips.c (insn_uses_reg): Delete.
(gpr_read_mask, gpr_write_mask): New functions.
(fpr_read_mask, fpr_write_mask): Likewise.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 345d6d0df4..d8da3d7380 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -3073,6 +3073,24 @@ fix_loongson2f (struct mips_cl_insn * ip)
fix_loongson2f_jump (ip);
}
+/* IP is a MIPS16 instruction whose opcode we have just changed.
+ Point IP->insn_mo to the new opcode's definition. */
+
+static void
+find_altered_mips16_opcode (struct mips_cl_insn *ip)
+{
+ const struct mips_opcode *mo, *end;
+
+ end = &mips16_opcodes[bfd_mips16_num_opcodes];
+ for (mo = ip->insn_mo; mo < end; mo++)
+ if ((ip->insn_opcode & mo->mask) == mo->match)
+ {
+ ip->insn_mo = mo;
+ return;
+ }
+ abort ();
+}
+
/* Output an instruction. IP is the instruction information.
ADDRESS_EXPR is an operand of the instruction to be used with
RELOC_TYPE. */
@@ -3545,6 +3563,7 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
{
/* Convert MIPS16 jr/jalr into a "compact" jump. */
ip->insn_opcode |= 0x0080;
+ find_altered_mips16_opcode (ip);
install_insn (ip);
insert_into_history (0, 1, ip);
}