diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-25 19:06:06 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-25 19:06:06 +0000 |
commit | aae87fc346d89bc5cf107a45dd5bade361b16533 (patch) | |
tree | 376f2dafdfe0716aa1dd01defc992cc04d880df7 /gcc/genautomata.c | |
parent | cd1a57f0b0d38631f96e9828703588625e515cbe (diff) | |
download | gcc-aae87fc346d89bc5cf107a45dd5bade361b16533.tar.gz |
* c-common.c (fname_as_string, c_type_hash): Constify.
* c-typeck.c (free_all_tagged_tu_seen_up_to): Likewise.
* cgraph.c (edge_hash, edge_eq): Likewise.
* dwarf2out.c (decl_die_table_eq, decl_loc_table_eq): Likewise.
* emit-rtl.c (mem_attrs_htab_eq, reg_attrs_htab_hash,
reg_attrs_htab_eq): Likewise.
* except.c (t2r_eq, t2r_hash, ttypes_filter_eq, ehl_hash, ehl_eq):
Likewise.
* genautomata.c (const_reserv_sets_t, const_unit_decl_t,
const_decl_t, const_state_t, const_automata_list_el_t): New.
(first_out_arc, DECL_UNIT, DECL_BYPASS, DECL_AUTOMATON, DECL_EXCL,
DECL_PRESENCE, DECL_ABSENCE, DECL_RESERV, DECL_INSN_RESERV,
automaton_decl_hash, automaton_decl_eq_p, insn_decl_hash,
insn_decl_eq_p, decl_hash, decl_eq_p, alt_state_cmp,
reserv_sets_cmp, reserv_sets_eq, state_hash, state_eq_p,
automata_list_hash, automata_list_eq_p, compare_states_for_equiv,
compare_max_occ_cycle_nums, out_state_arcs_num,
compare_transition_els_num, units_cmp, state_reservs_cmp):
Constify.
* genmodes.c (cmp_modes): Likewise.
* ggc-common.c (saving_htab_hash, saving_htab_eq): Likewise.
* gimplify.c (compare_case_labels): Likewise.
* ipa-type-escape.c (get_name_of_type, type_brand_s): Likewise.
* loop-unroll.c (si_info_hash, ve_info_hash): Likewise.
* matrix-reorg.c (mtt_info_hash): Likewise.
* postreload-gcse.c (hash_expr_for_htab, expr_equiv_p): Likewise.
* rtl-factoring.c (const_p_hash_bucket, const_p_hash_elem): New.
(htab_hash_bucket, htab_hash_elem): Constify.
* tree-browser.c (TB_parent_eq): Likewise.
* tree-scalar-evolution.c (hash_scev_info): Likewise.
* tree-ssa-alias.c (sort_tags_by_id): Likewise.
* tree-ssa-coalesce.c (const_coalesce_pair_p): New.
(coalesce_pair_map_hash, coalesce_pair_map_eq, compare_pairs):
Constify.
* tree-ssa-dom.c (avail_expr_hash, avail_expr_eq): Likewise.
* tree-ssa-pre.c (const_expr_pred_trans_t): New.
(expr_pred_trans_hash, expr_pred_trans_eq): Constify.
* tree-ssa-sccvn.c (const_vn_binary_op_t, const_vn_unary_op_t,
const_vn_phi_t, const_vn_reference_op_t, const_vn_reference_t):
New.
(vn_reference_op_eq, vn_reference_hash, vn_reference_eq,
vn_unary_op_hash, vn_unary_op_eq, vn_binary_op_hash,
vn_binary_op_eq, vn_phi_hash, vn_phi_eq): Constify.
* tree-ssa-threadupdate.c (redirection_data_hash,
redirection_data_eq): Likewise.
* tree-ssa-uncprop.c (equiv_hash, equiv_eq): Likewise.
* tree-ssa.c (var_ann_eq): Likewise.
* tree-vrp.c (compare_case_labels): Likewise.
* tree.c (int_cst_hash_hash, int_cst_hash_eq,
tree_map_base_marked_p, type_hash_marked_p, tree_check_failed,
tree_not_check_failed, tree_class_check_failed,
tree_range_check_failed, tree_not_class_check_failed,
omp_clause_check_failed, omp_clause_range_check_failed,
tree_contains_struct_check_failed, tree_operand_check_failed):
Likewise.
* tree.h (tree_contains_struct_check_failed, tree_check_failed,
tree_not_check_failed, tree_class_check_failed,
tree_range_check_failed, tree_not_class_check_failed,
tree_operand_check_failed, omp_clause_operand_check_failed,
tree_operand_length): Likewise.
* var-tracking.c (const_variable): New.
(variable_htab_hash, variable_htab_eq): Constify.
* varasm.c (const_desc_hash): Likewise.
cp:
* decl.c (typename_hash, typename_compare): Constify.
* mangle.c (hash_type, compare_type): Likewise.
* pt.c (eq_local_specializations, hash_local_specialization):
Likewise.
* tree.c (cplus_array_hash, cplus_array_compare, list_hash_eq,
list_hash): Likewise.
* typeck2.c (pat_compare): Likewise.
fortran:
* gfortran.h (generate_isocbinding_symbol): Constify.
* symbol.c (gen_special_c_interop_ptr, gen_cptr_param,
generate_isocbinding_symbol): Likewise.
java:
* class.c (java_treetreehash_hash, java_treetreehash_compare):
Constify.
* expr.c (type_assertion_eq): Likewise.
* jcf-io.c (compare_path): Likewise.
* jcf-parse.c (cmpstringp): Likewise.
* verify-impl.c (get_one_type, compute_argument_types,
compute_return_type): Likewise.
objc:
* objc-act.c (volatilized_hash, volatilized_eq, string_hash,
string_eq): Constify.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126925 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genautomata.c')
-rw-r--r-- | gcc/genautomata.c | 129 |
1 files changed, 67 insertions, 62 deletions
diff --git a/gcc/genautomata.c b/gcc/genautomata.c index 5bfdf96fa43..979fad602ec 100644 --- a/gcc/genautomata.c +++ b/gcc/genautomata.c @@ -130,6 +130,7 @@ typedef unsigned HOST_WIDE_INT set_el_t; /* Reservations of function units are represented by value of the following type. */ typedef set_el_t *reserv_sets_t; +typedef const set_el_t *const_reserv_sets_t; /* The following structure describes a ticker. */ struct ticker @@ -182,17 +183,21 @@ struct state_ainsn_table; /* The following typedefs are for brevity. */ typedef struct unit_decl *unit_decl_t; +typedef const struct unit_decl *const_unit_decl_t; typedef struct decl *decl_t; +typedef const struct decl *const_decl_t; typedef struct regexp *regexp_t; typedef struct unit_set_el *unit_set_el_t; typedef struct pattern_set_el *pattern_set_el_t; typedef struct pattern_reserv *pattern_reserv_t; typedef struct alt_state *alt_state_t; typedef struct state *state_t; +typedef const struct state *const_state_t; typedef struct arc *arc_t; typedef struct ainsn *ainsn_t; typedef struct automaton *automaton_t; typedef struct automata_list_el *automata_list_el_t; +typedef const struct automata_list_el *const_automata_list_el_t; typedef struct state_ainsn_table *state_ainsn_table_t; /* Undefined position. */ @@ -228,7 +233,7 @@ static int check_presence_pattern_sets (reserv_sets_t, reserv_sets_t, int); static int check_absence_pattern_sets (reserv_sets_t, reserv_sets_t, int); -static arc_t first_out_arc (state_t); +static arc_t first_out_arc (const_state_t); static arc_t next_out_arc (arc_t); @@ -873,56 +878,56 @@ struct state_ainsn_table #if defined ENABLE_CHECKING && (GCC_VERSION >= 2007) #define DECL_UNIT(d) __extension__ \ -(({ struct decl *const _decl = (d); \ +(({ __typeof (d) const _decl = (d); \ if (_decl->mode != dm_unit) \ decl_mode_check_failed (_decl->mode, "dm_unit", \ __FILE__, __LINE__, __FUNCTION__); \ &(_decl)->decl.unit; })) #define DECL_BYPASS(d) __extension__ \ -(({ struct decl *const _decl = (d); \ +(({ __typeof (d) const _decl = (d); \ if (_decl->mode != dm_bypass) \ decl_mode_check_failed (_decl->mode, "dm_bypass", \ __FILE__, __LINE__, __FUNCTION__); \ &(_decl)->decl.bypass; })) #define DECL_AUTOMATON(d) __extension__ \ -(({ struct decl *const _decl = (d); \ +(({ __typeof (d) const _decl = (d); \ if (_decl->mode != dm_automaton) \ decl_mode_check_failed (_decl->mode, "dm_automaton", \ __FILE__, __LINE__, __FUNCTION__); \ &(_decl)->decl.automaton; })) #define DECL_EXCL(d) __extension__ \ -(({ struct decl *const _decl = (d); \ +(({ __typeof (d) const _decl = (d); \ if (_decl->mode != dm_excl) \ decl_mode_check_failed (_decl->mode, "dm_excl", \ __FILE__, __LINE__, __FUNCTION__); \ &(_decl)->decl.excl; })) #define DECL_PRESENCE(d) __extension__ \ -(({ struct decl *const _decl = (d); \ +(({ __typeof (d) const _decl = (d); \ if (_decl->mode != dm_presence) \ decl_mode_check_failed (_decl->mode, "dm_presence", \ __FILE__, __LINE__, __FUNCTION__); \ &(_decl)->decl.presence; })) #define DECL_ABSENCE(d) __extension__ \ -(({ struct decl *const _decl = (d); \ +(({ __typeof (d) const _decl = (d); \ if (_decl->mode != dm_absence) \ decl_mode_check_failed (_decl->mode, "dm_absence", \ __FILE__, __LINE__, __FUNCTION__); \ &(_decl)->decl.absence; })) #define DECL_RESERV(d) __extension__ \ -(({ struct decl *const _decl = (d); \ +(({ __typeof (d) const _decl = (d); \ if (_decl->mode != dm_reserv) \ decl_mode_check_failed (_decl->mode, "dm_reserv", \ __FILE__, __LINE__, __FUNCTION__); \ &(_decl)->decl.reserv; })) #define DECL_INSN_RESERV(d) __extension__ \ -(({ struct decl *const _decl = (d); \ +(({ __typeof (d) const _decl = (d); \ if (_decl->mode != dm_insn_reserv) \ decl_mode_check_failed (_decl->mode, "dm_insn_reserv", \ __FILE__, __LINE__, __FUNCTION__); \ @@ -1737,7 +1742,7 @@ string_hash (const char *string) static hashval_t automaton_decl_hash (const void *automaton_decl) { - const decl_t decl = (decl_t) automaton_decl; + const_decl_t const decl = (const_decl_t) automaton_decl; gcc_assert (decl->mode != dm_automaton || DECL_AUTOMATON (decl)->name); @@ -1752,8 +1757,8 @@ static int automaton_decl_eq_p (const void* automaton_decl_1, const void* automaton_decl_2) { - const decl_t decl1 = (decl_t) automaton_decl_1; - const decl_t decl2 = (decl_t) automaton_decl_2; + const_decl_t const decl1 = (const_decl_t) automaton_decl_1; + const_decl_t const decl2 = (const_decl_t) automaton_decl_2; gcc_assert (decl1->mode == dm_automaton && DECL_AUTOMATON (decl1)->name @@ -1838,7 +1843,7 @@ finish_automaton_decl_table (void) static hashval_t insn_decl_hash (const void *insn_decl) { - const decl_t decl = (decl_t) insn_decl; + const_decl_t const decl = (const_decl_t) insn_decl; gcc_assert (decl->mode == dm_insn_reserv && DECL_INSN_RESERV (decl)->name); @@ -1851,8 +1856,8 @@ insn_decl_hash (const void *insn_decl) static int insn_decl_eq_p (const void *insn_decl_1, const void *insn_decl_2) { - const decl_t decl1 = (decl_t) insn_decl_1; - const decl_t decl2 = (decl_t) insn_decl_2; + const_decl_t const decl1 = (const_decl_t) insn_decl_1; + const_decl_t const decl2 = (const_decl_t) insn_decl_2; gcc_assert (decl1->mode == dm_insn_reserv && DECL_INSN_RESERV (decl1)->name @@ -1936,7 +1941,7 @@ finish_insn_decl_table (void) static hashval_t decl_hash (const void *decl) { - const decl_t d = (const decl_t) decl; + const_decl_t const d = (const_decl_t) decl; gcc_assert ((d->mode == dm_unit && DECL_UNIT (d)->name) || (d->mode == dm_reserv && DECL_RESERV (d)->name)); @@ -1950,8 +1955,8 @@ decl_hash (const void *decl) static int decl_eq_p (const void *decl_1, const void *decl_2) { - const decl_t d1 = (const decl_t) decl_1; - const decl_t d2 = (const decl_t) decl_2; + const_decl_t const d1 = (const_decl_t) decl_1; + const_decl_t const d2 = (const_decl_t) decl_2; gcc_assert ((d1->mode == dm_unit && DECL_UNIT (d1)->name) || (d1->mode == dm_reserv && DECL_RESERV (d1)->name)); @@ -3182,11 +3187,11 @@ free_alt_states (alt_state_t alt_states_list) static int alt_state_cmp (const void *alt_state_ptr_1, const void *alt_state_ptr_2) { - if ((*(alt_state_t *) alt_state_ptr_1)->state->unique_num - == (*(alt_state_t *) alt_state_ptr_2)->state->unique_num) + if ((*(const alt_state_t *) alt_state_ptr_1)->state->unique_num + == (*(const alt_state_t *) alt_state_ptr_2)->state->unique_num) return 0; - else if ((*(alt_state_t *) alt_state_ptr_1)->state->unique_num - < (*(alt_state_t *) alt_state_ptr_2)->state->unique_num) + else if ((*(const alt_state_t *) alt_state_ptr_1)->state->unique_num + < (*(const alt_state_t *) alt_state_ptr_2)->state->unique_num) return -1; else return 1; @@ -3376,11 +3381,11 @@ reserv_sets_hash_value (reserv_sets_t reservs) /* Comparison of given reservation sets. */ static int -reserv_sets_cmp (reserv_sets_t reservs_1, reserv_sets_t reservs_2) +reserv_sets_cmp (const_reserv_sets_t reservs_1, const_reserv_sets_t reservs_2) { int reservs_num; - set_el_t *reserv_ptr_1; - set_el_t *reserv_ptr_2; + const set_el_t *reserv_ptr_1; + const set_el_t *reserv_ptr_2; gcc_assert (reservs_1 && reservs_2); reservs_num = els_in_reservs; @@ -3402,7 +3407,7 @@ reserv_sets_cmp (reserv_sets_t reservs_1, reserv_sets_t reservs_2) /* The function checks equality of the reservation sets. */ static int -reserv_sets_eq (reserv_sets_t reservs_1, reserv_sets_t reservs_2) +reserv_sets_eq (const_reserv_sets_t reservs_1, const_reserv_sets_t reservs_2) { return reserv_sets_cmp (reservs_1, reservs_2) == 0; } @@ -3654,12 +3659,12 @@ state_hash (const void *state) unsigned int hash_value; alt_state_t alt_state; - if (((state_t) state)->component_states == NULL) - hash_value = reserv_sets_hash_value (((state_t) state)->reservs); + if (((const_state_t) state)->component_states == NULL) + hash_value = reserv_sets_hash_value (((const_state_t) state)->reservs); else { hash_value = 0; - for (alt_state = ((state_t) state)->component_states; + for (alt_state = ((const_state_t) state)->component_states; alt_state != NULL; alt_state = alt_state->next_sorted_alt_state) hash_value = (((hash_value >> (sizeof (unsigned) - 1) * CHAR_BIT) @@ -3668,7 +3673,7 @@ state_hash (const void *state) } hash_value = (((hash_value >> (sizeof (unsigned) - 1) * CHAR_BIT) | (hash_value << CHAR_BIT)) - + ((state_t) state)->automaton->automaton_order_num); + + ((const_state_t) state)->automaton->automaton_order_num); return hash_value; } @@ -3679,17 +3684,17 @@ state_eq_p (const void *state_1, const void *state_2) alt_state_t alt_state_1; alt_state_t alt_state_2; - if (((state_t) state_1)->automaton != ((state_t) state_2)->automaton) + if (((const_state_t) state_1)->automaton != ((const_state_t) state_2)->automaton) return 0; - else if (((state_t) state_1)->component_states == NULL - && ((state_t) state_2)->component_states == NULL) - return reserv_sets_eq (((state_t) state_1)->reservs, - ((state_t) state_2)->reservs); - else if (((state_t) state_1)->component_states != NULL - && ((state_t) state_2)->component_states != NULL) - { - for (alt_state_1 = ((state_t) state_1)->component_states, - alt_state_2 = ((state_t) state_2)->component_states; + else if (((const_state_t) state_1)->component_states == NULL + && ((const_state_t) state_2)->component_states == NULL) + return reserv_sets_eq (((const_state_t) state_1)->reservs, + ((const_state_t) state_2)->reservs); + else if (((const_state_t) state_1)->component_states != NULL + && ((const_state_t) state_2)->component_states != NULL) + { + for (alt_state_1 = ((const_state_t) state_1)->component_states, + alt_state_2 = ((const_state_t) state_2)->component_states; alt_state_1 != NULL && alt_state_2 != NULL; alt_state_1 = alt_state_1->next_sorted_alt_state, alt_state_2 = alt_state_2->next_sorted_alt_state) @@ -3908,7 +3913,7 @@ add_arc (state_t from_state, state_t to_state, ainsn_t ainsn) /* The function returns the first arc starting from STATE. */ static arc_t -first_out_arc (state_t state) +first_out_arc (const_state_t state) { return state->first_out_arc; } @@ -3997,10 +4002,10 @@ static hashval_t automata_list_hash (const void *automata_list) { unsigned int hash_value; - automata_list_el_t curr_automata_list_el; + const_automata_list_el_t curr_automata_list_el; hash_value = 0; - for (curr_automata_list_el = (automata_list_el_t) automata_list; + for (curr_automata_list_el = (const_automata_list_el_t) automata_list; curr_automata_list_el != NULL; curr_automata_list_el = curr_automata_list_el->next_automata_list_el) hash_value = (((hash_value >> (sizeof (unsigned) - 1) * CHAR_BIT) @@ -4013,11 +4018,11 @@ automata_list_hash (const void *automata_list) static int automata_list_eq_p (const void *automata_list_1, const void *automata_list_2) { - automata_list_el_t automata_list_el_1; - automata_list_el_t automata_list_el_2; + const_automata_list_el_t automata_list_el_1; + const_automata_list_el_t automata_list_el_2; - for (automata_list_el_1 = (automata_list_el_t) automata_list_1, - automata_list_el_2 = (automata_list_el_t) automata_list_2; + for (automata_list_el_1 = (const_automata_list_el_t) automata_list_1, + automata_list_el_2 = (const_automata_list_el_t) automata_list_2; automata_list_el_1 != NULL && automata_list_el_2 != NULL; automata_list_el_1 = automata_list_el_1->next_automata_list_el, automata_list_el_2 = automata_list_el_2->next_automata_list_el) @@ -5717,8 +5722,8 @@ static int compare_states_for_equiv (const void *state_ptr_1, const void *state_ptr_2) { - state_t s1 = *(state_t *)state_ptr_1; - state_t s2 = *(state_t *)state_ptr_2; + const_state_t const s1 = *(const_state_t const*)state_ptr_1; + const_state_t const s2 = *(const_state_t const*)state_ptr_2; unsigned int sz, si; if (s1->num_out_arcs < s2->num_out_arcs) return -1; @@ -6313,11 +6318,11 @@ static int compare_max_occ_cycle_nums (const void *unit_decl_1, const void *unit_decl_2) { - if ((DECL_UNIT (*(decl_t *) unit_decl_1)->max_occ_cycle_num) - < (DECL_UNIT (*(decl_t *) unit_decl_2)->max_occ_cycle_num)) + if ((DECL_UNIT (*(const_decl_t const*) unit_decl_1)->max_occ_cycle_num) + < (DECL_UNIT (*(const_decl_t const*) unit_decl_2)->max_occ_cycle_num)) return 1; - else if ((DECL_UNIT (*(decl_t *) unit_decl_1)->max_occ_cycle_num) - == (DECL_UNIT (*(decl_t *) unit_decl_2)->max_occ_cycle_num)) + else if ((DECL_UNIT (*(const_decl_t const*) unit_decl_1)->max_occ_cycle_num) + == (DECL_UNIT (*(const_decl_t const*) unit_decl_2)->max_occ_cycle_num)) return 0; else return -1; @@ -7226,7 +7231,7 @@ add_vect (state_ainsn_table_t tab, int vect_num, vla_hwint_t vect) /* Return number of out arcs of STATE. */ static int -out_state_arcs_num (state_t state) +out_state_arcs_num (const_state_t state) { int result; arc_t arc; @@ -7246,11 +7251,11 @@ static int compare_transition_els_num (const void *state_ptr_1, const void *state_ptr_2) { - int transition_els_num_1; - int transition_els_num_2; + const int transition_els_num_1 + = out_state_arcs_num (*(const_state_t const*) state_ptr_1); + const int transition_els_num_2 + = out_state_arcs_num (*(const_state_t const*) state_ptr_2); - transition_els_num_1 = out_state_arcs_num (*(state_t *) state_ptr_1); - transition_els_num_2 = out_state_arcs_num (*(state_t *) state_ptr_2); if (transition_els_num_1 < transition_els_num_2) return 1; else if (transition_els_num_1 == transition_els_num_2) @@ -8238,8 +8243,8 @@ output_print_reservation_func (void) static int units_cmp (const void *unit1, const void *unit2) { - const unit_decl_t u1 = *(unit_decl_t *) unit1; - const unit_decl_t u2 = *(unit_decl_t *) unit2; + const_unit_decl_t const u1 = *(const_unit_decl_t const*) unit1; + const_unit_decl_t const u2 = *(const_unit_decl_t const*) unit2; return strcmp (u1->name, u2->name); } @@ -8641,8 +8646,8 @@ output_state_arcs (state_t state) static int state_reservs_cmp (const void *reservs_ptr_1, const void *reservs_ptr_2) { - return reserv_sets_cmp (*(reserv_sets_t *) reservs_ptr_1, - *(reserv_sets_t *) reservs_ptr_2); + return reserv_sets_cmp (*(const_reserv_sets_t const*) reservs_ptr_1, + *(const_reserv_sets_t const*) reservs_ptr_2); } /* The following function is used for sorting possible cpu unit |