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]

reload1.c (calculate_needs_all_insns): When ignore equivalence


I've checked in this patch.

This fixes a compiler abort that occured while building a m68k gdb on an
hpux system.

In the second pass through calculate_needs_all_insns, the problematic insn
needed reloads and got chain->need_reload set.  In the third pass through,
the insn dest had been spilled, and so now it was an equiv setting insn and
got ignored.  However, chain->need_reload was still set, and
chain->used_spill_regs still contained spill regs allocated in the second
pass through.  When we get to finish_spills, it sees that need_reload is
still set, and tried to process it, but the spill regs allocated in the
second pass were different from the spill regs allocated in the third pass,
and we ended up hitting the abort.  Hence we must clear need_reload in
calculate_needs_all_insns.

Similarly, need_operand_change and need_elim should be cleared.  This probably
doesn't fix any code generation problems, but does prevent us from doing
unnecessary work in reload_as_needed, and it does fix a consistency problem
with the need_* info that might lead to future problems.

Fri Mar 12 12:35:01 1999  Jim Wilson  <wilson@cygnus.com>

	* reload1.c (calculate_needs_all_insns): When ignore equivalence
	setting insn, clear need_elim, need_reload, and need_operand_change.

Index: reload1.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v
retrieving revision 1.130
diff -p -r1.130 reload1.c
*** reload1.c	1999/02/25 23:45:31	1.130
--- reload1.c	1999/03/12 20:34:56
*************** calculate_needs_all_insns (global)
*** 1387,1393 ****
  	  if (set && GET_CODE (SET_DEST (set)) == REG
  	      && reg_renumber[REGNO (SET_DEST (set))] < 0
  	      && reg_equiv_constant[REGNO (SET_DEST (set))])
! 	    continue;
  
  	  /* If needed, eliminate any eliminable registers.  */
  	  if (num_eliminable || num_eliminable_invariants)
--- 1387,1400 ----
  	  if (set && GET_CODE (SET_DEST (set)) == REG
  	      && reg_renumber[REGNO (SET_DEST (set))] < 0
  	      && reg_equiv_constant[REGNO (SET_DEST (set))])
! 	    {
! 	      /* Must clear out the shortcuts, in case they were set last
! 		 time through.  */
! 	      chain->need_elim = 0;
! 	      chain->need_reload = 0;
! 	      chain->need_operand_change = 0;
! 	      continue;
! 	    }
  
  	  /* If needed, eliminate any eliminable registers.  */
  	  if (num_eliminable || num_eliminable_invariants)


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