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]

Avoid replacing insn by INSN_DELETED note on most places



Hi,
this patch replaces code to change insn into INSN_DELETED note by delete_insn
call in places I was able to quite conveinence myself that it won't cause
surprises later by not updating some datastructure.

Bootstrapped/regtested i386

Honza

Sat Sep 22 17:12:01 CEST 2001  Jan Hubicka  <jh@suse.cz>
	* final.c (final, final_scan_insn): Use delete_insn/delete_note.
	* function.c (fixup_var_refs_insn, fixup_var_refs_1,
	keep_stack_depressed): Likewise.
	* gcse.c (cprop_cc0_jump): Likewise.
	* local-alloc.c (update_equiv_regs): Likewise.
	* loop.c (scan_loop, loop_delete_insns): Likewise.
	* regmove.c (try_auto_increment, fixup_match_1): Likewise.
	* reload1.c (reload, calculate_needs_all_insns, reload_as_needed,
	delete_output_reload, delete_address_reloads_1,
	reload_cse_delete_noop_set, reload_combine, reload_cse_move2add):
	Likewise.
	* sibcall.c (replace_call_placeholder): Likewise.
	* cse.c (cse_insn): Likewise.

*** /p2/cfg9/egcs/gcc/final.c	Thu Sep 20 18:33:13 2001
--- final.c	Sat Sep 22 15:58:09 2001
*************** final (first, file, optimize, prescan)
*** 1972,1979 ****
  		     && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last)
  		     && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last)))
  	      {
! 		NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
! 		NOTE_SOURCE_FILE (insn) = 0;
  		continue;
  	      }
  	    last = insn;
--- 1972,1978 ----
  		     && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last)
  		     && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last)))
  	      {
! 		delete_note (insn);
  		continue;
  	      }
  	    last = insn;
*************** final_scan_insn (insn, file, optimize, p
*** 2719,2727 ****
  	       (It would not be recognized.)  */
  	    if (SET_SRC (body) == pc_rtx)
  	      {
! 		PUT_CODE (insn, NOTE);
! 		NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
! 		NOTE_SOURCE_FILE (insn) = 0;
  		break;
  	      }
  	    else if (GET_CODE (SET_SRC (body)) == RETURN)
--- 2718,2724 ----
  	       (It would not be recognized.)  */
  	    if (SET_SRC (body) == pc_rtx)
  	      {
! 	        delete_insn (insn);
  		break;
  	      }
  	    else if (GET_CODE (SET_SRC (body)) == RETURN)
*************** final_scan_insn (insn, file, optimize, p
*** 2780,2790 ****
  		  else if (result == 2)
  		    INSN_CODE (insn) = -1;
  		  if (SET_DEST (set) == SET_SRC (set))
! 		    {
! 		      PUT_CODE (insn, NOTE);
! 		      NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
! 		      NOTE_SOURCE_FILE (insn) = 0;
! 		    }
  		}
  		break;
  
--- 2777,2783 ----
  		  else if (result == 2)
  		    INSN_CODE (insn) = -1;
  		  if (SET_DEST (set) == SET_SRC (set))
! 		    delete_insn (insn);
  		}
  		break;
  
*************** final_scan_insn (insn, file, optimize, p
*** 2902,2911 ****
  		 prev = PREV_INSN (prev))
  	      {
  		if (GET_CODE (prev) == NOTE)
! 		  {
! 		    NOTE_LINE_NUMBER (prev) = NOTE_INSN_DELETED;
! 		    NOTE_SOURCE_FILE (prev) = 0;
! 		  }
  	      }
  
  	    return prev;
--- 2895,2901 ----
  		 prev = PREV_INSN (prev))
  	      {
  		if (GET_CODE (prev) == NOTE)
! 		  delete_note (prev);
  	      }
  
  	    return prev;
