MIPS/GAS: Simplify non-MIPS16 branch swapping sequence

Simplify non-MIPS16 branch swapping by copying the MIPS16 variant, which
sets the new position for the current instruction first and reduces the
calculation of the new position of the previous instruction.  Also refer
to previous instruction's frag and position via `delay' for consistency.

Reintroduce an explanatory comment, updated, previously removed with:

commit 1e91584932
Author: Richard Sandiford <rdsandiford@googlemail.com>
Date:   Wed Mar 9 09:17:02 2005 +0000

<https://sourceware.org/ml/binutils/2005-03/msg00217.html>, ("Rework
MIPS nop-insertion code, add -mfix-vr4130 [5/11]").

	gas/
	* config/tc-mips.c (append_insn): Simplify non-MIPS16 branch
	swapping sequence.
This commit is contained in:
Maciej W. Rozycki 2016-06-30 12:46:47 +01:00
parent 93a24ba79b
commit 5e35670ba7
2 changed files with 9 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2016-06-30 Maciej W. Rozycki <macro@imgtec.com>
* config/tc-mips.c (append_insn): Simplify non-MIPS16 branch
swapping sequence.
2016-06-30 Maciej W. Rozycki <macro@imgtec.com>
PR gas/20312

View file

@ -7537,9 +7537,10 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
}
else
{
move_insn (&delay, ip->frag,
ip->where - branch_disp + insn_length (ip));
move_insn (ip, history[0].frag, history[0].where);
/* If this is not a relaxed branch and we are in the
same frag, then just swap the instructions. */
move_insn (ip, delay.frag, delay.where);
move_insn (&delay, ip->frag, ip->where + insn_length (ip));
}
history[0] = *ip;
delay.fixed_p = 1;