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]
Other format: [Raw text]

Cleanup free_basic_block_vars, and use INSN_P in *_real_insn


Hi,

While browsing middle end source files, I noticed that
free_basic_block_vars doesn't do anything when keep_head_end_p
is set.  So we can remove a few useless calls.

Also, we can use INSN_P in {next,prev}_real_insn.

Bootstrapped on x86_64-unknown-linux-gnu, testing well
under way.  OK?

Gr.
Steven


	* basic-block.h (free_basic_block_vars): Update prototype.
	* flow.c (free_basic_block_vars): Remove the keep_head_end_p
	argument.
	(life_analysis): Update call.
	* ifcvt.c (if_convert): Likewise.
	* sibcall.c (optimize_sibling_and_tail_recursive_call): Likewise.
	* passes.c (rest_of_handle_final): Likewise.
	(rest_of_compilation): Likewise.
	* config/sh/sh.c (sh_output_mi_thunk): Likewise.

	* emit-rtl.c (next_real_insn): Use INSN_P.
	(prev_real_insn): Likewise.

Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.193
diff -c -3 -p -r1.193 basic-block.h
*** basic-block.h	9 Apr 2004 19:57:38 -0000	1.193
--- basic-block.h	4 May 2004 16:37:19 -0000
*************** extern void compute_bb_for_insn (void);
*** 363,369 ****
  extern void free_bb_for_insn (void);
  extern void update_bb_for_insn (basic_block);
  
! extern void free_basic_block_vars (int);
  
  extern void insert_insn_on_edge (rtx, edge);
  bool safe_insert_insn_on_edge (rtx, edge);
--- 363,369 ----
  extern void free_bb_for_insn (void);
  extern void update_bb_for_insn (basic_block);
  
! extern void free_basic_block_vars (void);
  
  extern void insert_insn_on_edge (rtx, edge);
  bool safe_insert_insn_on_edge (rtx, edge);
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.388
diff -c -3 -p -r1.388 emit-rtl.c
*** emit-rtl.c	5 Apr 2004 12:24:57 -0000	1.388
--- emit-rtl.c	4 May 2004 16:37:20 -0000
*************** next_real_insn (rtx insn)
*** 2960,2967 ****
    while (insn)
      {
        insn = NEXT_INSN (insn);
!       if (insn == 0 || GET_CODE (insn) == INSN
! 	  || GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN)
  	break;
      }
  
--- 2960,2966 ----
    while (insn)
      {
        insn = NEXT_INSN (insn);
!       if (insn == 0 || INSN_P (insn))
  	break;
      }
  
*************** prev_real_insn (rtx insn)
*** 2978,2985 ****
    while (insn)
      {
        insn = PREV_INSN (insn);
!       if (insn == 0 || GET_CODE (insn) == INSN || GET_CODE (insn) == CALL_INSN
! 	  || GET_CODE (insn) == JUMP_INSN)
  	break;
      }
  
--- 2977,2983 ----
    while (insn)
      {
        insn = PREV_INSN (insn);
!       if (insn == 0 || INSN_P (insn))
  	break;
      }
  
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.585
diff -c -3 -p -r1.585 flow.c
*** flow.c	30 Apr 2004 11:28:57 -0000	1.585
--- flow.c	4 May 2004 16:37:20 -0000
*************** life_analysis (rtx f, FILE *file, int fl
*** 488,495 ****
    if (file)
      dump_flow_info (file);
  
-   free_basic_block_vars (1);
- 
    /* Removing dead insns should have made jumptables really dead.  */
    delete_dead_jumptables ();
  }
--- 488,493 ----
*************** update_life_info_in_dirty_blocks (enum u
*** 809,836 ****
    return retval;
  }
  
! /* Free the variables allocated by find_basic_blocks.
! 
!    KEEP_HEAD_END_P is nonzero if basic_block_info is not to be freed.  */
  
  void
! free_basic_block_vars (int keep_head_end_p)
  {
!   if (! keep_head_end_p)
      {
!       if (basic_block_info)
! 	{
! 	  clear_edges ();
! 	  VARRAY_FREE (basic_block_info);
! 	}
!       n_basic_blocks = 0;
!       last_basic_block = 0;
! 
!       ENTRY_BLOCK_PTR->aux = NULL;
!       ENTRY_BLOCK_PTR->global_live_at_end = NULL;
!       EXIT_BLOCK_PTR->aux = NULL;
!       EXIT_BLOCK_PTR->global_live_at_start = NULL;
      }
  }
  
  /* Delete any insns that copy a register to itself.  */
