Fwd: Questions on PA machine description?

Richard Henderson rth@cygnus.com
Thu Mar 25 13:56:00 GMT 1999


On Thu, Mar 25, 1999 at 01:51:10AM -0700, Jeffrey A Law wrote:
> Hmmm, you're right.  Hmmm, now I'm not sure why I saw the undesired behavior.

The loop in schedule_block that calls schedule_insn is careful
not to touch any insns that were put on the ready queue after
we began issuing insns for that cycle.

The following change seems to do the right thing for Alpha EV5
wrt compare+cmove.

Comments?


r~


	* haifa-sched.c (insn_cost): LINK_COST_FREE means cost 0, not 1.
	(schedule_insn): Only put insns directly on the ready queue that
	have cost zero.
	(schedule_block): Continue processing the ready list until there
	are no more instructions left to issue.

Index: haifa-sched.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/haifa-sched.c,v
retrieving revision 1.85
diff -c -p -d -r1.85 haifa-sched.c
*** haifa-sched.c	1999/03/13 17:38:17	1.85
--- haifa-sched.c	1999/03/25 21:51:29
*************** insn_cost (insn, link, used)
*** 3146,3160 ****
       and LINK_COST_ZERO.  */
  
    if (LINK_COST_FREE (link))
!     cost = 1;
  #ifdef ADJUST_COST
    else if (!LINK_COST_ZERO (link))
      {
        int ncost = cost;
  
        ADJUST_COST (used, link, insn, ncost);
!       if (ncost <= 1)
! 	LINK_COST_FREE (link) = ncost = 1;
        if (cost == ncost)
  	LINK_COST_ZERO (link) = 1;
        cost = ncost;
--- 3146,3163 ----
       and LINK_COST_ZERO.  */
  
    if (LINK_COST_FREE (link))
!     cost = 0;
  #ifdef ADJUST_COST
    else if (!LINK_COST_ZERO (link))
      {
        int ncost = cost;
  
        ADJUST_COST (used, link, insn, ncost);
!       if (ncost < 1)
! 	{
! 	  LINK_COST_FREE (link) = 1;
! 	  ncost = 0;
! 	}
        if (cost == ncost)
  	LINK_COST_ZERO (link) = 1;
        cost = ncost;
*************** schedule_insn (insn, ready, n_ready, clo
*** 4453,4459 ****
  	  /* Adjust the priority of NEXT and either put it on the ready
  	     list or queue it.  */
  	  adjust_priority (next);
! 	  if (effective_cost <= 1)
  	    ready[n_ready++] = next;
  	  else
  	    queue_insn (next, effective_cost);
--- 4456,4462 ----
  	  /* Adjust the priority of NEXT and either put it on the ready
  	     list or queue it.  */
  	  adjust_priority (next);
! 	  if (effective_cost < 1)
  	    ready[n_ready++] = next;
  	  else
  	    queue_insn (next, effective_cost);
*************** schedule_block (bb, rgn_n_insns)
*** 6921,6940 ****
  	  debug_ready_list (ready, n_ready);
  	}
  
!       /* Issue insns from ready list.
!          It is important to count down from n_ready, because n_ready may change
!          as insns are issued.  */
        can_issue_more = issue_rate;
!       for (i = n_ready - 1; i >= 0 && can_issue_more; i--)
  	{
! 	  rtx insn = ready[i];
  	  int cost = actual_hazard (insn_unit (insn), insn, clock_var, 0);
  
  	  if (cost > 1)
! 	    {
! 	      queue_insn (insn, cost);
! 	      ready[i] = ready[--n_ready];	/* remove insn from ready list */
! 	    }
  	  else if (cost == 0)
  	    {
  	      /* an interblock motion? */
--- 6924,6939 ----
  	  debug_ready_list (ready, n_ready);
  	}
  
!       /* Issue insns from ready list.  */
        can_issue_more = issue_rate;
!       while (n_ready != 0 && can_issue_more)
  	{
! 	  /* Select and remove the insn from the ready list.  */
! 	  rtx insn = ready[--n_ready];
  	  int cost = actual_hazard (insn_unit (insn), insn, clock_var, 0);
  
  	  if (cost > 1)
! 	    queue_insn (insn, cost);
  	  else if (cost == 0)
  	    {
  	      /* an interblock motion? */
*************** schedule_block (bb, rgn_n_insns)
*** 7010,7018 ****
  #endif
  
  	      n_ready = schedule_insn (insn, ready, n_ready, clock_var);
- 
- 	      /* remove insn from ready list */
- 	      ready[i] = ready[--n_ready];
  
  	      /* close this block after scheduling its jump */
  	      if (GET_CODE (last_scheduled_insn) == JUMP_INSN)
--- 7009,7014 ----


More information about the Gcc mailing list