[PATCH][3/n] Cleanup internal interfaces

Richard Guenther rguenther@suse.de
Thu Mar 29 13:50:00 GMT 2012


Some more stuff.  dse.c can probably be simplified with
dse_record_singleton_alias_set / dse_invalidate_singleton_alias_set
being removed.

LTO Bootstrapped on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2012-03-29  Richard Guenther  <rguenther@suse.de>

	* cgraph.h (cgraph_materialize_all_clones): Remove.
	(reset_inline_failed): Likewise.
	* cgraphunit.c (cgraph_materialize_all_clones): Make static.
	* cgraphbuild.c (reset_inline_failed): Remove.
	* rtl.h (cse_main): Remove.
	(extended_count): Likewise.
	* cse.c (dump_class): Mark as DEBUG_FUNCTION.
	(cse_main): Make static.
	* combine.c (extended_count): Remove.
	(dump_combine_stats): Mark as DEBUG_FUNCTION.
	* basic-block.h (reorder_basic_blocks): Remove.
	* bb-reorder.c (reorder_basic_blocks): Make static.
	* Makefile.in (dse.o): Remove dse.h dependency.
	* dse.h: Remove.
	* dse.c (gate_dse): Remove.
	(clear_alias_mode_eq): Likewise.
	(clear_alias_mode_hash): Likewise.
	(dse_record_singleton_alias_set): Likewise.
	(dse_invalidate_singleton_alias_set): Likewise.

Index: gcc/cgraph.h
===================================================================
*** gcc/cgraph.h	(revision 185957)
--- gcc/cgraph.h	(working copy)
*************** struct cgraph_2edge_hook_list *cgraph_ad
*** 613,625 ****
  void cgraph_remove_edge_duplication_hook (struct cgraph_2edge_hook_list *);
  struct cgraph_2node_hook_list *cgraph_add_node_duplication_hook (cgraph_2node_hook, void *);
  void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *);
- void cgraph_materialize_all_clones (void);
  gimple cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *);
  bool cgraph_propagate_frequency (struct cgraph_node *node);
  /* In cgraphbuild.c  */
  unsigned int rebuild_cgraph_edges (void);
  void cgraph_rebuild_references (void);
- void reset_inline_failed (struct cgraph_node *);
  int compute_call_stmt_bb_frequency (tree, basic_block bb);
  
  /* In ipa.c  */
--- 613,623 ----
Index: gcc/cgraphunit.c
===================================================================
*** gcc/cgraphunit.c	(revision 185957)
--- gcc/cgraphunit.c	(working copy)
*************** handle_alias_pairs (void)
*** 1294,1352 ****
  }
  
  
- /* Analyze the whole compilation unit once it is parsed completely.  */
- 
- void
- cgraph_finalize_compilation_unit (void)
- {
-   timevar_push (TV_CGRAPH);
- 
-   /* If LTO is enabled, initialize the streamer hooks needed by GIMPLE.  */
-   if (flag_lto)
-     lto_streamer_hooks_init ();
- 
-   /* If we're here there's no current function anymore.  Some frontends
-      are lazy in clearing these.  */
-   current_function_decl = NULL;
-   set_cfun (NULL);
- 
-   /* Do not skip analyzing the functions if there were errors, we
-      miss diagnostics for following functions otherwise.  */
- 
-   /* Emit size functions we didn't inline.  */
-   finalize_size_functions ();
- 
-   /* Mark alias targets necessary and emit diagnostics.  */
-   finish_aliases_1 ();
-   handle_alias_pairs ();
- 
-   if (!quiet_flag)
-     {
-       fprintf (stderr, "\nAnalyzing compilation unit\n");
-       fflush (stderr);
-     }
- 
-   if (flag_dump_passes)
-     dump_passes ();
- 
-   /* Gimplify and lower all functions, compute reachability and
-      remove unreachable nodes.  */
-   cgraph_analyze_functions ();
- 
-   /* Mark alias targets necessary and emit diagnostics.  */
-   finish_aliases_1 ();
-   handle_alias_pairs ();
- 
-   /* Gimplify and lower thunks.  */
-   cgraph_analyze_functions ();
- 
-   /* Finally drive the pass manager.  */
-   cgraph_optimize ();
- 
-   timevar_pop (TV_CGRAPH);
- }
- 
- 
  /* Figure out what functions we want to assemble.  */
  
  static void