--- 807,829 ----
    return retval;
  }
  
! /* Free the variables allocated by find_basic_blocks.  */
  
  void
! free_basic_block_vars (void)
  {
!   if (basic_block_info)
      {
!       clear_edges ();
!       VARRAY_FREE (basic_block_info);
      }
+   n_basic_blocks = 0;
+   last_basic_block = 0;
+ 
+   ENTRY_BLOCK_PTR->aux = NULL;
+   ENTRY_BLOCK_PTR->global_live_at_end = NULL;
+   EXIT_BLOCK_PTR->aux = NULL;
+   EXIT_BLOCK_PTR->global_live_at_start = NULL;
  }
  
  /* Delete any insns that copy a register to itself.  */
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.143
diff -c -3 -p -r1.143 ifcvt.c
*** ifcvt.c	9 Apr 2004 19:57:42 -0000	1.143
--- ifcvt.c	4 May 2004 16:37:21 -0000
*************** if_convert (int x_life_data_ok)
*** 3291,3300 ****
        && (!flag_reorder_blocks_and_partition || !no_new_pseudos))
      mark_loop_exit_edges ();
  
-   /* Free up basic_block_for_insn so that we don't have to keep it
-      up to date, either here or in merge_blocks.  */
-   free_basic_block_vars (1);
- 
    /* Compute postdominators if we think we'll use them.  */
    if (HAVE_conditional_execution || life_data_ok)
      calculate_dominance_info (CDI_POST_DOMINATORS);
--- 3291,3296 ----
Index: passes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/passes.c,v
retrieving revision 2.10
diff -c -3 -p -r2.10 passes.c
*** passes.c	9 Apr 2004 19:57:42 -0000	2.10
--- passes.c	4 May 2004 16:37:21 -0000
*************** rest_of_handle_final (tree decl, rtx ins
*** 465,471 ****
        fflush (asm_out_file);
  
      /* Release all memory allocated by flow.  */
!     free_basic_block_vars (0);
  
      /* Release all memory held by regsets now.  */
      regset_release_memory ();
--- 465,471 ----
        fflush (asm_out_file);
  
      /* Release all memory allocated by flow.  */
!     free_basic_block_vars ();
  
      /* Release all memory held by regsets now.  */
      regset_release_memory ();
*************** rest_of_compilation (tree decl)
*** 2095,2101 ****
    /* Show no temporary slots allocated.  */
    init_temp_slots ();
  
!   free_basic_block_vars (0);
    free_bb_for_insn ();
  
    timevar_pop (TV_FINAL);
--- 2095,2101 ----
    /* Show no temporary slots allocated.  */
    init_temp_slots ();
  
!   free_basic_block_vars ();
    free_bb_for_insn ();
  
    timevar_pop (TV_FINAL);
Index: sibcall.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sibcall.c,v
retrieving revision 1.47
diff -c -3 -p -r1.47 sibcall.c
*** sibcall.c	23 Feb 2004 17:02:50 -0000	1.47
--- sibcall.c	4 May 2004 16:37:21 -0000
*************** optimize_sibling_and_tail_recursive_call
*** 748,753 ****
      reorder_blocks ();
  
    /* This information will be invalid after inline expansion.  Kill it now.  */
!   free_basic_block_vars (0);
    free_EXPR_LIST_list (&tail_recursion_label_list);
  }
--- 748,753 ----
      reorder_blocks ();
  
    /* This information will be invalid after inline expansion.  Kill it now.  */
!   free_basic_block_vars ();
    free_EXPR_LIST_list (&tail_recursion_label_list);
  }
Index: config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.266
diff -c -3 -p -r1.266 sh.c
*** config/sh/sh.c	30 Apr 2004 16:27:30 -0000	1.266
--- config/sh/sh.c	4 May 2004 16:37:22 -0000
*************** sh_output_mi_thunk (FILE *file, tree thu
*** 9482,9488 ****
    if (optimize > 0 && flag_schedule_insns_after_reload)
      {
        /* Release all memory allocated by flow.  */
!       free_basic_block_vars (0);
  
        /* Release all memory held by regsets now.  */
        regset_release_memory ();
--- 9482,9488 ----
    if (optimize > 0 && flag_schedule_insns_after_reload)
      {
        /* Release all memory allocated by flow.  */
!       free_basic_block_vars ();
  
        /* Release all memory held by regsets now.  */
        regset_release_memory ();


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