*** /p2/cfg9/egcs/gcc/function.c	Thu Sep 20 18:33:13 2001
--- function.c	Sat Sep 22 15:46:47 2001
*************** fixup_var_refs_insn (insn, var, promoted
*** 1735,1745 ****
  		     find_reg_note (XEXP (note, 0), REG_RETVAL,
  				    NULL_RTX));
  
!       /* In unoptimized compilation, we shouldn't call delete_insn
! 	 except in jump.c doing warnings.  */
!       PUT_CODE (insn, NOTE);
!       NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
!       NOTE_SOURCE_FILE (insn) = 0;
      }
  
    /* The insn to load VAR from a home in the arglist
--- 1735,1741 ----
  		     find_reg_note (XEXP (note, 0), REG_RETVAL,
  				    NULL_RTX));
  
!       delete_insn (insn);
      }
  
    /* The insn to load VAR from a home in the arglist
*************** fixup_var_refs_insn (insn, var, promoted
*** 1760,1770 ****
  		   && SET_DEST (prev_set) == SET_SRC (set)
  		   && rtx_equal_p (SET_SRC (prev_set), var))))
      {
!       /* In unoptimized compilation, we shouldn't call delete_insn
! 	 except in jump.c doing warnings.  */
!       PUT_CODE (insn, NOTE);
!       NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
!       NOTE_SOURCE_FILE (insn) = 0;
      }
    else
      {
--- 1756,1762 ----
  		   && SET_DEST (prev_set) == SET_SRC (set)
  		   && rtx_equal_p (SET_SRC (prev_set), var))))
      {
!       delete_insn (insn);
      }
    else
      {
*************** fixup_var_refs_1 (var, promoted_mode, lo
*** 2376,2384 ****
  		  REG_NOTES (insn) = REG_NOTES (last);
  		PATTERN (insn) = PATTERN (last);
  
! 		PUT_CODE (last, NOTE);
! 		NOTE_LINE_NUMBER (last) = NOTE_INSN_DELETED;
! 		NOTE_SOURCE_FILE (last) = 0;
  	      }
  	    else
  	      PATTERN (insn) = pat;
--- 2368,2374 ----
  		  REG_NOTES (insn) = REG_NOTES (last);
  		PATTERN (insn) = PATTERN (last);
  
! 		delete_insn (last);
  	      }
  	    else
  	      PATTERN (insn) = pat;
*************** fixup_var_refs_1 (var, promoted_mode, lo
*** 2421,2429 ****
  		  REG_NOTES (insn) = REG_NOTES (last);
  		PATTERN (insn) = PATTERN (last);
  
! 		PUT_CODE (last, NOTE);
! 		NOTE_LINE_NUMBER (last) = NOTE_INSN_DELETED;
! 		NOTE_SOURCE_FILE (last) = 0;
  	      }
  	    else
  	      PATTERN (insn) = pat;
--- 2411,2417 ----
  		  REG_NOTES (insn) = REG_NOTES (last);
  		PATTERN (insn) = PATTERN (last);
  
! 		delete_insn (last);
  	      }
  	    else
  	      PATTERN (insn) = pat;
*************** keep_stack_depressed (seq)
*** 7168,7176 ****
  	    sp_modified_unknown = 1;
  
  	  /* Don't allow the SP modification to happen.  */
! 	  PUT_CODE (insn, NOTE);
! 	  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
! 	  NOTE_SOURCE_FILE (insn) = 0;
  	}
        else if (reg_referenced_p (stack_pointer_rtx, PATTERN (insn)))
  	{
--- 7156,7162 ----
  	    sp_modified_unknown = 1;
  
  	  /* Don't allow the SP modification to happen.  */
! 	  delete_insn (insn);
  	}
        else if (reg_referenced_p (stack_pointer_rtx, PATTERN (insn)))
  	{
*** /p2/cfg9/egcs/gcc/gcse.c	Thu Sep 20 18:33:13 2001
--- gcse.c	Sat Sep 22 15:55:20 2001
*************** cprop_cc0_jump (bb, insn, reg_used, src)
*** 4102,4110 ****
      return 0;
  
    /* If we succeeded, delete the cc0 setter.  */
!   PUT_CODE (insn, NOTE);
!   NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
!   NOTE_SOURCE_FILE (insn) = 0;
  
    return 1;
   }