--- 1294,1299 ----
*************** output_weakrefs (void)
*** 2134,2257 ****
  }
  
  
- /* Perform simple optimizations based on callgraph.  */
- 
- void
- cgraph_optimize (void)
- {
-   if (seen_error ())
-     return;
- 
- #ifdef ENABLE_CHECKING
-   verify_cgraph ();
- #endif
- 
-   /* Frontend may output common variables after the unit has been finalized.
-      It is safe to deal with them here as they are always zero initialized.  */
-   varpool_analyze_pending_decls ();
- 
-   timevar_push (TV_CGRAPHOPT);
-   if (pre_ipa_mem_report)
-     {
-       fprintf (stderr, "Memory consumption before IPA\n");
-       dump_memory_report (false);
-     }
-   if (!quiet_flag)
-     fprintf (stderr, "Performing interprocedural optimizations\n");
-   cgraph_state = CGRAPH_STATE_IPA;
- 
-   /* Don't run the IPA passes if there was any error or sorry messages.  */
-   if (!seen_error ())
-     ipa_passes ();
- 
-   /* Do nothing else if any IPA pass found errors or if we are just streaming LTO.  */
-   if (seen_error ()
-       || (!in_lto_p && flag_lto && !flag_fat_lto_objects))
-     {
-       timevar_pop (TV_CGRAPHOPT);
-       return;
-     }
- 
-   /* This pass remove bodies of extern inline functions we never inlined.
-      Do this later so other IPA passes see what is really going on.  */
-   cgraph_remove_unreachable_nodes (false, dump_file);
-   cgraph_global_info_ready = true;
-   if (cgraph_dump_file)
-     {
-       fprintf (cgraph_dump_file, "Optimized ");
-       dump_cgraph (cgraph_dump_file);
-       dump_varpool (cgraph_dump_file);
-     }
-   if (post_ipa_mem_report)
-     {
-       fprintf (stderr, "Memory consumption after IPA\n");
-       dump_memory_report (false);
-     }
-   timevar_pop (TV_CGRAPHOPT);
- 
-   /* Output everything.  */
-   (*debug_hooks->assembly_start) ();
-   if (!quiet_flag)
-     fprintf (stderr, "Assembling functions:\n");
- #ifdef ENABLE_CHECKING
-   verify_cgraph ();
- #endif
- 
-   cgraph_materialize_all_clones ();
-   bitmap_obstack_initialize (NULL);
-   execute_ipa_pass_list (all_late_ipa_passes);
-   cgraph_remove_unreachable_nodes (true, dump_file);
- #ifdef ENABLE_CHECKING
-   verify_cgraph ();
- #endif
-   bitmap_obstack_release (NULL);
-   cgraph_mark_functions_to_output ();
-   output_weakrefs ();
- 
-   cgraph_state = CGRAPH_STATE_EXPANSION;
-   if (!flag_toplevel_reorder)
-     cgraph_output_in_order ();
-   else
-     {
-       cgraph_output_pending_asms ();
- 
-       cgraph_expand_all_functions ();
-       varpool_remove_unreferenced_decls ();
- 
-       varpool_assemble_pending_decls ();
-     }
- 
-   cgraph_process_new_functions ();
-   cgraph_state = CGRAPH_STATE_FINISHED;
- 
-   if (cgraph_dump_file)
-     {
-       fprintf (cgraph_dump_file, "\nFinal ");
-       dump_cgraph (cgraph_dump_file);
-       dump_varpool (cgraph_dump_file);
-     }
- #ifdef ENABLE_CHECKING
-   verify_cgraph ();
-   /* Double check that all inline clones are gone and that all
-      function bodies have been released from memory.  */
-   if (!seen_error ())
-     {
-       struct cgraph_node *node;
-       bool error_found = false;
- 
-       for (node = cgraph_nodes; node; node = node->next)
- 	if (node->analyzed
- 	    && (node->global.inlined_to
- 		|| gimple_has_body_p (node->decl)))
- 	  {
- 	    error_found = true;
- 	    dump_cgraph_node (stderr, node);
- 	  }
-       if (error_found)
- 	internal_error ("nodes with unreleased memory found");
-     }
- #endif
- }
  
  void
  init_cgraph (void)
