aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-mips.c
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2011-06-29 20:42:48 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2011-06-29 20:42:48 +0000
commitceb94aa50d68ec7393fac7e2b239aff8ec656f85 (patch)
treea7a6d2fba69b070303f5ee57ab319e87c4ff174d /gas/config/tc-mips.c
parent4c26037942d435934e3523a6979bff47cae4ef81 (diff)
downloadgdb-ceb94aa50d68ec7393fac7e2b239aff8ec656f85.zip
gdb-ceb94aa50d68ec7393fac7e2b239aff8ec656f85.tar.gz
gdb-ceb94aa50d68ec7393fac7e2b239aff8ec656f85.tar.bz2
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/config/tc-mips.c')
-rw-r--r--gas/config/tc-mips.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 345d6d0..d8da3d7 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);
}