--- 4102,4108 ----
      return 0;
  
    /* If we succeeded, delete the cc0 setter.  */
!   delete_insn (insn);
  
    return 1;
   }
*** /p2/cfg9/egcs/gcc/local-alloc.c	Thu Sep 20 18:33:13 2001
--- local-alloc.c	Sat Sep 22 15:39:03 2001
*************** update_equiv_regs ()
*** 1107,1115 ****
  		      remove_death (regno, insn);
  		      REG_N_REFS (regno) = 0;
  		      REG_FREQ (regno) = 0;
! 		      PUT_CODE (equiv_insn, NOTE);
! 		      NOTE_LINE_NUMBER (equiv_insn) = NOTE_INSN_DELETED;
! 		      NOTE_SOURCE_FILE (equiv_insn) = 0;
  		      
  		      reg_equiv[regno].init_insns
  			= XEXP (reg_equiv[regno].init_insns, 1);
--- 1107,1113 ----
  		      remove_death (regno, insn);
  		      REG_N_REFS (regno) = 0;
  		      REG_FREQ (regno) = 0;
! 		      delete_insn (equiv_insn);
  		      
  		      reg_equiv[regno].init_insns
  			= XEXP (reg_equiv[regno].init_insns, 1);
*************** update_equiv_regs ()
*** 1128,1136 ****
  			 otherwise eliminate_regs_in_insn will abort.  */
  		      INSN_CODE (new_insn) = INSN_CODE (equiv_insn);
  
! 		      PUT_CODE (equiv_insn, NOTE);
! 		      NOTE_LINE_NUMBER (equiv_insn) = NOTE_INSN_DELETED;
! 		      NOTE_SOURCE_FILE (equiv_insn) = 0;
  
  		      XEXP (reg_equiv[regno].init_insns, 0) = new_insn;
  
--- 1126,1132 ----
  			 otherwise eliminate_regs_in_insn will abort.  */
  		      INSN_CODE (new_insn) = INSN_CODE (equiv_insn);
  
! 		      delete_insn (equiv_insn);
  
  		      XEXP (reg_equiv[regno].init_insns, 0) = new_insn;
  
*** /p2/cfg9/egcs/gcc/loop.c	Thu Sep 20 18:33:14 2001
--- loop.c	Sat Sep 22 15:48:20 2001
*************** scan_loop (loop, flags)
*** 807,815 ****
  		    = replace_rtx (REG_NOTES (regs->array[regno].single_usage),
  				   SET_DEST (set), copy_rtx (SET_SRC (set)));
  
! 		  PUT_CODE (p, NOTE);
! 		  NOTE_LINE_NUMBER (p) = NOTE_INSN_DELETED;
! 		  NOTE_SOURCE_FILE (p) = 0;
  		  regs->array[regno].set_in_loop = 0;
  		  continue;
  		}
--- 807,813 ----
  		    = replace_rtx (REG_NOTES (regs->array[regno].single_usage),
  				   SET_DEST (set), copy_rtx (SET_SRC (set)));
  
! 		  delete_insn (p);
  		  regs->array[regno].set_in_loop = 0;
  		  continue;
  		}