--- 2081,2086 ----
*************** cgraph_redirect_edge_call_stmt_to_callee
*** 2549,2555 ****
     bring all functions to memory prior compilation, but current WHOPR
     implementation does that and it is is bit easier to keep everything right in
     this order.  */
! void
  cgraph_materialize_all_clones (void)
  {
    struct cgraph_node *node;
--- 2378,2384 ----
     bring all functions to memory prior compilation, but current WHOPR
     implementation does that and it is is bit easier to keep everything right in
     this order.  */
! static void
  cgraph_materialize_all_clones (void)
  {
    struct cgraph_node *node;
*************** cgraph_materialize_all_clones (void)
*** 2628,2631 ****
--- 2457,2634 ----
    cgraph_remove_unreachable_nodes (false, cgraph_dump_file);
  }
  
+ 
+ /* Perform simple optimizations based on callgraph.  */
+ 
+ void
+ cgraph_optimize (void)
+ {
+   if (seen_error ())
+     return;
+ 
+ #ifdef ENABLE_CHECKING
+   verify_cgraph ();
+ #endif
+ 
+   /* Frontend may output common variables after the unit has been finalized.
+      It is safe to deal with them here as they are always zero initialized.  */
+   varpool_analyze_pending_decls ();
+ 
+   timevar_push (TV_CGRAPHOPT);
+   if (pre_ipa_mem_report)
+     {
+       fprintf (stderr, "Memory consumption before IPA\n");
+       dump_memory_report (false);
+     }
+   if (!quiet_flag)
+     fprintf (stderr, "Performing interprocedural optimizations\n");
+   cgraph_state = CGRAPH_STATE_IPA;
+ 
+   /* Don't run the IPA passes if there was any error or sorry messages.  */
+   if (!seen_error ())
+     ipa_passes ();
+ 
+   /* Do nothing else if any IPA pass found errors or if we are just streaming LTO.  */
+   if (seen_error ()
+       || (!in_lto_p && flag_lto && !flag_fat_lto_objects))
+     {
+       timevar_pop (TV_CGRAPHOPT);
+       return;
+     }
+ 
+   /* This pass remove bodies of extern inline functions we never inlined.
+      Do this later so other IPA passes see what is really going on.  */
+   cgraph_remove_unreachable_nodes (false, dump_file);
+   cgraph_global_info_ready = true;
+   if (cgraph_dump_file)
+     {
+       fprintf (cgraph_dump_file, "Optimized ");
+       dump_cgraph (cgraph_dump_file);
+       dump_varpool (cgraph_dump_file);
+     }
+   if (post_ipa_mem_report)
+     {
+       fprintf (stderr, "Memory consumption after IPA\n");
+       dump_memory_report (false);
+     }
+   timevar_pop (TV_CGRAPHOPT);
+ 
+   /* Output everything.  */
+   (*debug_hooks->assembly_start) ();
+   if (!quiet_flag)
+     fprintf (stderr, "Assembling functions:\n");
+ #ifdef ENABLE_CHECKING
+   verify_cgraph ();
+ #endif
+ 
+   cgraph_materialize_all_clones ();
+   bitmap_obstack_initialize (NULL);
+   execute_ipa_pass_list (all_late_ipa_passes);
+   cgraph_remove_unreachable_nodes (true, dump_file);
+ #ifdef ENABLE_CHECKING
+   verify_cgraph ();
+ #endif
+   bitmap_obstack_release (NULL);
+   cgraph_mark_functions_to_output ();
+   output_weakrefs ();
+ 
+   cgraph_state = CGRAPH_STATE_EXPANSION;
+   if (!flag_toplevel_reorder)
+     cgraph_output_in_order ();
+   else
+     {
+       cgraph_output_pending_asms ();
+ 
+       cgraph_expand_all_functions ();
+       varpool_remove_unreferenced_decls ();
+ 
+       varpool_assemble_pending_decls ();
+     }
+ 
+   cgraph_process_new_functions ();
+   cgraph_state = CGRAPH_STATE_FINISHED;
+ 
+   if (cgraph_dump_file)
+     {
+       fprintf (cgraph_dump_file, "\nFinal ");
+       dump_cgraph (cgraph_dump_file);
+       dump_varpool (cgraph_dump_file);
+     }
+ #ifdef ENABLE_CHECKING
+   verify_cgraph ();
+   /* Double check that all inline clones are gone and that all
+      function bodies have been released from memory.  */
+   if (!seen_error ())
+     {
+       struct cgraph_node *node;
+       bool error_found = false;
+ 
+       for (node = cgraph_nodes; node; node = node->next)
+ 	if (node->analyzed
+ 	    && (node->global.inlined_to
+ 		|| gimple_has_body_p (node->decl)))
+ 	  {
+ 	    error_found = true;
+ 	    dump_cgraph_node (stderr, node);
+ 	  }
+       if (error_found)
+ 	internal_error ("nodes with unreleased memory found");
+     }
+ #endif
+ }
+ 
+ 
+ /* Analyze the whole compilation unit once it is parsed completely.  */
+ 
+ void
+ cgraph_finalize_compilation_unit (void)
+ {
+   timevar_push (TV_CGRAPH);
+ 
+   /* If LTO is enabled, initialize the streamer hooks needed by GIMPLE.  */
+   if (flag_lto)
+     lto_streamer_hooks_init ();
+ 
+   /* If we're here there's no current function anymore.  Some frontends
+      are lazy in clearing these.  */
+   current_function_decl = NULL;
+   set_cfun (NULL);
+ 
+   /* Do not skip analyzing the functions if there were errors, we
+      miss diagnostics for following functions otherwise.  */
+ 
+   /* Emit size functions we didn't inline.  */
+   finalize_size_functions ();
+ 
+   /* Mark alias targets necessary and emit diagnostics.  */
+   finish_aliases_1 ();
+   handle_alias_pairs ();
+ 
+   if (!quiet_flag)
+     {
+       fprintf (stderr, "\nAnalyzing compilation unit\n");
+       fflush (stderr);
+     }
+ 
+   if (flag_dump_passes)
+     dump_passes ();
+ 
+   /* Gimplify and lower all functions, compute reachability and
+      remove unreachable nodes.  */
+   cgraph_analyze_functions ();
+ 
+   /* Mark alias targets necessary and emit diagnostics.  */
+   finish_aliases_1 ();
+   handle_alias_pairs ();
+ 
+   /* Gimplify and lower thunks.  */
+   cgraph_analyze_functions ();
+ 
+   /* Finally drive the pass manager.  */
+   cgraph_optimize ();
+ 
+   timevar_pop (TV_CGRAPH);
+ }
+ 
+ 
  #include "gt-cgraphunit.h"
Index: gcc/cgraphbuild.c
===================================================================
*** gcc/cgraphbuild.c	(revision 185957)
--- gcc/cgraphbuild.c	(working copy)
*************** record_eh_tables (struct cgraph_node *no
*** 200,219 ****
      }
  }
  
