This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
haifa clobber dependancy fix
- To: egcs-patches at egcs dot cygnus dot com
- Subject: haifa clobber dependancy fix
- From: Richard Henderson <rth at cygnus dot com>
- Date: Sat, 19 Jun 1999 22:56:55 -0700
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 -----