*************** loop_delete_insns (first, last)
*** 9340,9350 ****
  {
    while (1)
      {
-       PUT_CODE (first, NOTE);
-       NOTE_LINE_NUMBER (first) = NOTE_INSN_DELETED;
        if (loop_dump_stream)
  	fprintf (loop_dump_stream, ", deleting init_insn (%d)",
  		 INSN_UID (first));
  
        /* If this was the LAST instructions we're supposed to delete,
  	 we're done.  */
--- 9336,9345 ----
  {
    while (1)
      {
        if (loop_dump_stream)
  	fprintf (loop_dump_stream, ", deleting init_insn (%d)",
  		 INSN_UID (first));
+       delete_insn (first);
  
        /* If this was the LAST instructions we're supposed to delete,
  	 we're done.  */
*** /p2/cfg9/egcs/gcc/regmove.c	Thu Sep 20 18:33:14 2001
--- regmove.c	Sat Sep 22 15:49:34 2001
*************** try_auto_increment (insn, inc_insn, inc_
*** 148,158 ****
  		    = gen_rtx_EXPR_LIST (REG_INC,
  					 reg, REG_NOTES (insn));
  		  if (! inc_insn_set)
! 		    {
! 		      PUT_CODE (inc_insn, NOTE);
! 		      NOTE_LINE_NUMBER (inc_insn) = NOTE_INSN_DELETED;
! 		      NOTE_SOURCE_FILE (inc_insn) = 0;
! 		    }
  		  return 1;
  		}
  	    }
--- 148,154 ----
  		    = gen_rtx_EXPR_LIST (REG_INC,
  					 reg, REG_NOTES (insn));
  		  if (! inc_insn_set)
! 		    delete_insn (inc_insn);
  		  return 1;
  		}
  	    }
*************** fixup_match_1 (insn, set, src, src_subre
*** 1895,1903 ****
  	  rtx notes = REG_NOTES (insn);
  
  	  emit_insn_after_with_line_notes (pat, PREV_INSN (p), insn);
! 	  PUT_CODE (insn, NOTE);
! 	  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
! 	  NOTE_SOURCE_FILE (insn) = 0;
  	  /* emit_insn_after_with_line_notes has no
  	     return value, so search for the new insn.  */
  	  insn = p;
--- 1891,1897 ----
  	  rtx notes = REG_NOTES (insn);
  
  	  emit_insn_after_with_line_notes (pat, PREV_INSN (p), insn);
! 	  delete_insn (insn);
  	  /* emit_insn_after_with_line_notes has no
  	     return value, so search for the new insn.  */
  	  insn = p;
*************** fixup_match_1 (insn, set, src, src_subre
*** 1949,1957 ****
  	  if (q && set2 && SET_DEST (set2) == src && CONSTANT_P (SET_SRC (set2))
  	      && validate_change (insn, &SET_SRC (set), XEXP (note, 0), 0))
  	    {
! 	      PUT_CODE (q, NOTE);
! 	      NOTE_LINE_NUMBER (q) = NOTE_INSN_DELETED;
! 	      NOTE_SOURCE_FILE (q) = 0;
  	      REG_N_SETS (REGNO (src))--;
  	      REG_N_CALLS_CROSSED (REGNO (src)) -= num_calls2;
  	      REG_LIVE_LENGTH (REGNO (src)) -= s_length2;
--- 1943,1949 ----
  	  if (q && set2 && SET_DEST (set2) == src && CONSTANT_P (SET_SRC (set2))
  	      && validate_change (insn, &SET_SRC (set), XEXP (note, 0), 0))
  	    {
! 	      delete_insn (q);
  	      REG_N_SETS (REGNO (src))--;
  	      REG_N_CALLS_CROSSED (REGNO (src)) -= num_calls2;
  	      REG_LIVE_LENGTH (REGNO (src)) -= s_length2;
*** /p2/cfg9/egcs/gcc/reload1.c	Thu Sep 20 18:33:14 2001
--- reload1.c	Sat Sep 22 16:34:17 2001
*************** reload (first, global)
*** 1188,1196 ****
  		&& (GET_CODE (XEXP (PATTERN (insn), 0)) != REG
  		    || ! REG_FUNCTION_VALUE_P (XEXP (PATTERN (insn), 0)))))
  	  {
! 	    PUT_CODE (insn, NOTE);
! 	    NOTE_SOURCE_FILE (insn) = 0;
! 	    NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
  	    continue;
  	  }
  
--- 1188,1194 ----
  		&& (GET_CODE (XEXP (PATTERN (insn), 0)) != REG
  		    || ! REG_FUNCTION_VALUE_P (XEXP (PATTERN (insn), 0)))))
  	  {
! 	    delete_insn (insn);
  	    continue;
  	  }
  
*************** calculate_needs_all_insns (global)
*** 1467,1475 ****
  		  && GET_CODE (SET_SRC (set)) == REG
  		  && REGNO (SET_SRC (set)) >= FIRST_PSEUDO_REGISTER)
  		{
! 		  PUT_CODE (insn, NOTE);
! 		  NOTE_SOURCE_FILE (insn) = 0;
! 		  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
  		  /* Delete it from the reload chain */
  		  if (chain->prev)
  		    chain->prev->next = next;
--- 1465,1471 ----
  		  && GET_CODE (SET_SRC (set)) == REG
  		  && REGNO (SET_SRC (set)) >= FIRST_PSEUDO_REGISTER)
  		{
! 		  delete_insn (insn);
  		  /* Delete it from the reload chain */
  		  if (chain->prev)
  		    chain->prev->next = next;
*************** reload_as_needed (live_known)
*** 3910,3918 ****
  		    {
  		      error_for_asm (insn,
  				     "`asm' operand requires impossible reload");
! 		      PUT_CODE (p, NOTE);
! 		      NOTE_SOURCE_FILE (p) = 0;
! 		      NOTE_LINE_NUMBER (p) = NOTE_INSN_DELETED;
  		    }
  	    }
  