- /* Reset inlining information of all incoming call edges of NODE.  */
- 
- void
- reset_inline_failed (struct cgraph_node *node)
- {
-   struct cgraph_edge *e;
- 
-   for (e = node->callers; e; e = e->next_caller)
-     {
-       e->callee->global.inlined_to = NULL;
-       initialize_inline_failed (e);
-     }
- }
- 
  /* Computes the frequency of the call statement so that it can be stored in
     cgraph_edge.  BB is the basic block of the call statement.  */
  int
--- 200,205 ----
Index: gcc/rtl.h
===================================================================
*** gcc/rtl.h	(revision 185957)
--- gcc/rtl.h	(working copy)
*************** extern int rtx_to_tree_code (enum rtx_co
*** 2373,2379 ****
  
  /* In cse.c */
  extern int delete_trivially_dead_insns (rtx, int);
- extern int cse_main (rtx, int);
  extern int exp_equiv_p (const_rtx, const_rtx, int, bool);
  extern unsigned hash_rtx (const_rtx x, enum machine_mode, int *, int *, bool);
  
--- 2373,2378 ----
*************** extern bool validate_subreg (enum machin
*** 2456,2462 ****
  			     const_rtx, unsigned int);
  
  /* In combine.c  */
- extern unsigned int extended_count (const_rtx, enum machine_mode, int);
  extern rtx remove_death (unsigned int, rtx);
  extern void dump_combine_stats (FILE *);
  extern void dump_combine_total_stats (FILE *);
--- 2455,2460 ----
Index: gcc/cse.c
===================================================================
*** gcc/cse.c	(revision 185957)
--- gcc/cse.c	(working copy)
*************** fixed_base_plus_p (rtx x)
*** 653,659 ****
  
  /* Dump the expressions in the equivalence class indicated by CLASSP.
     This function is used only for debugging.  */
! void
  dump_class (struct table_elt *classp)
  {
    struct table_elt *elt;
--- 653,659 ----
  
  /* Dump the expressions in the equivalence class indicated by CLASSP.
     This function is used only for debugging.  */
! DEBUG_FUNCTION void
  dump_class (struct table_elt *classp)
  {
    struct table_elt *elt;
*************** cse_extended_basic_block (struct cse_bas
*** 6519,6525 ****
     Return 1 if the CFG should be cleaned up because it has been modified.
     Return 0 otherwise.  */
  
! int
  cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
  {
    struct cse_basic_block_data ebb_data;
--- 6519,6525 ----
     Return 1 if the CFG should be cleaned up because it has been modified.
     Return 0 otherwise.  */
  
! static int
  cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
  {
    struct cse_basic_block_data ebb_data;
Index: gcc/combine.c
===================================================================
*** gcc/combine.c	(revision 185957)
--- gcc/combine.c	(working copy)
*************** reg_num_sign_bit_copies_for_combine (con
*** 9674,9704 ****
    return NULL;
  }
  
- /* Return the number of "extended" bits there are in X, when interpreted
-    as a quantity in MODE whose signedness is indicated by UNSIGNEDP.  For
-    unsigned quantities, this is the number of high-order zero bits.
-    For signed quantities, this is the number of copies of the sign bit
-    minus 1.  In both case, this function returns the number of "spare"
-    bits.  For example, if two quantities for which this function returns
-    at least 1 are added, the addition is known not to overflow.
- 
-    This function will always return 0 unless called during combine, which
-    implies that it must be called from a define_split.  */
- 
- unsigned int
- extended_count (const_rtx x, enum machine_mode mode, int unsignedp)
- {
-   if (nonzero_sign_valid == 0)
-     return 0;
- 
-   return (unsignedp
- 	  ? (HWI_COMPUTABLE_MODE_P (mode)
- 	     ? (unsigned int) (GET_MODE_PRECISION (mode) - 1
- 			       - floor_log2 (nonzero_bits (x, mode)))
- 	     : 0)
- 	  : num_sign_bit_copies (x, mode) - 1);
- }
- 
  /* This function is called from `simplify_shift_const' to merge two
     outer operations.  Specifically, we have already found that we need
     to perform operation *POP0 with constant *PCONST0 at the outermost
--- 9674,9679 ----
*************** unmentioned_reg_p (rtx equiv, rtx expr)
*** 13912,13918 ****
    return for_each_rtx (&equiv, unmentioned_reg_p_1, expr);
  }
  
! void
  dump_combine_stats (FILE *file)
  {
    fprintf
--- 13887,13893 ----
    return for_each_rtx (&equiv, unmentioned_reg_p_1, expr);
  }
  
! DEBUG_FUNCTION void
  dump_combine_stats (FILE *file)
  {
    fprintf
Index: gcc/basic-block.h
===================================================================
*** gcc/basic-block.h	(revision 185957)
--- gcc/basic-block.h	(working copy)
*************** extern bool inside_basic_block_p (const_
*** 830,838 ****
  extern bool control_flow_insn_p (const_rtx);
  extern rtx get_last_bb_insn (basic_block);
  
- /* In bb-reorder.c */
- extern void reorder_basic_blocks (void);
- 
  /* In dominance.c */
  
  enum cdi_direction
--- 830,835 ----
Index: gcc/bb-reorder.c
===================================================================
*** gcc/bb-reorder.c	(revision 185957)
--- gcc/bb-reorder.c	(working copy)
*************** verify_hot_cold_block_grouping (void)
*** 1903,1909 ****
  /* Reorder basic blocks.  The main entry point to this file.  FLAGS is
     the set of flags to pass to cfg_layout_initialize().  */
  
! void
  reorder_basic_blocks (void)
  {
    int n_traces;
--- 1903,1909 ----
  /* Reorder basic blocks.  The main entry point to this file.  FLAGS is
     the set of flags to pass to cfg_layout_initialize().  */
  
! static void
  reorder_basic_blocks (void)
  {
    int n_traces;
Index: gcc/Makefile.in
===================================================================
*** gcc/Makefile.in	(revision 185957)
--- gcc/Makefile.in	(working copy)
*************** dce.o : dce.c $(CONFIG_H) $(SYSTEM_H) co
*** 3011,3017 ****
  dse.o : dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     $(TREE_H) $(TM_P_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
     $(RECOG_H) $(EXPR_H) $(DF_H) cselib.h $(DBGCNT_H) $(TIMEVAR_H) \
!    $(TREE_PASS_H) alloc-pool.h $(ALIAS_H) dse.h $(OPTABS_H) $(TARGET_H) \
     $(BITMAP_H) $(PARAMS_H)
  fwprop.o : fwprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     $(DIAGNOSTIC_CORE_H) insn-config.h $(RECOG_H) $(FLAGS_H) $(OBSTACK_H) $(BASIC_BLOCK_H) \
--- 3011,3017 ----
  dse.o : dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     $(TREE_H) $(TM_P_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
     $(RECOG_H) $(EXPR_H) $(DF_H) cselib.h $(DBGCNT_H) $(TIMEVAR_H) \
!    $(TREE_PASS_H) alloc-pool.h $(ALIAS_H) $(OPTABS_H) $(TARGET_H) \
     $(BITMAP_H) $(PARAMS_H)
  fwprop.o : fwprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     $(DIAGNOSTIC_CORE_H) insn-config.h $(RECOG_H) $(FLAGS_H) $(OBSTACK_H) $(BASIC_BLOCK_H) \
Index: gcc/dse.c
===================================================================
*** gcc/dse.c	(revision 185957)
--- gcc/dse.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 44,50 ****
  #include "insn-config.h"
  #include "expr.h"
  #include "recog.h"
- #include "dse.h"
  #include "optabs.h"
  #include "dbgcnt.h"
  #include "target.h"
--- 44,49 ----
*************** static bitmap kill_on_calls;
*** 614,620 ****
  static unsigned int current_position;
  
  
- static bool gate_dse (void);
  static bool gate_dse1 (void);
  static bool gate_dse2 (void);
  
--- 613,618 ----
*************** static bool gate_dse2 (void);
*** 625,652 ****
     Initialization.
  ----------------------------------------------------------------------------*/
  
- /* Hashtable callbacks for maintaining the "bases" field of
-    store_group_info, given that the addresses are function invariants.  */
- 
- static int
- clear_alias_mode_eq (const void *p1, const void *p2)
- {
-   const struct clear_alias_mode_holder * h1
-     = (const struct clear_alias_mode_holder *) p1;
-   const struct clear_alias_mode_holder * h2
-     = (const struct clear_alias_mode_holder *) p2;
-   return h1->alias_set == h2->alias_set;
- }
- 
- 
- static hashval_t
- clear_alias_mode_hash (const void *p)
- {
-   const struct clear_alias_mode_holder *holder
-     = (const struct clear_alias_mode_holder *) p;
-   return holder->alias_set;
- }
- 
  
  /* Find the entry associated with ALIAS_SET.  */
  
--- 623,628 ----
*************** dse_step2_spill (void)
*** 3044,3128 ****
  ----------------------------------------------------------------------------*/
  
  
- /* Note that this is NOT a general purpose function.  Any mem that has
-    an alias set registered here expected to be COMPLETELY unaliased:
-    i.e it's addresses are not and need not be examined.
- 
-    It is known that all references to this address will have this
-    alias set and there are NO other references to this address in the
-    function.
- 
-    Currently the only place that is known to be clean enough to use
-    this interface is the code that assigns the spill locations.
- 
-    All of the mems that have alias_sets registered are subjected to a
-    very powerful form of dse where function calls, volatile reads and
-    writes, and reads from random location are not taken into account.
- 
-    It is also assumed that these locations go dead when the function
-    returns.  This assumption could be relaxed if there were found to
-    be places that this assumption was not correct.
- 
-    The MODE is passed in and saved.  The mode of each load or store to
-    a mem with ALIAS_SET is checked against MEM.  If the size of that
-    load or store is different from MODE, processing is halted on this
-    alias set.  For the vast majority of aliases sets, all of the loads
-    and stores will use the same mode.  But vectors are treated
-    differently: the alias set is established for the entire vector,
-    but reload will insert loads and stores for individual elements and
-    we do not necessarily have the information to track those separate
-    elements.  So when we see a mode mismatch, we just bail.  */
- 
- 
- void
- dse_record_singleton_alias_set (alias_set_type alias_set,
- 				enum machine_mode mode)
- {
-   struct clear_alias_mode_holder tmp_holder;
-   struct clear_alias_mode_holder *entry;
-   void **slot;
- 
-   /* If we are not going to run dse, we need to return now or there
-      will be problems with allocating the bitmaps.  */
-   if ((!gate_dse()) || !alias_set)
-     return;
- 
-   if (!clear_alias_sets)
-     {
-       clear_alias_sets = BITMAP_ALLOC (NULL);
-       disqualified_clear_alias_sets = BITMAP_ALLOC (NULL);
-       clear_alias_mode_table = htab_create (11, clear_alias_mode_hash,
- 					    clear_alias_mode_eq, NULL);
-       clear_alias_mode_pool = create_alloc_pool ("clear_alias_mode_pool",
- 						 sizeof (struct clear_alias_mode_holder), 100);
-     }
- 
-   bitmap_set_bit (clear_alias_sets, alias_set);
- 
-   tmp_holder.alias_set = alias_set;
- 
-   slot = htab_find_slot (clear_alias_mode_table, &tmp_holder, INSERT);
-   gcc_assert (*slot == NULL);
- 
-   *slot = entry =
-     (struct clear_alias_mode_holder *) pool_alloc (clear_alias_mode_pool);
-   entry->alias_set = alias_set;
-   entry->mode = mode;
- }
- 
- 
- /* Remove ALIAS_SET from the sets of stack slots being considered.  */
- 
- void
- dse_invalidate_singleton_alias_set (alias_set_type alias_set)
- {
-   if ((!gate_dse()) || !alias_set)
-     return;
- 
-   bitmap_clear_bit (clear_alias_sets, alias_set);
- }
- 
- 
  /* Look up the bitmap index for OFFSET in GROUP_INFO.  If it is not
     there, return 0.  */
  
--- 3020,3025 ----
*************** rest_of_handle_dse (void)
*** 4015,4026 ****
  }
  
  static bool
- gate_dse (void)
- {
-   return gate_dse1 () || gate_dse2 ();
- }
- 
- static bool
  gate_dse1 (void)
  {
    return optimize > 0 && flag_dse
--- 3912,3917 ----
Index: gcc/dse.h
===================================================================
*** gcc/dse.h	(revision 185957)
--- gcc/dse.h	(working copy)
***************
*** 1,30 ****
- /* RTL dead store elimination.
-    Copyright (C) 2007, 2010 Free Software Foundation, Inc.
- 
-    Contributed by Richard Sandiford <rsandifor@codesourcery.com>
-    and Kenneth Zadeck <zadeck@naturalbridge.com>
- 
- This file is part of GCC.
- 
- GCC is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 3, or (at your option) any later
- version.
- 
- GCC is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-  for more details.
- 
- You should have received a copy of the GNU General Public License
- along with GCC; see the file COPYING3.  If not see
- <http://www.gnu.org/licenses/>.  */
- 
- #ifndef GCC_DSE_H
- #define GCC_DSE_H
- 
- extern void dse_record_singleton_alias_set (alias_set_type, enum machine_mode);
- extern void dse_invalidate_singleton_alias_set (alias_set_type);
- 
- #endif /* GCC_DSE_H */
- 
--- 0 ----



More information about the Gcc-patches mailing list