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 regmove.c


I have applied the following patch:

Wed Sep 16 14:47:43 1998  J"orn Rennecke <amylaar@cygnus.co.uk>

	* regmove.c (copy_src_to_dest): Don't copy if that requires
	(a) new register(s).

Index: regmove.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/regmove.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -p -r1.35 -r1.36
*** regmove.c	1998/08/28 07:18:52	1.35
--- regmove.c	1998/09/16 06:49:57	1.36
*************** copy_src_to_dest (insn, src, dest, loop_
*** 617,630 ****
        && GET_CODE (dest) == REG
        && REG_LIVE_LENGTH (REGNO (dest)) > 0
        && (set = single_set (insn)) != NULL_RTX
!       && !reg_mentioned_p (dest, SET_SRC (set))
!       && validate_replace_rtx (src, dest, insn))
      {
        /* Generate the src->dest move.  */
        start_sequence ();
        emit_move_insn (dest, src);
        seq = gen_sequence ();
        end_sequence ();
        emit_insn_before (seq, insn);
        move_insn = PREV_INSN (insn);
        p_move_notes = &REG_NOTES (move_insn);
--- 617,641 ----
        && GET_CODE (dest) == REG
        && REG_LIVE_LENGTH (REGNO (dest)) > 0
        && (set = single_set (insn)) != NULL_RTX
!       && !reg_mentioned_p (dest, SET_SRC (set)))
      {
+       int old_num_regs = reg_rtx_no;
+ 
        /* Generate the src->dest move.  */
        start_sequence ();
        emit_move_insn (dest, src);
        seq = gen_sequence ();
        end_sequence ();
+       /* If this sequence uses new registers, we may not use it.  */
+       if (old_num_regs != reg_rtx_no
+ 	  || ! validate_replace_rtx (src, dest, insn))
+ 	{
+ 	  /* We have to restore reg_rtx_no to its old value, lest
+ 	     recompute_reg_usage will try to compute the usage of the
+ 	     new regs, yet reg_n_info is not valid for them.  */
+ 	  reg_rtx_no = old_num_regs;
+ 	  return;
+ 	}
        emit_insn_before (seq, insn);
        move_insn = PREV_INSN (insn);
        p_move_notes = &REG_NOTES (move_insn);


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