This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch - gas] MIPS: fix problem with mips16 delay branchoptimization.


On Tue, 2005-09-06 at 17:47 +0100, Richard Sandiford wrote:
> David Ung <davidu@mips.com> writes:
> >   else if (mips_opts.mips16
> > 	   && ! ip->use_extend
> > 	   && *reloc_type != BFD_RELOC_MIPS16_JMP)
> >     {     
> >       if ((pinfo & INSN_UNCOND_BRANCH_DELAY) == 0)
> > 	/* Make sure there is enough room to swap this instruction with
> > 	   a following jump instruction.  */
> > 	frag_grow (6);
> >       add_fixed_insn (ip);
> 
> Looks good to me, thanks.  [ And sorry again for not reading your earlier
> message properly.  It couldn't really have been clearer.  I think I somehow
> failed to read it all first time round. ;( ]
> 
> Richard
> 

ok.  Here is the new patch then.
re-ran regressions and was ok.   now commited to cvs.

David.


2005-09-07  David Ung  <davidu@mips.com>

	* config/tc-mips.c (append_insn): Undo last change.  Instead add
	guard to suppress calling frag_grow if the current instruction is
	one that allows a delay slot.

Index: config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.320
diff -c -p -b -r1.320 tc-mips.c
*** config/tc-mips.c	6 Sep 2005 18:53:02 -0000	1.320
--- config/tc-mips.c	7 Sep 2005 11:33:49 -0000
*************** append_insn (struct mips_cl_insn *ip, ex
*** 2313,2318 ****
--- 2313,2319 ----
  	   && ! ip->use_extend
  	   && *reloc_type != BFD_RELOC_MIPS16_JMP)
      {     
+       if ((pinfo & INSN_UNCOND_BRANCH_DELAY) == 0)
  	/* Make sure there is enough room to swap this instruction with
  	   a following jump instruction.  */
  	frag_grow (6);
*************** append_insn (struct mips_cl_insn *ip, ex
*** 2707,2728 ****
  	      struct mips_cl_insn delay = history[0];
  	      if (mips_opts.mips16)
  		{
! 		  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)
  		{
--- 2708,2716 ----
  	      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));
  		}
  	      else if (relaxed_branch)
  		{


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]