This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

haifa clobber dependancy fix


Reported internally against the new x86 backend, but the
code in question is already in egcs, so I've applied the
patch to both branches.


r~


----- Forwarded message from Richard Henderson <rth@cygnus.com> -----

On Sat, Jun 19, 1999 at 05:26:59PM -0700, Ulrich Drepper wrote:
>  113 0105 668B1C70              movw    (%eax,%esi,2), %bx
>  114 0109 56                    pushl   %esi
>  115 010a E8FCFFFF              call    iswalnum
>  115      FF
>  116 010f 83C404                addl    $4, %esp
>  117 0112 85C0                  testl   %eax, %eax
>  118 0114 66C1EB03              shrw    $3, %bx	 <---
>  119 0118 0F94C0                sete    %al

The problem was that the call was marked as setting all of the call-used
registers, but didn't actually add an output dependancy on the preceeding
instructions that had pending clobbers.  A set clears the pending list,
so that left no instructions with dependancies on the shrw wrt the flags.

One solution would be to go ahead and add the dependancy from the call
to the shrw.  A better solution is to mark calls as clobbering rather
than setting the call-used registers.  This allows more freedom of movement
across the call.  And thus the test winds up with output dependancies on
both the call and the shrw, and all is well.


r~


	* haifa-sched.c (sched_analyze): Mark call-user regs as clobbered
	instead of set.

Index: haifa-sched.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/haifa-sched.c,v
retrieving revision 1.111
diff -c -p -d -r1.111 haifa-sched.c
*** haifa-sched.c	1999/03/14 01:43:10	1.111
--- haifa-sched.c	1999/06/20 05:43:27
*************** sched_analyze (head, tail)
*** 3957,3967 ****
  		    for (u = reg_last_sets[i]; u; u = XEXP (u, 1))
  		      add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
  
! 		    if (global_regs[i])
! 		      for (u = reg_last_clobbers[i]; u; u = XEXP (u, 1))
! 		        add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
! 
! 		    SET_REGNO_REG_SET (reg_pending_sets, i);
  		  }
  	    }
  
--- 3957,3963 ----
  		    for (u = reg_last_sets[i]; u; u = XEXP (u, 1))
  		      add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
  
! 		    SET_REGNO_REG_SET (reg_pending_clobbers, i);
  		  }
  	    }
  

----- End forwarded message -----


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