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]

disappearing labels fix



This patch should fix the regressions with -fPIC on the PPC that were
caused by my disappearing labels patch.  It should also fix the problems
in libjava on the PPC.

It's been 3-staged on the PPC (linux & aix), PA32 hpux, x86 (linux).

The fr30 still works with this patch (which is the port which originally
caused me to change the code in cse a year or two ago).  

And it just feels right.  I like to be able to delete/simplify code to
fix bugs :-)

Installed on the branch as well as the mainline sources.

	* cse.c (cse_insn): Mostly remove first hunk of code which collapsed
	a computed jump into an unconditional jump.
	In second hunk of code for collapsing computed and conditional jumps
	into unconditional jumps, reemit the jump in additional cases.

Index: cse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cse.c,v
retrieving revision 1.174.2.3
diff -c -3 -p -r1.174.2.3 cse.c
*** cse.c	2001/03/21 20:23:52	1.174.2.3
--- cse.c	2001/05/10 23:29:42
*************** cse_insn (insn, libcall_insn)
*** 5513,5543 ****
  	     check for this separately here.  We will delete such an
  	     insn below.
  
! 	     Tablejump insns contain a USE of the table, so simply replacing
! 	     the operand with the constant won't match.  This is simply an
! 	     unconditional branch, however, and is therefore valid.  Just
! 	     insert the substitution here and we will delete and re-emit
! 	     the insn later.  */
! 
  	  if (n_sets == 1 && dest == pc_rtx
  	      && (trial == pc_rtx
  		  || (GET_CODE (trial) == LABEL_REF
  		      && ! condjump_p (insn))))
  	    {
! 	      if (trial == pc_rtx)
! 		{
! 		  SET_SRC (sets[i].rtl) = trial;
! 		  cse_jumps_altered = 1;
! 		  break;
! 		}
! 
! 	      PATTERN (insn) = gen_jump (XEXP (trial, 0));
! 	      INSN_CODE (insn) = -1;
! 
! 	      if (NEXT_INSN (insn) != 0
! 		  && GET_CODE (NEXT_INSN (insn)) != BARRIER)
! 		emit_barrier_after (insn);
! 
  	      cse_jumps_altered = 1;
  	      break;
  	    }
--- 5513,5529 ----
  	     check for this separately here.  We will delete such an
  	     insn below.
  
! 	     For other cases such as a table jump or conditional jump
! 	     where we know the ultimate target, go ahead and replace the
! 	     operand.  While that may not make a valid insn, we will
! 	     reemit the jump below (and also insert any necessary
! 	     barriers).  */
  	  if (n_sets == 1 && dest == pc_rtx
  	      && (trial == pc_rtx
  		  || (GET_CODE (trial) == LABEL_REF
  		      && ! condjump_p (insn))))
  	    {
! 	      SET_SRC (sets[i].rtl) = trial;
  	      cse_jumps_altered = 1;
  	      break;
  	    }
*************** cse_insn (insn, libcall_insn)
*** 5799,5811 ****
  	}
  
        /* If this SET is now setting PC to a label, we know it used to
! 	 be a conditional or computed branch.  So we see if we can follow
! 	 it.  If it was a computed branch, delete it and re-emit.  */
        else if (dest == pc_rtx && GET_CODE (src) == LABEL_REF)
  	{
! 	  /* If this is not in the format for a simple branch and
! 	     we are the only SET in it, re-emit it.  */
! 	  if (! simplejump_p (insn) && n_sets == 1)
  	    {
  	      rtx new = emit_jump_insn_before (gen_jump (XEXP (src, 0)), insn);
  	      JUMP_LABEL (new) = XEXP (src, 0);
--- 5785,5801 ----
  	}
  
        /* If this SET is now setting PC to a label, we know it used to
! 	 be a conditional or computed branch.  */
        else if (dest == pc_rtx && GET_CODE (src) == LABEL_REF)
  	{
! 	  /* We reemit the jump in as many cases as possible just in
! 	     case the form of an unconditional jump is significantly
! 	     different than a computed jump or conditional jump.
! 
! 	     If this insn has multiple sets, then reemitting the
! 	     jump is nontrivial.  So instead we just force rerecognition
! 	     and hope for the best.  */
! 	  if (n_sets == 1)
  	    {
  	      rtx new = emit_jump_insn_before (gen_jump (XEXP (src, 0)), insn);
  	      JUMP_LABEL (new) = XEXP (src, 0);
*************** cse_insn (insn, libcall_insn)
*** 5813,5823 ****
  	      insn = new;
  	    }
  	  else
- 	    /* Otherwise, force rerecognition, since it probably had
- 	       a different pattern before.
- 	       This shouldn't really be necessary, since whatever
- 	       changed the source value above should have done this.
- 	       Until the right place is found, might as well do this here.  */
  	    INSN_CODE (insn) = -1;
  
  	  never_reached_warning (insn);
--- 5803,5808 ----





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