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]

patch to improve agi_dependent


Hi
This patch change agi_dependent to handle push instruction correctly.
Most improtantly it now returns 0 when both insns are pushes. This results
in better scheduling for prologues.

Honza

Mon Apr 12 23:27:20 CEST 1999 Jan Hubicka <hubicka@freesoft.cz>

	i386.md (agi_dependent): Handle push operation more correctly.

*** i386.c.old2	Mon Apr 12 23:12:40 1999
--- i386.c	Tue Apr 13 00:29:39 1999
*************** int
*** 5205,5220 ****
  agi_dependent (insn, dep_insn)
       rtx insn, dep_insn;
  {
    if (GET_CODE (dep_insn) == INSN
        && GET_CODE (PATTERN (dep_insn)) == SET
!       && GET_CODE (SET_DEST (PATTERN (dep_insn))) == REG)
!     return reg_mentioned_in_mem (SET_DEST (PATTERN (dep_insn)), insn);
  
    if (GET_CODE (dep_insn) == INSN && GET_CODE (PATTERN (dep_insn)) == SET
        && GET_CODE (SET_DEST (PATTERN (dep_insn))) == MEM
        && push_operand (SET_DEST (PATTERN (dep_insn)),
                         GET_MODE (SET_DEST (PATTERN (dep_insn)))))
!     return reg_mentioned_in_mem (stack_pointer_rtx, insn);
  
    return 0;
  }
--- 5205,5242 ----
  agi_dependent (insn, dep_insn)
       rtx insn, dep_insn;
  {
+   int push = 0, push_dep = 0;
    if (GET_CODE (dep_insn) == INSN
        && GET_CODE (PATTERN (dep_insn)) == SET
!       && GET_CODE (SET_DEST (PATTERN (dep_insn))) == REG
!       && reg_mentioned_in_mem (SET_DEST (PATTERN (dep_insn)), insn))
!     return 1;
! 
!   if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SET
!       && GET_CODE (SET_DEST (PATTERN (insn))) == MEM
!       && push_operand (SET_DEST (PATTERN (insn)),
!                        GET_MODE (SET_DEST (PATTERN (insn)))))
!     push = 1;
  
    if (GET_CODE (dep_insn) == INSN && GET_CODE (PATTERN (dep_insn)) == SET
        && GET_CODE (SET_DEST (PATTERN (dep_insn))) == MEM
        && push_operand (SET_DEST (PATTERN (dep_insn)),
                         GET_MODE (SET_DEST (PATTERN (dep_insn)))))
!     push_dep = 1;
! 
!   /* CPUs contain special hardware to allow two pushes.  */
!   if (push && push_dep) 
!     return 0;
! 
!   /* Push operation implicitly change stack pointer causing AGI stalls.  */
!   if (push_dep && reg_mentioned_in_mem (stack_pointer_rtx, insn))
!     return 1;
! 
!   /* Push also implicitly read stack pointer.  */
!   if (push && modified_in_p (stack_pointer_rtx, dep_insn))
!     return 1;
  
    return 0;
  }


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