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]

[RS6000] Nop-insertion fix


This cleans up get_next_active_insn, using similar tests to those in
emit-rtl.c:next_active_insn to decide which insns are really active.  In
addition it excludes stack_tie, a fake insn that introduces dependency
between the stack pointer and stack memory, used in some function
prologues and epilogues.  This fake insn is seen by the insn grouping
pass as if it were real, resulting in nops being inserted to avoid
non-existent mem access stalls.
See also http://gcc.gnu.org/ml/gcc/2005-09/msg00272.html

	* config/rs6000/rs6000.c (get_next_active_insn): Rewrite using
	CALL_P, JUMP_P and NONJUMP_INSN_P, so that barriers and labels
	are omitted.  Exclude stack_tie insn too.

Bootstrapped and regression tested powerpc-linux.  OK for mainline and
4.0?

Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.866
diff -c -p -r1.866 rs6000.c
*** gcc/config/rs6000/rs6000.c	6 Sep 2005 02:04:59 -0000	1.866
--- gcc/config/rs6000/rs6000.c	12 Sep 2005 00:05:22 -0000
*************** rs6000_is_costly_dependence (rtx insn, r
*** 16622,16647 ****
  static rtx
  get_next_active_insn (rtx insn, rtx tail)
  {
!   rtx next_insn;
! 
!   if (!insn || insn == tail)
      return NULL_RTX;
  
!   next_insn = NEXT_INSN (insn);
! 
!   while (next_insn
!   	 && next_insn != tail
! 	 && (GET_CODE (next_insn) == NOTE
! 	     || GET_CODE (PATTERN (next_insn)) == USE
! 	     || GET_CODE (PATTERN (next_insn)) == CLOBBER))
      {
!       next_insn = NEXT_INSN (next_insn);
!     }
! 
!   if (!next_insn || next_insn == tail)
!     return NULL_RTX;
  
!   return next_insn;
  }
  
  /* Return whether the presence of INSN causes a dispatch group termination
--- 16636,16661 ----
  static rtx
  get_next_active_insn (rtx insn, rtx tail)
  {
!   if (insn == NULL_RTX || insn == tail)
      return NULL_RTX;
  
!   while (1)
      {
!       insn = NEXT_INSN (insn);
!       if (insn == NULL_RTX || insn == tail)
! 	return NULL_RTX;
  
!       if (CALL_P (insn)
! 	  || JUMP_P (insn)
! 	  || (NONJUMP_INSN_P (insn)
! 	      && GET_CODE (PATTERN (insn)) != USE
! 	      && GET_CODE (PATTERN (insn)) != CLOBBER
! 	      && !(GET_CODE (PATTERN (insn)) == SET
! 		   && GET_CODE (XEXP (PATTERN (insn), 1)) == UNSPEC
! 		   && XINT (XEXP (PATTERN (insn), 1), 1) == UNSPEC_TIE)))
! 	break;
!     }
!   return insn;
  }
  
  /* Return whether the presence of INSN causes a dispatch group termination

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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