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]

Re: [PATCH] [CLEANUP] Wrap locally-used functions in anonymous namespaces


On Mon, Apr 14, 2014 at 4:51 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
> Hi everyone,
>
> This patch wraps a bunch of locally-used, non-debug functions in an
> anonymous namespace.  These functions can't simply be marked as "static"
> because they are used as template arguments to hash_table::traverse, and
> the C++98 standard does not allow non-extern variables to be used as
> template arguments.  The next best thing to marking them static is to
> define each of these functions inside an anonymous namespace.

Hum, the formatting used looks super-ugly.  I suppose a local visibility
attribute would work as well?  (well, what's the goal of the patch?)

Thanks,
Richard.


> I bootstrapped and regtested this change on x86_64-unknown-linux-gnu.
>
> 2014-04-11  Patrick Palka  <patrick@parcs.ath.cx>
>
>         * alloc-pool.c (print_alloc_pool_statistics): Wrap in an
>         anonymous namespace.
>         * bitmap.c (print_statistics): Likewise.
>         * cselib.c (preserve_constants_and_equivs, discard_useless_locs,
>         discard_useless_values, dump_cselib_val): Likewise.
>         * dwarf2out.c (dwarf2_build_local_stub): Likewise.
>         * ggc-common.c (ggc_call_count, ggc_call_alloc, ggc_prune_ptr,
>         ggc_add_statistics): Likewise.
>         * gimple-ssa-strength-reduction.c (ssa_base_cand_dump_callback):
>         Likewise.
>         * haifa-sched.c (haifa_htab_i{1,2}_traverse): Likewise.
>         * passes.c (passes_pass_traverse): Likewise.
>         * postreload-gcse.c (dump_expr_hash_table_entry,
>         delete_redundant_insns_1): Likewise.
>         * sese.c (debug_rename_map_1): Likewise.
>         * statistics.c (statistics_fini_pass_{1,2,3},
>         statistics_fini_1): Likewise
>         * tree-into-ssa.c (debug_var_infos_r): Likewise.
>         * tree-parloops.c (initialize_reductions,
>         add_field_for_reduction, add_field_for_name,
>         create_phi_for_local_result, create_call_for_reduction_1,
>         create_loads_for_reductions, create_stores_for_reduction,
>         create_loads_and_stores_for_name, set_reduc_phi_uids): Likewise.
>         * tree-ssa-threadupdate.c (ssa_create_duplicates,
>         ssa_redirect_edges):  Likewise.
>         * var-tracking.c (drop_overlapping_mem_locs,
>         canonicalize_loc_order_check, canonicalize_values_mark,
>         canonicalize_values_star, canonicalize_vars_star,
>         variable_post_merge_new_vals, variable_post_merge_perm_vals,
>         dataflow_set_preserve_mem_locs, dataflow_set_remove_mem_locs,
>         dump_var_tracking_slot, emit_not_insn_var_location,
>         var_track_values_to_stack, emit_notes_for_differences_{1,2}):
>         Likewise.
> ---
>  gcc/alloc-pool.c                    |  2 ++
>  gcc/bitmap.c                        |  2 ++
>  gcc/cselib.c                        |  8 ++++++++
>  gcc/dwarf2out.c                     |  2 ++
>  gcc/ggc-common.c                    |  9 +++++++++
>  gcc/gimple-ssa-strength-reduction.c |  2 ++
>  gcc/haifa-sched.c                   |  4 ++++
>  gcc/passes.c                        |  2 ++
>  gcc/postreload-gcse.c               |  4 ++++
>  gcc/sese.c                          |  4 +++-
>  gcc/statistics.c                    |  8 ++++++++
>  gcc/tree-into-ssa.c                 |  2 ++
>  gcc/tree-parloops.c                 | 18 ++++++++++++++++++
>  gcc/tree-ssa-threadupdate.c         |  4 ++++
>  gcc/var-tracking.c                  | 29 +++++++++++++++++++++++++++++
>  15 files changed, 99 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c
> index dfb13ce..999032d 100644
> --- a/gcc/alloc-pool.c
> +++ b/gcc/alloc-pool.c
> @@ -376,6 +376,7 @@ struct output_info
>
>  /* Called via hash_table.traverse.  Output alloc_pool descriptor pointed out by
>     SLOT and update statistics.  */
> +namespace {
>  int
>  print_alloc_pool_statistics (alloc_pool_descriptor **slot,
>                              struct output_info *i)
> @@ -394,6 +395,7 @@ print_alloc_pool_statistics (alloc_pool_descriptor **slot,
>      }
>    return 1;
>  }
> +}
>
>  /* Output per-alloc_pool memory usage statistics.  */
>  void
> diff --git a/gcc/bitmap.c b/gcc/bitmap.c
> index 4855a66..62696b1 100644
> --- a/gcc/bitmap.c
> +++ b/gcc/bitmap.c
> @@ -2150,6 +2150,7 @@ struct output_info
>
>  /* Called via hash_table::traverse.  Output bitmap descriptor pointed out by
>     SLOT and update statistics.  */
> +namespace {
>  int
>  print_statistics (bitmap_descriptor_d **slot, output_info *i)
>  {
> @@ -2177,6 +2178,7 @@ print_statistics (bitmap_descriptor_d **slot, output_info *i)
>      }
>    return 1;
>  }
> +}
>
>  /* Output per-bitmap memory usage statistics.  */
>  void
> diff --git a/gcc/cselib.c b/gcc/cselib.c
> index 7918b2b..0633965 100644
> --- a/gcc/cselib.c
> +++ b/gcc/cselib.c
> @@ -491,6 +491,7 @@ invariant_or_equiv_p (cselib_val *v)
>  /* Remove from hash table all VALUEs except constants, function
>     invariants and VALUE equivalences.  */
>
> +namespace {
>  int
>  preserve_constants_and_equivs (cselib_val **x, void *info ATTRIBUTE_UNUSED)
>  {
> @@ -509,6 +510,7 @@ preserve_constants_and_equivs (cselib_val **x, void *info ATTRIBUTE_UNUSED)
>
>    return 1;
>  }
> +}
>
>  /* Remove all entries from the hash table, arranging for the next
>     value to be numbered NUM.  */
> @@ -625,6 +627,7 @@ references_value_p (const_rtx x, int only_useless)
>     values (i.e. values without any location).  Called through
>     htab_traverse.  */
>
> +namespace {
>  int
>  discard_useless_locs (cselib_val **x, void *info ATTRIBUTE_UNUSED)
>  {
> @@ -651,9 +654,11 @@ discard_useless_locs (cselib_val **x, void *info ATTRIBUTE_UNUSED)
>      }
>    return 1;
>  }
> +}
>
>  /* If X is a value with no locations, remove it from the hashtable.  */
>
> +namespace {
>  int
>  discard_useless_values (cselib_val **x, void *info ATTRIBUTE_UNUSED)
>  {
> @@ -672,6 +677,7 @@ discard_useless_values (cselib_val **x, void *info ATTRIBUTE_UNUSED)
>
>    return 1;
>  }
> +}
>
>  /* Clean out useless values (i.e. those which no longer have locations
>     associated with them) from the hash table.  */
> @@ -2791,6 +2797,7 @@ cselib_finish (void)
>
>  /* Dump the cselib_val *X to FILE *OUT.  */
>
> +namespace {
>  int
>  dump_cselib_val (cselib_val **x, FILE *out)
>  {
> @@ -2862,6 +2869,7 @@ dump_cselib_val (cselib_val **x, FILE *out)
>
>    return 1;
>  }
> +}
>
>  /* Dump to OUT everything in the CSELIB table.  */
>
> diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
> index 90f1553..0316b84 100644
> --- a/gcc/dwarf2out.c
> +++ b/gcc/dwarf2out.c
> @@ -7578,6 +7578,7 @@ optimize_external_refs_1 (dw_die_ref die, external_ref_hash_type map)
>     points to an external_ref, DATA is the CU we're processing.  If we don't
>     already have a local stub, and we have multiple refs, build a stub.  */
>
> +namespace {
>  int
>  dwarf2_build_local_stub (external_ref **slot, dw_die_ref data)
>  {
> @@ -7610,6 +7611,7 @@ dwarf2_build_local_stub (external_ref **slot, dw_die_ref data)
>      }
>    return 1;
>  }
> +}
>
>  /* DIE is a unit; look through all the DIE references to see if there are
>     any external references to types, and if so, create local stubs for
> diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
> index 97c9b87..b4a1bd1 100644
> --- a/gcc/ggc-common.c
> +++ b/gcc/ggc-common.c
> @@ -383,6 +383,7 @@ struct traversal_state
>
>  /* Callbacks for htab_traverse.  */
>
> +namespace {
>  int
>  ggc_call_count (ptr_data **slot, traversal_state *state)
>  {
> @@ -393,7 +394,9 @@ ggc_call_count (ptr_data **slot, traversal_state *state)
>    state->count++;
>    return 1;
>  }
> +}
>
> +namespace {
>  int
>  ggc_call_alloc (ptr_data **slot, traversal_state *state)
>  {
> @@ -404,6 +407,7 @@ ggc_call_alloc (ptr_data **slot, traversal_state *state)
>    state->ptrs[state->ptrs_i++] = d;
>    return 1;
>  }
> +}
>
>  /* Callback for qsort.  */
>
> @@ -1020,6 +1024,7 @@ ggc_record_overhead (size_t allocated, size_t overhead, void *ptr,
>
>  /* Helper function for prune_overhead_list.  See if SLOT is still marked and
>     remove it from hashtable if it is not.  */
> +namespace {
>  int
>  ggc_prune_ptr (ptr_hash_entry **slot, void *b ATTRIBUTE_UNUSED)
>  {
> @@ -1032,6 +1037,7 @@ ggc_prune_ptr (ptr_hash_entry **slot, void *b ATTRIBUTE_UNUSED)
>      }
>    return 1;
>  }
> +}
>
>  /* After live values has been marked, walk all recorded pointers and see if
>     they are still live.  */
> @@ -1094,6 +1100,8 @@ cmp_statistic (const void *loc1, const void *loc2)
>
>  /* Collect array of the descriptors from hashtable.  */
>  static struct loc_descriptor **loc_array;
> +
> +namespace {
>  int
>  ggc_add_statistics (loc_descriptor **slot, int *n)
>  {
> @@ -1101,6 +1109,7 @@ ggc_add_statistics (loc_descriptor **slot, int *n)
>    (*n)++;
>    return 1;
>  }
> +}
>
>  /* Dump per-site memory statistics.  */
>
> diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
> index 9ad1b4f..b528f39 100644
> --- a/gcc/gimple-ssa-strength-reduction.c
> +++ b/gcc/gimple-ssa-strength-reduction.c
> @@ -1827,6 +1827,7 @@ dump_cand_vec (void)
>
>  /* Callback used to dump the candidate chains hash table.  */
>
> +namespace {
>  int
>  ssa_base_cand_dump_callback (cand_chain **slot, void *ignored ATTRIBUTE_UNUSED)
>  {
> @@ -1842,6 +1843,7 @@ ssa_base_cand_dump_callback (cand_chain **slot, void *ignored ATTRIBUTE_UNUSED)
>    fputs ("\n", dump_file);
>    return 1;
>  }
> +}
>
>  /* Dump the candidate chains.  */
>
> diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
> index 2d66e5c..7f8480d 100644
> --- a/gcc/haifa-sched.c
> +++ b/gcc/haifa-sched.c
> @@ -657,6 +657,7 @@ static hash_table <delay_i2_hasher> delay_htab_i2;
>  /* Called through htab_traverse.  Walk the hashtable using I2 as
>     index, and delete all elements involving an UID higher than
>     that pointed to by *DATA.  */
> +namespace {
>  int
>  haifa_htab_i2_traverse (delay_pair **slot, int *data)
>  {
> @@ -668,10 +669,12 @@ haifa_htab_i2_traverse (delay_pair **slot, int *data)
>      }
>    return 1;
>  }
> +}
>
>  /* Called through htab_traverse.  Walk the hashtable using I2 as
>     index, and delete all elements involving an UID higher than
>     that pointed to by *DATA.  */
> +namespace {
>  int
>  haifa_htab_i1_traverse (delay_pair **pslot, int *data)
>  {
> @@ -699,6 +702,7 @@ haifa_htab_i1_traverse (delay_pair **pslot, int *data)
>      *pslot = first;
>    return 1;
>  }
> +}
>
>  /* Discard all delay pairs which involve an insn with an UID higher
>     than MAX_UID.  */
> diff --git a/gcc/passes.c b/gcc/passes.c
> index 60fb135..8e62128 100644
> --- a/gcc/passes.c
> +++ b/gcc/passes.c
> @@ -816,6 +816,7 @@ static vec<char_ptr> pass_tab = vNULL;
>
>  /* Callback function for traversing NAME_TO_PASS_MAP.  */
>
> +namespace {
>  int
>  passes_pass_traverse (pass_registry **p, void *data ATTRIBUTE_UNUSED)
>  {
> @@ -828,6 +829,7 @@ passes_pass_traverse (pass_registry **p, void *data ATTRIBUTE_UNUSED)
>
>    return 1;
>  }
> +}
>
>  /* The function traverses NAME_TO_PASS_MAP and creates a pass info
>     table for dumping purpose.  */
> diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
> index 5555794..ffeea49 100644
> --- a/gcc/postreload-gcse.c
> +++ b/gcc/postreload-gcse.c
> @@ -430,6 +430,7 @@ lookup_expr_in_table (rtx pat)
>     expression hash table to FILE.  */
>
>  /* This helper is called via htab_traverse.  */
> +namespace {
>  int
>  dump_expr_hash_table_entry (expr **slot, FILE *file)
>  {
> @@ -451,6 +452,7 @@ dump_expr_hash_table_entry (expr **slot, FILE *file)
>    fprintf (file, "\n");
>    return 1;
>  }
> +}
>
>  static void
>  dump_hash_table (FILE *file)
> @@ -1225,6 +1227,7 @@ eliminate_partially_redundant_loads (void)
>     marked for later deletion.  */
>
>  /* This helper is called via htab_traverse.  */
> +namespace {
>  int
>  delete_redundant_insns_1 (expr **slot, void *data ATTRIBUTE_UNUSED)
>  {
> @@ -1249,6 +1252,7 @@ delete_redundant_insns_1 (expr **slot, void *data ATTRIBUTE_UNUSED)
>
>    return 1;
>  }
> +}
>
>  static void
>  delete_redundant_insns (void)
> diff --git a/gcc/sese.c b/gcc/sese.c
> index 342c5e8..1c59842 100644
> --- a/gcc/sese.c
> +++ b/gcc/sese.c
> @@ -67,6 +67,7 @@ debug_rename_elt (rename_map_elt elt)
>
>  /* Helper function for debug_rename_map.  */
>
> +namespace {
>  int
>  debug_rename_map_1 (rename_map_elt_s **slot, void *s ATTRIBUTE_UNUSED)
>  {
> @@ -74,7 +75,8 @@ debug_rename_map_1 (rename_map_elt_s **slot, void *s ATTRIBUTE_UNUSED)
>    debug_rename_elt (entry);
>    return 1;
>  }
> -
> +}
> +
>
>  /* Hashtable helpers.  */
>
> diff --git a/gcc/statistics.c b/gcc/statistics.c
> index 6c84709..02adcc5 100644
> --- a/gcc/statistics.c
> +++ b/gcc/statistics.c
> @@ -119,6 +119,7 @@ curr_statistics_hash (void)
>  /* Helper for statistics_fini_pass.  Print the counter difference
>     since the last dump for the pass dump files.  */
>
> +namespace {
>  int
>  statistics_fini_pass_1 (statistics_counter_t **slot,
>                         void *data ATTRIBUTE_UNUSED)
> @@ -136,10 +137,12 @@ statistics_fini_pass_1 (statistics_counter_t **slot,
>    counter->prev_dumped_count = counter->count;
>    return 1;
>  }
> +}
>
>  /* Helper for statistics_fini_pass.  Print the counter difference
>     since the last dump for the statistics dump.  */
>
> +namespace {
>  int
>  statistics_fini_pass_2 (statistics_counter_t **slot,
>                         void *data ATTRIBUTE_UNUSED)
> @@ -168,9 +171,11 @@ statistics_fini_pass_2 (statistics_counter_t **slot,
>    counter->prev_dumped_count = counter->count;
>    return 1;
>  }
> +}
>
>  /* Helper for statistics_fini_pass, reset the counters.  */
>
> +namespace {
>  int
>  statistics_fini_pass_3 (statistics_counter_t **slot,
>                         void *data ATTRIBUTE_UNUSED)
> @@ -179,6 +184,7 @@ statistics_fini_pass_3 (statistics_counter_t **slot,
>    counter->prev_dumped_count = counter->count;
>    return 1;
>  }
> +}
>
>  /* Dump the current statistics incrementally.  */
>
> @@ -209,6 +215,7 @@ statistics_fini_pass (void)
>
>  /* Helper for printing summary information.  */
>
> +namespace {
>  int
>  statistics_fini_1 (statistics_counter_t **slot, opt_pass *pass)
>  {
> @@ -231,6 +238,7 @@ statistics_fini_1 (statistics_counter_t **slot, opt_pass *pass)
>              counter->count);
>    return 1;
>  }
> +}
>
>  /* Finish the statistics and dump summary information.  */
>
> diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
> index 3ca2bd1..381e554 100644
> --- a/gcc/tree-into-ssa.c
> +++ b/gcc/tree-into-ssa.c
> @@ -1689,6 +1689,7 @@ debug_tree_ssa_stats (void)
>
>  /* Callback for htab_traverse to dump the VAR_INFOS hash table.  */
>
> +namespace {
>  int
>  debug_var_infos_r (var_info_d **slot, FILE *file)
>  {
> @@ -1705,6 +1706,7 @@ debug_var_infos_r (var_info_d **slot, FILE *file)
>
>    return 1;
>  }
> +}
>
>
>  /* Dump the VAR_INFOS hash table on FILE.  */
> diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
> index 47179a9..7fe812f 100644
> --- a/gcc/tree-parloops.c
> +++ b/gcc/tree-parloops.c
> @@ -560,6 +560,7 @@ take_address_of (tree obj, tree type, edge entry,
>     for reduction described in SLOT, and place it at the preheader of
>     the loop described in DATA.  */
>
> +namespace {
>  int
>  initialize_reductions (reduction_info **slot, struct loop *loop)
>  {
> @@ -604,6 +605,7 @@ initialize_reductions (reduction_info **slot, struct loop *loop)
>    reduc->initial_value = arg;
>    return 1;
>  }
> +}
>
>  struct elv_data
>  {
> @@ -990,6 +992,7 @@ separate_decls_in_region_debug (gimple stmt,
>  /* Callback for htab_traverse.  Adds a field corresponding to the reduction
>     specified in SLOT. The type is passed in DATA.  */
>
> +namespace {
>  int
>  add_field_for_reduction (reduction_info **slot, tree type)
>  {
> @@ -1005,10 +1008,12 @@ add_field_for_reduction (reduction_info **slot, tree type)
>
>    return 1;
>  }
> +}
>
>  /* Callback for htab_traverse.  Adds a field corresponding to a ssa name
>     described in SLOT. The type is passed in DATA.  */
>
> +namespace {
>  int
>  add_field_for_name (name_to_copy_elt **slot, tree type)
>  {
> @@ -1023,6 +1028,7 @@ add_field_for_name (name_to_copy_elt **slot, tree type)
>
>    return 1;
>  }
> +}
>
>  /* Callback for htab_traverse.  A local result is the intermediate result
>     computed by a single
> @@ -1031,6 +1037,7 @@ add_field_for_name (name_to_copy_elt **slot, tree type)
>     The phi's result will be stored in NEW_PHI field of the
>     reduction's data structure.  */
>
> +namespace {
>  int
>  create_phi_for_local_result (reduction_info **slot, struct loop *loop)
>  {
> @@ -1065,6 +1072,7 @@ create_phi_for_local_result (reduction_info **slot, struct loop *loop)
>
>    return 1;
>  }
> +}
>
>  struct clsn_data
>  {
> @@ -1080,6 +1088,7 @@ struct clsn_data
>     DATA annotates the place in memory the atomic operation relates to,
>     and the basic block it needs to be generated in.  */
>
> +namespace {
>  int
>  create_call_for_reduction_1 (reduction_info **slot, struct clsn_data *clsn_data)
>  {
> @@ -1126,6 +1135,7 @@ create_call_for_reduction_1 (reduction_info **slot, struct clsn_data *clsn_data)
>    gsi_insert_after (&gsi, gimple_build_omp_atomic_store (name), GSI_NEW_STMT);
>    return 1;
>  }
> +}
>
>  /* Create the atomic operation at the join point of the threads.
>     REDUCTION_LIST describes the reductions in the LOOP.
> @@ -1146,6 +1156,7 @@ create_call_for_reduction (struct loop *loop,
>  /* Callback for htab_traverse.  Loads the final reduction value at the
>     join point of all threads, and inserts it in the right place.  */
>
> +namespace {
>  int
>  create_loads_for_reductions (reduction_info **slot, struct clsn_data *clsn_data)
>  {
> @@ -1177,6 +1188,7 @@ create_loads_for_reductions (reduction_info **slot, struct clsn_data *clsn_data)
>        }
>    gcc_unreachable ();
>  }
> +}
>
>  /* Load the reduction result that was stored in LD_ST_DATA.
>     REDUCTION_LIST describes the list of reductions that the
> @@ -1206,6 +1218,7 @@ create_final_loads_for_reduction (reduction_info_table_type reduction_list,
>    The reduction is specified in SLOT. The store information is
>    passed in DATA.  */
>
> +namespace {
>  int
>  create_stores_for_reduction (reduction_info **slot, struct clsn_data *clsn_data)
>  {
> @@ -1222,11 +1235,13 @@ create_stores_for_reduction (reduction_info **slot, struct clsn_data *clsn_data)
>
>    return 1;
>  }
> +}
>
>  /* Callback for htab_traverse.  Creates loads to a field of LOAD in LOAD_BB and
>     store to a field of STORE in STORE_BB for the ssa name and its duplicate
>     specified in SLOT.  */
>
> +namespace {
>  int
>  create_loads_and_stores_for_name (name_to_copy_elt **slot,
>                                   struct clsn_data *clsn_data)
> @@ -1251,6 +1266,7 @@ create_loads_and_stores_for_name (name_to_copy_elt **slot,
>
>    return 1;
>  }
> +}
>
>  /* Moves all the variables used in LOOP and defined outside of it (including
>     the initial values of loop phi nodes, and *PER_THREAD if it is a ssa
> @@ -1970,6 +1986,7 @@ build_new_reduction (reduction_info_table_type reduction_list,
>
>  /* Callback for htab_traverse.  Sets gimple_uid of reduc_phi stmts.  */
>
> +namespace {
>  int
>  set_reduc_phi_uids (reduction_info **slot, void *data ATTRIBUTE_UNUSED)
>  {
> @@ -1977,6 +1994,7 @@ set_reduc_phi_uids (reduction_info **slot, void *data ATTRIBUTE_UNUSED)
>    gimple_set_uid (red->reduc_phi, red->reduc_version);
>    return 1;
>  }
> +}
>
>  /* Detect all reductions in the LOOP, insert them into REDUCTION_LIST.  */
>
> diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
> index 315c781..a2d496a 100644
> --- a/gcc/tree-ssa-threadupdate.c
> +++ b/gcc/tree-ssa-threadupdate.c
> @@ -577,6 +577,7 @@ ssa_fix_duplicate_block_edges (struct redirection_data *rd,
>
>  /* Hash table traversal callback routine to create duplicate blocks.  */
>
> +namespace {
>  int
>  ssa_create_duplicates (struct redirection_data **slot,
>                        ssa_local_info_t *local_info)
> @@ -626,6 +627,7 @@ ssa_create_duplicates (struct redirection_data **slot,
>    /* Keep walking the hash table.  */
>    return 1;
>  }
> +}
>
>  /* We did not create any outgoing edges for the template block during
>     block creation.  This hash table traversal callback creates the
> @@ -656,6 +658,7 @@ ssa_fixup_template_block (struct redirection_data **slot,
>  /* Hash table traversal callback to redirect each incoming edge
>     associated with this hash table element to its new destination.  */
>
> +namespace {
>  int
>  ssa_redirect_edges (struct redirection_data **slot,
>                     ssa_local_info_t *local_info)
> @@ -719,6 +722,7 @@ ssa_redirect_edges (struct redirection_data **slot,
>
>    return 1;
>  }
> +}
>
>  /* Return true if this block has no executable statements other than
>     a simple ctrl flow instruction.  When the number of outgoing edges
> diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
> index 65d8285..638bf57 100644
> --- a/gcc/var-tracking.c
> +++ b/gcc/var-tracking.c
> @@ -2240,6 +2240,7 @@ struct overlapping_mems
>     canonicalized form of COMS->LOC's address, and COMS->LOC must be
>     canonicalized itself.  */
>
> +namespace {
>  int
>  drop_overlapping_mem_locs (variable_def **slot, overlapping_mems *coms)
>  {
> @@ -2308,6 +2309,7 @@ drop_overlapping_mem_locs (variable_def **slot, overlapping_mems *coms)
>
>    return 1;
>  }
> +}
>
>  /* Remove from SET all VALUE bindings to MEMs that overlap with LOC.  */
>
> @@ -3560,8 +3562,10 @@ loc_cmp (rtx x, rtx y)
>  }
>
>  #if ENABLE_CHECKING
> +
>  /* Check the order of entries in one-part variables.   */
>
> +namespace {
>  int
>  canonicalize_loc_order_check (variable_def **slot,
>                               dataflow_set *data ATTRIBUTE_UNUSED)
> @@ -3591,6 +3595,7 @@ canonicalize_loc_order_check (variable_def **slot,
>
>    return 1;
>  }
> +}
>  #endif
>
>  /* Mark with VALUE_RECURSED_INTO values that have neighbors that are
> @@ -3598,6 +3603,7 @@ canonicalize_loc_order_check (variable_def **slot,
>     Ensure less likely values can reach more likely neighbors, making
>     the connections bidirectional.  */
>
> +namespace {
>  int
>  canonicalize_values_mark (variable_def **slot, dataflow_set *set)
>  {
> @@ -3633,10 +3639,12 @@ canonicalize_values_mark (variable_def **slot, dataflow_set *set)
>
>    return 1;
>  }
> +}
>
>  /* Remove redundant entries from equivalence lists in onepart
>     variables, canonicalizing equivalence sets into star shapes.  */
>
> +namespace {
>  int
>  canonicalize_values_star (variable_def **slot, dataflow_set *set)
>  {
> @@ -3850,6 +3858,7 @@ canonicalize_values_star (variable_def **slot, dataflow_set *set)
>
>    return 1;
>  }
> +}
>
>  /* Bind one-part variables to the canonical value in an equivalence
>     set.  Not doing this causes dataflow convergence failure in rare
> @@ -3858,6 +3867,7 @@ canonicalize_values_star (variable_def **slot, dataflow_set *set)
>     have determined or even seen the canonical value of a set when we
>     get to a variable that references another member of the set.  */
>
> +namespace {
>  int
>  canonicalize_vars_star (variable_def **slot, dataflow_set *set)
>  {
> @@ -3910,6 +3920,7 @@ canonicalize_vars_star (variable_def **slot, dataflow_set *set)
>
>    return 1;
>  }
> +}
>
>  /* Combine variable or value in *S1SLOT (in DSM->cur) with the
>     corresponding entry in DSM->src.  Multi-part variables are combined
> @@ -4371,6 +4382,7 @@ struct dfset_post_merge
>  /* Create values for incoming expressions associated with one-part
>     variables that don't have value numbers for them.  */
>
> +namespace {
>  int
>  variable_post_merge_new_vals (variable_def **slot, dfset_post_merge *dfpm)
>  {
> @@ -4503,10 +4515,12 @@ variable_post_merge_new_vals (variable_def **slot, dfset_post_merge *dfpm)
>
>    return 1;
>  }
> +}
>
>  /* Reset values in the permanent set that are not associated with the
>     chosen expression.  */
>
> +namespace {
>  int
>  variable_post_merge_perm_vals (variable_def **pslot, dfset_post_merge *dfpm)
>  {
> @@ -4563,6 +4577,7 @@ variable_post_merge_perm_vals (variable_def **pslot, dfset_post_merge *dfpm)
>
>    return 1;
>  }
> +}
>
>  /* Just checking stuff and registering register attributes for
>     now.  */
> @@ -4662,6 +4677,7 @@ mem_dies_at_call (rtx mem)
>     one-part variable, except those whose MEM attributes map back to
>     the variable itself, directly or within a VALUE.  */
>
> +namespace {
>  int
>  dataflow_set_preserve_mem_locs (variable_def **slot, dataflow_set *set)
>  {
> @@ -4767,10 +4783,12 @@ dataflow_set_preserve_mem_locs (variable_def **slot, dataflow_set *set)
>
>    return 1;
>  }
> +}
>
>  /* Remove all MEMs from the location list of a hash table entry for a
>     value.  */
>
> +namespace {
>  int
>  dataflow_set_remove_mem_locs (variable_def **slot, dataflow_set *set)
>  {
> @@ -4839,6 +4857,7 @@ dataflow_set_remove_mem_locs (variable_def **slot, dataflow_set *set)
>
>    return 1;
>  }
> +}
>
>  /* Remove all variable-location information about call-clobbered
>     registers, as well as associations between MEMs and VALUEs.  */
> @@ -7166,6 +7185,7 @@ dump_attrs_list (attrs list)
>
>  /* Print the information about variable *SLOT to dump file.  */
>
> +namespace {
>  int
>  dump_var_tracking_slot (variable_def **slot, void *data ATTRIBUTE_UNUSED)
>  {
> @@ -7176,6 +7196,7 @@ dump_var_tracking_slot (variable_def **slot, void *data ATTRIBUTE_UNUSED)
>    /* Continue traversing the hash table.  */
>    return 1;
>  }
> +}
>
>  /* Print the information about variable VAR to dump file.  */
>
> @@ -8564,6 +8585,7 @@ vt_expand_1pvar (variable var, variable_table_type vars)
>     additional parameters: WHERE specifies whether the note shall be emitted
>     before or after instruction INSN.  */
>
> +namespace {
>  int
>  emit_note_insn_var_location (variable_def **varp, emit_note_data *data)
>  {
> @@ -8792,10 +8814,12 @@ emit_note_insn_var_location (variable_def **varp, emit_note_data *data)
>    /* Continue traversing the hash table.  */
>    return 1;
>  }
> +}
>
>  /* While traversing changed_variables, push onto DATA (a stack of RTX
>     values) entries that aren't user variables.  */
>
> +namespace {
>  int
>  var_track_values_to_stack (variable_def **slot,
>                            vec<rtx, va_heap> *changed_values_stack)
> @@ -8809,6 +8833,7 @@ var_track_values_to_stack (variable_def **slot,
>
>    return 1;
>  }
> +}
>
>  /* Remove from changed_variables the entry whose DV corresponds to
>     value or debug_expr VAL.  */
> @@ -8973,6 +8998,7 @@ emit_notes_for_changes (rtx insn, enum emit_note_where where,
>  /* Add variable *SLOT to the chain CHANGED_VARIABLES if it differs from the
>     same variable in hash table DATA or is not there at all.  */
>
> +namespace {
>  int
>  emit_notes_for_differences_1 (variable_def **slot, variable_table_type new_vars)
>  {
> @@ -9041,10 +9067,12 @@ emit_notes_for_differences_1 (variable_def **slot, variable_table_type new_vars)
>    /* Continue traversing the hash table.  */
>    return 1;
>  }
> +}
>
>  /* Add variable *SLOT to the chain CHANGED_VARIABLES if it is not in hash
>     table DATA.  */
>
> +namespace {
>  int
>  emit_notes_for_differences_2 (variable_def **slot, variable_table_type old_vars)
>  {
> @@ -9063,6 +9091,7 @@ emit_notes_for_differences_2 (variable_def **slot, variable_table_type old_vars)
>    /* Continue traversing the hash table.  */
>    return 1;
>  }
> +}
>
>  /* Emit notes before INSN for differences between dataflow sets OLD_SET and
>     NEW_SET.  */
> --
> 1.9.1
>


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