public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Increment size of relax sequence if we emit a nop
@ 2004-12-09 15:51 Ian Lance Taylor
  2004-12-09 16:38 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Lance Taylor @ 2004-12-09 15:51 UTC (permalink / raw)
  To: binutils

While experimenting with some code that I didn't check in, I noticed a
minor issue.  If we insert a nop while processing a relax sequence, we
weren't accounting for the size of the inserted nop.  This led to
confusing errors later on.  This patch should be harmless for existing
relaxation sequences, but may make future ones a little easier to
handle.  I'm about to commit it.

Ian


2004-12-09  Ian Lance Taylor  <ian@wasabisystems.com>

	* config/tc-mips.c (append_insn): If we emit a nop during a relax
	sequence, increase the size of the sequence.


Index: config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.275
diff -u -r1.275 tc-mips.c
--- config/tc-mips.c	9 Dec 2004 06:17:14 -0000	1.275
+++ config/tc-mips.c	9 Dec 2004 15:47:41 -0000
@@ -2542,6 +2542,8 @@
 		 instruction at the destination, put it in the delay
 		 slot, and bump the destination address.  */
 	      emit_nop ();
+	      if (mips_relax.sequence)
+		mips_relax.sizes[mips_relax.sequence - 1] += 4;
 	      /* Update the previous insn information.  */
 	      prev_prev_insn = *ip;
 	      prev_insn.insn_mo = &dummy_opcode;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Increment size of relax sequence if we emit a nop
  2004-12-09 15:51 Increment size of relax sequence if we emit a nop Ian Lance Taylor
@ 2004-12-09 16:38 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2004-12-09 16:38 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: binutils

Ian Lance Taylor <ian@wasabisystems.com> writes:
> Index: config/tc-mips.c
> ===================================================================
> RCS file: /cvs/src/src/gas/config/tc-mips.c,v
> retrieving revision 1.275
> diff -u -r1.275 tc-mips.c
> --- config/tc-mips.c	9 Dec 2004 06:17:14 -0000	1.275
> +++ config/tc-mips.c	9 Dec 2004 15:47:41 -0000
> @@ -2542,6 +2542,8 @@
>  		 instruction at the destination, put it in the delay
>  		 slot, and bump the destination address.  */
>  	      emit_nop ();
> +	      if (mips_relax.sequence)
> +		mips_relax.sizes[mips_relax.sequence - 1] += 4;
>  	      /* Update the previous insn information.  */
>  	      prev_prev_insn = *ip;
>  	      prev_insn.insn_mo = &dummy_opcode;

Wouldn't it be better to turn emit_nop() into a function and do this
check there instead?  It's the kind of thing that might be needed in
more than one place otherwise.

Richard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-09 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-09 15:51 Increment size of relax sequence if we emit a nop Ian Lance Taylor
2004-12-09 16:38 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).