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 for insns outside basic blocks


The following patch fixes the instruction outside basic block
thing for all of the Alpha tests I looked at.  The reload one
is the most important, since it actually affects the scheduler.

Objections?


r~


	* reload1.c (emit_reload_insns): Accept a new arg for the bb.  Use
	it to update bb boundaries.  Update caller.
	* function.c (reposition_prologue_and_epilogue_notes): Update
	bb boundaries wrt the moved note.


Index: gcc/reload1.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v
retrieving revision 1.62
diff -c -p -d -r1.62 reload1.c
*** reload1.c	1998/09/16 00:31:22	1.62
--- reload1.c	1998/09/21 01:42:42
*************** static int reload_reg_reaches_end_p	PROT
*** 387,393 ****
  static int allocate_reload_reg		PROTO((int, rtx, int, int));
  static void choose_reload_regs		PROTO((rtx, rtx));
  static void merge_assigned_reloads	PROTO((rtx));
! static void emit_reload_insns		PROTO((rtx));
  static void delete_output_reload	PROTO((rtx, int, rtx));
  static void inc_for_reload		PROTO((rtx, rtx, int));
  static int constraint_accepts_reg_p	PROTO((char *, rtx));
--- 387,393 ----
  static int allocate_reload_reg		PROTO((int, rtx, int, int));
  static void choose_reload_regs		PROTO((rtx, rtx));
  static void merge_assigned_reloads	PROTO((rtx));
! static void emit_reload_insns		PROTO((rtx, int));
  static void delete_output_reload	PROTO((rtx, int, rtx));
  static void inc_for_reload		PROTO((rtx, rtx, int));
  static int constraint_accepts_reg_p	PROTO((char *, rtx));
*************** reload_as_needed (first, live_known)
*** 4219,4225 ****
  
  	      /* Generate the insns to reload operands into or out of
  		 their reload regs.  */
! 	      emit_reload_insns (insn);
  
  	      /* Substitute the chosen reload regs from reload_reg_rtx
  		 into the insn's body (or perhaps into the bodies of other
--- 4219,4225 ----
  
  	      /* Generate the insns to reload operands into or out of
  		 their reload regs.  */
! 	      emit_reload_insns (insn, this_block);
  
  	      /* Substitute the chosen reload regs from reload_reg_rtx
  		 into the insn's body (or perhaps into the bodies of other
*************** merge_assigned_reloads (insn)
*** 6329,6336 ****
  /* Output insns to reload values in and out of the chosen reload regs.  */
  
  static void
