OSDN Git Service

* config/tc-mips.c (append_insn): Correctly handle mips16 case
authorDavid Ung <davidu@mips.com>
Thu, 1 Sep 2005 16:35:41 +0000 (16:35 +0000)
committerDavid Ung <davidu@mips.com>
Thu, 1 Sep 2005 16:35:41 +0000 (16:35 +0000)
when the frags are different for the 2 instructions we want to
swap.  If the lengths of the 2 instructions are not the same, we
won't do the swap but emit an nop.

gas/ChangeLog
gas/config/tc-mips.c

index 8c54b20..56d99c1 100644 (file)
@@ -1,3 +1,10 @@
+2005-09-01  David Ung  <davidu@mips.com>
+
+       * config/tc-mips.c (append_insn): Correctly handle mips16 case
+       when the frags are different for the 2 instructions we want to
+       swap.  If the lengths of the 2 instructions are not the same, we
+       won't do the swap but emit an nop.
+
 2005-09-01  Dmitry Diky  <diwil@spec.ru>
 
        * config/tc-msp430.c (msp430_operands): Emit dwarf2_emit_insn()
index 37d2613..a2879b1 100644 (file)
@@ -2698,9 +2698,22 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
              struct mips_cl_insn delay = history[0];
              if (mips_opts.mips16)
                {
-                 know (delay.frag == ip->frag);
-                 move_insn (ip, delay.frag, delay.where);
-                 move_insn (&delay, ip->frag, ip->where + insn_length (ip));
+                 if (delay.frag == ip->frag)
+                   {
+                     move_insn (ip, delay.frag, delay.where);
+                     move_insn (&delay, ip->frag, delay.where 
+                                + insn_length (ip));
+                   }
+                 else if (insn_length (ip) == insn_length (&delay))
+                   {
+                     move_insn (&delay, ip->frag, ip->where);
+                     move_insn (ip, history[0].frag, history[0].where);
+                   }
+                 else
+                   {
+                     add_fixed_insn (NOP_INSN);
+                     delay = *NOP_INSN;
+                   }
                }
              else if (relaxed_branch)
                {