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]
Other format: [Raw text]

[PATCH]: Misc scheduler changes



Formatting aside, are these changes correct?
They seem correct to me.
They also cause no regressions.

The first is fixing a check for constants that only checked CONST_INT.
The second only considers a store risky if it can trap (the assumption was
that all stores can trap, but hey, who knows).
The third stops us from creating memory dependences on unchanging memory.
If it can't change, there's no need for a dependence, because it'll never
conflict with anything else.


Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/sched-rgn.c,v
retrieving revision 1.26
diff -c -3 -p -w -B -b -r1.26 sched-rgn.c
*** sched-rgn.c	2001/11/23 02:05:19	1.26
--- sched-rgn.c	2001/12/10 15:20:31
*************** enum INSN_TRAP_CLASS
*** 1566,1573 ****
    (GET_CODE (x) == REG					\
     || ((GET_CODE (x) == PLUS || GET_CODE (x) == MINUS   \
  	|| (GET_CODE (x) == LO_SUM))	                \
!        && (GET_CODE (XEXP (x, 0)) == CONST_INT		\
! 	   || GET_CODE (XEXP (x, 1)) == CONST_INT)))

  /* Turns on the fed_by_spec_load flag for insns fed by load_insn.  */

--- 1566,1573 ----
    (GET_CODE (x) == REG					\
     || ((GET_CODE (x) == PLUS || GET_CODE (x) == MINUS   \
  	|| (GET_CODE (x) == LO_SUM))	                \
!        && (CONSTANT_P (XEXP (x, 0))		\
! 	   || CONSTANT_P (XEXP (x, 1)))))

  /* Turns on the fed_by_spec_load flag for insns fed by load_insn.  */

*************** may_trap_exp (x, is_store)
*** 1738,1744 ****
    code = GET_CODE (x);
    if (is_store)
      {
!       if (code == MEM)
  	return TRAP_RISKY;
        else
  	return TRAP_FREE;
--- 1738,1744 ----
    code = GET_CODE (x);
    if (is_store)
      {
!       if (code == MEM && may_trap_p (x))
  	return TRAP_RISKY;
        else
  	return TRAP_FREE;
Index: sched-deps.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/sched-deps.c,v
retrieving revision 1.28
diff -c -3 -p -w -B -b -r1.28 sched-deps.c
*** sched-deps.c	2001/10/28 20:09:15	1.28
--- sched-deps.c	2001/12/10 15:20:32
*************** sched_analyze_2 (deps, x, insn)
*** 860,865 ****
--- 860,868 ----
      case MEM:
        {
  	/* Reading memory.  */
+ 	/* Don't create dependences on unchanging memory, like constant pool accesses.  These will never conflict with any other memory access. */
+ 	if (RTX_UNCHANGING_P (x) == 0)
+ 	  {
  	    rtx u;
  	    rtx pending, pending_mem;
  	    rtx t = x;
*************** sched_analyze_2 (deps, x, insn)
*** 902,908 ****
  	   this insn may be followed by a write.  */
  	add_insn_mem_dependence (deps, &deps->pending_read_insns,
  				 &deps->pending_read_mems, insn, x);
!
  	/* Take advantage of tail recursion here.  */
  	sched_analyze_2 (deps, XEXP (x, 0), insn);
  	return;
--- 905,911 ----
  	       this insn may be followed by a write.  */
  	    add_insn_mem_dependence (deps, &deps->pending_read_insns,
  				     &deps->pending_read_mems, insn, x);
! 	  }
  	/* Take advantage of tail recursion here.  */
  	sched_analyze_2 (deps, XEXP (x, 0), insn);
  	return;


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