--- 3906,3912 ----
  		    {
  		      error_for_asm (insn,
  				     "`asm' operand requires impossible reload");
! 		      delete_insn (p);
  		    }
  	    }
  
*************** delete_output_reload (insn, j, last_relo
*** 7671,7679 ****
  	      /* Some other ref remains; just delete the output reload we
  		 know to be dead.  */
  	      delete_address_reloads (output_reload_insn, insn);
! 	      PUT_CODE (output_reload_insn, NOTE);
! 	      NOTE_SOURCE_FILE (output_reload_insn) = 0;
! 	      NOTE_LINE_NUMBER (output_reload_insn) = NOTE_INSN_DELETED;
  	      return;
  	    }
  	}
--- 7665,7671 ----
  	      /* Some other ref remains; just delete the output reload we
  		 know to be dead.  */
  	      delete_address_reloads (output_reload_insn, insn);
! 	      delete_insn (output_reload_insn);
  	      return;
  	    }
  	}
*************** delete_output_reload (insn, j, last_relo
*** 7688,7696 ****
  	      delete_address_reloads (i2, insn);
  	      /* This might be a basic block head,
  		 thus don't use delete_insn.  */
! 	      PUT_CODE (i2, NOTE);
! 	      NOTE_SOURCE_FILE (i2) = 0;
! 	      NOTE_LINE_NUMBER (i2) = NOTE_INSN_DELETED;
  	    }
  	  if (GET_CODE (i2) == CODE_LABEL
  	      || GET_CODE (i2) == JUMP_INSN)
--- 7680,7686 ----
  	      delete_address_reloads (i2, insn);
  	      /* This might be a basic block head,
  		 thus don't use delete_insn.  */
! 	      delete_insn (i2);
  	    }
  	  if (GET_CODE (i2) == CODE_LABEL
  	      || GET_CODE (i2) == JUMP_INSN)
*************** delete_output_reload (insn, j, last_relo
*** 7703,7711 ****
        alter_reg (REGNO (reg), -1);
      }
    delete_address_reloads (output_reload_insn, insn);
!   PUT_CODE (output_reload_insn, NOTE);
!   NOTE_SOURCE_FILE (output_reload_insn) = 0;
!   NOTE_LINE_NUMBER (output_reload_insn) = NOTE_INSN_DELETED;
  
  }
  
--- 7693,7699 ----
        alter_reg (REGNO (reg), -1);
      }
    delete_address_reloads (output_reload_insn, insn);
!   delete_insn (output_reload_insn);
  
  }
  