! emit_reload_insns (insn)
       rtx insn;
  {
    register int j;
    rtx input_reload_insns[MAX_RECOG_OPERANDS];
--- 6329,6337 ----
  /* Output insns to reload values in and out of the chosen reload regs.  */
  
  static void
! emit_reload_insns (insn, bb)
       rtx insn;
+      int bb;
  {
    register int j;
    rtx input_reload_insns[MAX_RECOG_OPERANDS];
*************** emit_reload_insns (insn)
*** 6345,6351 ****
    rtx other_operand_reload_insns = 0;
    rtx other_output_reload_insns[MAX_RECOG_OPERANDS];
    rtx following_insn = NEXT_INSN (insn);
!   rtx before_insn = insn;
    int special;
    /* Values to be put in spill_reg_store are put here first.  */
    rtx new_spill_reg_store[FIRST_PSEUDO_REGISTER];
--- 6346,6352 ----
    rtx other_operand_reload_insns = 0;
    rtx other_output_reload_insns[MAX_RECOG_OPERANDS];
    rtx following_insn = NEXT_INSN (insn);
!   rtx before_insn = PREV_INSN (insn);
    int special;
    /* Values to be put in spill_reg_store are put here first.  */
    rtx new_spill_reg_store[FIRST_PSEUDO_REGISTER];
*************** emit_reload_insns (insn)
*** 7251,7268 ****
       reloads for the operand.  The RELOAD_OTHER output reloads are
       output in descending order by reload number.  */
  
!   emit_insns_before (other_input_address_reload_insns, before_insn);
!   emit_insns_before (other_input_reload_insns, before_insn);
  
    for (j = 0; j < reload_n_operands; j++)
      {
!       emit_insns_before (inpaddr_address_reload_insns[j], before_insn);
!       emit_insns_before (input_address_reload_insns[j], before_insn);
!       emit_insns_before (input_reload_insns[j], before_insn);
      }
  
!   emit_insns_before (other_operand_reload_insns, before_insn);
!   emit_insns_before (operand_reload_insns, before_insn);
  
    for (j = 0; j < reload_n_operands; j++)
      {
--- 7252,7269 ----
       reloads for the operand.  The RELOAD_OTHER output reloads are
       output in descending order by reload number.  */
  
!   emit_insns_before (other_input_address_reload_insns, insn);
!   emit_insns_before (other_input_reload_insns, insn);
  
    for (j = 0; j < reload_n_operands; j++)
      {
!       emit_insns_before (inpaddr_address_reload_insns[j], insn);
!       emit_insns_before (input_address_reload_insns[j], insn);
!       emit_insns_before (input_reload_insns[j], insn);
      }
  
!   emit_insns_before (other_operand_reload_insns, insn);
!   emit_insns_before (operand_reload_insns, insn);
  
    for (j = 0; j < reload_n_operands; j++)
      {
*************** emit_reload_insns (insn)
*** 7270,7275 ****
--- 7271,7285 ----
        emit_insns_before (output_address_reload_insns[j], following_insn);
        emit_insns_before (output_reload_insns[j], following_insn);
        emit_insns_before (other_output_reload_insns[j], following_insn);
+     }
+ 
+   /* Keep basic block info up to date.  */
+   if (n_basic_blocks)
+     {
+       if (basic_block_head[bb] == insn)
+         basic_block_head[bb] = NEXT_INSN (before_insn);
+       if (basic_block_end[bb] == insn)
+         basic_block_end[bb] = PREV_INSN (following_insn);
      }
  
    /* Move death notes from INSN
Index: gcc/function.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/function.c,v
retrieving revision 1.41
diff -c -p -d -r1.41 function.c
*** function.c	1998/09/15 22:47:08	1.41
--- function.c	1998/09/21 01:43:01
*************** reposition_prologue_and_epilogue_notes (
*** 6239,6250 ****
--- 6239,6257 ----
  			    && NOTE_LINE_NUMBER (note) == NOTE_INSN_PROLOGUE_END)
  			  break;
  		    }
+ 
  		  next = NEXT_INSN (note);
  		  prev = PREV_INSN (note);
  		  if (prev)
  		    NEXT_INSN (prev) = next;
  		  if (next)
  		    PREV_INSN (next) = prev;
+ 
+ 		  /* Whether or not we can depend on basic_block_head, 
+ 		     attempt to keep it up-to-date.  */
+ 		  if (basic_block_head[0] == note)
+ 		    basic_block_head[0] = next;
+ 
  		  add_insn_after (note, insn);
  		}
  	    }
*************** reposition_prologue_and_epilogue_notes (
*** 6283,6289 ****
  		    NEXT_INSN (prev) = next;
  		  if (next)
  		    PREV_INSN (next) = prev;
! 		  add_insn_after (note, PREV_INSN (insn));
  		}
  	    }
  	}
--- 6290,6303 ----
  		    NEXT_INSN (prev) = next;
  		  if (next)
  		    PREV_INSN (next) = prev;
! 
! 		  /* Whether or not we can depend on basic_block_head, 
! 		     attempt to keep it up-to-date.  */
! 		  if (n_basic_blocks
! 		      && basic_block_head[n_basic_blocks-1] == insn)
! 		    basic_block_head[n_basic_blocks-1] = note;
! 
! 		  add_insn_before (note, insn);
  		}
  	    }
  	}


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