*************** delete_address_reloads_1 (dead_insn, x, 
*** 7854,7863 ****
      }
    delete_address_reloads_1 (prev, SET_SRC (set), current_insn);
    reg_reloaded_contents[REGNO (dst)] = -1;
!   /* Can't use delete_insn here because PREV might be a basic block head.  */
!   PUT_CODE (prev, NOTE);
!   NOTE_LINE_NUMBER (prev) = NOTE_INSN_DELETED;
!   NOTE_SOURCE_FILE (prev) = 0;
  }
  
  /* Output reload-insns to reload VALUE into RELOADREG.
--- 7842,7848 ----
      }
    delete_address_reloads_1 (prev, SET_SRC (set), current_insn);
    reg_reloaded_contents[REGNO (dst)] = -1;
!   delete_insn (prev);
  }
  
  /* Output reload-insns to reload VALUE into RELOADREG.
*************** reload_cse_delete_noop_set (insn, value)
*** 8028,8038 ****
        REG_NOTES (insn) = NULL_RTX;
      }
    else
!     {
!       PUT_CODE (insn, NOTE);
!       NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
!       NOTE_SOURCE_FILE (insn) = 0;
!     }
  }
  
  /* See whether a single set SET is a noop.  */
--- 8013,8019 ----
        REG_NOTES (insn) = NULL_RTX;
      }
    else
!     delete_insn (insn);
  }
  
  /* See whether a single set SET is a noop.  */
*************** reload_combine ()
*** 8784,8792 ****
  		  rtx *np;
  
  		  /* Delete the reg-reg addition.  */
! 		  PUT_CODE (insn, NOTE);
! 		  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
! 		  NOTE_SOURCE_FILE (insn) = 0;
  
  		  if (reg_state[regno].offset != const0_rtx)
  		    /* Previous REG_EQUIV / REG_EQUAL notes for PREV
--- 8765,8771 ----
  		  rtx *np;
  
  		  /* Delete the reg-reg addition.  */
! 		  delete_insn (insn);
  
  		  if (reg_state[regno].offset != const0_rtx)
  		    /* Previous REG_EQUIV / REG_EQUAL notes for PREV
*************** reload_cse_move2add (first)
*** 9228,9241 ****
  			  = validate_change (next, &PATTERN (next),
  					     gen_add2_insn (reg, new_src), 0);
  		      if (success)
! 			{
! 			  /* INSN might be the first insn in a basic block
! 			     if the preceding insn is a conditional jump
! 			     or a possible-throwing call.  */
! 			  PUT_CODE (insn, NOTE);
! 			  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
! 			  NOTE_SOURCE_FILE (insn) = 0;
! 			}
  		      insn = next;
  		      reg_mode[regno] = GET_MODE (reg);
  		      reg_offset[regno] = sext_for_mode (GET_MODE (reg),
--- 9207,9213 ----
  			  = validate_change (next, &PATTERN (next),
  					     gen_add2_insn (reg, new_src), 0);
  		      if (success)
! 			delete_insn (insn);
  		      insn = next;
  		      reg_mode[regno] = GET_MODE (reg);
  		      reg_offset[regno] = sext_for_mode (GET_MODE (reg),
*** /p2/cfg9/egcs/gcc/sibcall.c	Thu Sep 20 18:33:14 2001
--- sibcall.c	Sat Sep 22 15:55:56 2001
*************** replace_call_placeholder (insn, use)
*** 554,562 ****
      LABEL_PRESERVE_P (XEXP (PATTERN (insn), 3)) = 0;
    
    /* "Delete" the placeholder insn.  */
!   PUT_CODE (insn, NOTE);
!   NOTE_SOURCE_FILE (insn) = 0;
!   NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
  }
  
  /* Given a (possibly empty) set of potential sibling or tail recursion call
--- 554,560 ----
      LABEL_PRESERVE_P (XEXP (PATTERN (insn), 3)) = 0;
    
    /* "Delete" the placeholder insn.  */
!   remove_insn (insn);
  }
  
  /* Given a (possibly empty) set of potential sibling or tail recursion call


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