diff options
author | Vladimir Makarov <vmakarov@redhat.com> | 2011-03-27 23:16:35 +0000 |
---|---|---|
committer | Vladimir Makarov <vmakarov@gcc.gnu.org> | 2011-03-27 23:16:35 +0000 |
commit | fe82cdfb597c2b56a60c079f06c1a47005130b9b (patch) | |
tree | ab75249e0724a39c82bc4c52637b7593afc63580 /gcc/ira-build.c | |
parent | 5e85ab88f180bbaf34f36a55cd83cad81c682b71 (diff) | |
download | gcc-fe82cdfb597c2b56a60c079f06c1a47005130b9b.tar.gz |
[multiple changes]
2011-03-27 Vladimir Makarov <vmakarov@redhat.com>
* regmove.c (regmove_optimize): Move ira_set_pseudo_classes call
after regstat_init_n_sets_and_refs.
* ira.c: Add more comments at the top.
(setup_stack_reg_pressure_class, setup_pressure_classes):
Add comments how we compute the register pressure classes.
(setup_allocno_and_important_classes): Add more comments.
(setup_class_translate_array, reorder_important_classes)
(setup_reg_class_relations): Add comments.
* ira-emit.c: Add 2011 to the Copyright line. Add comments at the
start of the file.
* ira-color.c: Add 2011 to the Copyright line.
(assign_hard_reg): Add more comments.
(improve_allocation): Ditto.
* ira-costs.c: Add 2011 to the Copyright line.
(setup_cost_classes, setup_regno_cost_classes_by_aclass): Add more
comments.
(setup_regno_cost_classes_by_mode): Ditto.
Initial patches from ira-improv branch:
2010-08-13 Vladimir Makarov <vmakarov@redhat.com>
* ira-build.c: (ira_create_object): Remove initialization of
OBJECT_PROFITABLE_HARD_REGS. Initialize OBJECT_ADD_DATA.
(ira_create_allocno): Remove initialization of
ALLOCNO_MEM_OPTIMIZED_DEST, ALLOCNO_MEM_OPTIMIZED_DEST_P,
ALLOCNO_SOMEWHERE_RENAMED_P, ALLOCNO_CHILD_RENAMED_P,
ALLOCNO_IN_GRAPH_P, ALLOCNO_MAY_BE_SPILLED_P, ALLOCNO_COLORABLE_P,
ALLOCNO_NEXT_BUCKET_ALLOCNO, ALLOCNO_PREV_BUCKET_ALLOCNO,
ALLOCNO_FIRST_COALESCED_ALLOCNO, ALLOCNO_NEXT_COALESCED_ALLOCNO.
Initialize ALLOCNO_ADD_DATA.
(copy_info_to_removed_store_destinations): Use ALLOCNO_EMIT_DATA
and allocno_emit_reg instead of ALLOCNO_MEM_OPTIMIZED_DEST_P and
ALLOCNO_REG.
(ira_flattening): Ditto. Use ALLOCNO_EMIT_DATA instead of
ALLOCNO_MEM_OPTIMIZED_DEST and ALLOCNO_SOMEWHERE_RENAMED_P.
* ira.c (ira_reallocate): Remove.
(setup_pressure_classes): Call
ira_init_register_move_cost_if_necessary. Use
ira_register_move_cost instead of ira_get_register_move_cost.
(setup_allocno_assignment_flags): Use ALLOCNO_EMIT_DATA.
(ira): Call ira_initiate_emit_data and ira_finish_emit_data.
* ira-color.c: Use ALLOCNO_COLOR_DATA instead of
ALLOCNO_IN_GRAPH_P, ALLOCNO_MAY_BE_SPILLED_P, ALLOCNO_COLORABLE_P,
ALLOCNO_AVAILABLE_REGS_NUM, ALLOCNO_NEXT_BUCKET_ALLOCNO,
ALLOCNO_PREV_BUCKET_ALLOCNO. ALLOCNO_TEMP. Use OBJECT_COLOR_DATA
instead of OBJECT_PROFITABLE_HARD_REGS, OBJECT_HARD_REGS_NODE,
OBJECT_HARD_REGS_SUBNODES_START, OBJECT_HARD_REGS_SUBNODES_NUM.
Fix formatting.
(object_hard_regs_t, object_hard_regs_node_t): Move from
ira-int.h.
(struct object_hard_regs, struct object_hard_regs_node): Ditto.
(struct allocno_color_data): New.
(allocno_color_data_t): New typedef.
(allocno_color_data): New definition.
(ALLOCNO_COLOR_DATA): New macro.
(struct object_color_data): New.
(object_color_data_t): New typedef.
(object_color_data): New definition.
(OBJECT_COLOR_DATA): New macro.
(update_copy_costs, calculate_allocno_spill_cost): Call
ira_init_register_move_cost_if_necessary. Use
ira_register_move_cost instead of ira_get_register_move_cost.
(move_spill_restore, update_curr_costs): Ditto.
(allocno_spill_priority): Make it inline.
(color_pass): Allocate and free allocno_color_dat and
object_color_data.
(struct coalesce_data, coalesce_data_t): New.
(allocno_coalesce_data): New definition.
(ALLOCNO_COALESCE_DATA): New macro.
(merge_allocnos, coalesced_allocno_conflict_p): Use
ALLOCNO_COALESCED_DATA instead of ALLOCNO_FIRST_COALESCED_ALLOCNO,
ALLOCNO_NEXT_COALESCED_ALLOCNO, ALLOCNO_TEMP.
(coalesce_allocnos): Ditto.
(setup_coalesced_allocno_costs_and_nums): Ditto.
(collect_spilled_coalesced_allocnos): Ditto.
(slot_coalesced_allocno_live_ranges_intersect_p): Ditto.
(setup_slot_coalesced_allocno_live_ranges): Ditto.
(coalesce_spill_slots): Ditto.
(ira_sort_regnos_for_alter_reg): Ditto. Allocate, initialize and
free allocno_coalesce_data.
* ira-conflicts.c: Fix formatting.
(process_regs_for_copy): Call
ira_init_register_move_cost_if_necessary. Use
ira_register_move_cost instead of ira_get_register_move_cost.
(build_object_conflicts): Optimize.
* ira-costs.c (record_reg_classes): Optimize. Call
ira_init_register_move_cost_if_necessary. Use
ira_register_move_cost, ira_may_move_in_cost, and
ira_may_move_out_cost instead of ira_get_register_move_cost and
ira_get_may_move_cost.
(record_address_regs): Ditto.
(scan_one_insn): Optimize.
(find_costs_and_classes): Optimize.
(process_bb_node_for_hard_reg_moves): Call
ira_init_register_move_cost_if_necessary. Use
ira_register_move_cost instead of ira_get_register_move_cost.
* ira-emit.c: Use allocno_emit_reg, ALLOCNO_EMIT_DATA instead of
ALLOCNO_REG, ALLOCNO_CHILD_RENAMED_P, ALLOCNO_MEM_OPTIMIZED_DEST,
ALLOCNO_MEM_OPTIMIZED_DEST_P, and ALLOCNO_SOMEWHERE_RENAMED_P.
(ira_allocno_emit_data, void_p, new_allocno_emit_data_vec): New
definitions.
(ira_initiate_emit_data, ira_finish_emit_data)
(create_new_allocno): New functions.
(modify_move_list): Call create_new_alloc instead of
ira_create_allocno.
(emit_move_list): Call ira_init_register_move_cost_if_necessary.
Use ira_register_move_cost instead of ira_get_register_move_cost.
* ira-int.h: Fix some comments.
(object_hard_regs_t, object_hard_regs_node_t): Move
to ira-color.c.
(struct object_hard_regs, struct object_hard_regs_node):
Ditto.
(struct ira_object): Remove profitable_hard_regs, hard_regs_node,
hard_regs_subnodes_start, hard_regs_subnodes_num. Add new member
add_data.
(struct ira_allocno): Make mode and aclass a bitfield. Move other
bitfield after mode. Make hard_regno a short int. Make
hard_regno short. Remove first_coalesced_allocno and
next_coalesced_allocno. Move mem_optimized_dest_p,
somewhere_renamed_p, child_renamed_p, reg, and mem_optimized_dest
into struct ira_emit_data. Remove in_graph_p, may_be_spilled_p,
available_regs_num, next_bucket_allocno, prev_bucket_allocno,
temp, colorable_p. Add new member add_data.
(ALLOCNO_IN_GRAPH_P, ALLOCNO_MAY_BE_SPILLED_P): Remove.
(ALLOCNO_COLORABLE_P, ALLOCNO_AVAILABLE_REGS_NUM): Remove.
(ALLOCNO_NEXT_BUCKET_ALLOCNO, ALLOCNO_PREV_BUCKET_ALLOCNO): Remove.
(ALLOCNO_TEMP, ALLOCNO_FIRST_COALESCED_ALLOCNO): Remove.
(ALLOCNO_NEXT_COALESCED_ALLOCNO): Remove.
(ALLOCNO_ADD_DATA): New macro.
(ira_emit_data_t): New typedef.
(struct ira_emit_data): New. Move mem_optimized_dest_p,
somewhere_renamed_p, child_renamed_p, reg, mem_optimized_dest
from struct ira_allocno.
(ALLOCNO_EMIT_DATA): New macro.
(ira_allocno_emit_data, allocno_emit_reg): New.
(ALLOCNO_PROFITABLE_HARD_REGS, OBJECT_HARD_REGS_NODE): Remove.
(OBJECT_HARD_REGS_SUBNODES_STAR, OBJECT_HARD_REGS_SUBNODES_NUM):
Remove.
(OBJECT_ADD_DATA): New macro.
(ira_reallocate): Remove.
(ira_initiate_emit_data, ira_finish_emit_data): New.
(ira_get_register_move_cost, ira_get_may_move_cost): Remove.
(ira_init_register_move_cost_if_necessary): New.
(ira_object_conflict_iter_next): Merge into
ira_object_conflict_iter_cond.
(FOR_EACH_OBJECT_CONFLICT): Don't use
ira_object_conflict_iter_next.
* ira-live.c: (process_single_reg_class_operands): Call
ira_init_register_move_cost_if_necessary. Use
ira_register_move_cost instead of ira_get_register_move_cost.
2010-08-13 Vladimir Makarov <vmakarov@redhat.com>
* ira-int.h (struct target_ira_int): Remove x_cost_classes.
* ira-costs.c: Fix formatting.
(cost_classes, cost_classes_num): Remove.
(struct cost_classes, cost_classes_t, const_cost_classes_t): New.
(regno_cost_classes, cost_classes_hash, cost_classes_eq): New.
(cost_classes_del, cost_classes_htab): New.
(cost_classes_aclass_cache, cost_classes_mode_cache): New.
(initiate_regno_cost_classes, setup_cost_classes): New.
(setup_regno_cost_classes_by_aclass): New.
(setup_regno_cost_classes_by_mode, finish_regno_cost_classes):
New.
(record_reg_classes): Use regno_cost_classes instead of
cost_classes. Move checking opposite operand up.
(record_address_regs): Use regno_cost_classes
instead of cost_classes.
(scan_one_insn): Ditto. Use always general register.
(print_allocno_costs): Use regno_cost_classes instead of
cost_classes.
(print_pseudo_costs): Ditto. Use Reg_N_REFS.
(find_costs_and_classes): Set up cost classes for each registers.
Use also their mode for this. Use regno_cost_classes instead of
cost_classes.
(setup_allocno_class_and_costs): Use regno_cost_classes instead of
cost_classes.
(free_ira_costs, ira_init_costs): Don't use cost_classes.
(ira_costs, ira_set_pseudo_classes): Call
initiate_regno_cost_classes and finish_regno_cost_classes.
2010-10-04 Vladimir Makarov <vmakarov@redhat.com>
* target-def.h (TARGET_IRA_COVER_CLASSES): Remove.
* target.def (ira_cover_classes): Remove.
* doc/tm.texi: Remove TARGET_IRA_COVER_CLASSES and
IRA_COVER_CLASSES.
* doc/tm.texi.in: Ditto.
* ira-conflicts.c: Remove mentioning cover classes from the file.
Use ALLOCNO_CLASS instead of ALLOCNO_COVER_CLASS. Use
ALLOCNO_COVER_CLASS_COST instead of ALLOCNO_CLASS_COST. Fix
formatting.
* targhooks.c (default_ira_cover_classes): Remove.
* targhooks.h (default_ira_cover_classes): Ditto.
* haifa-sched.c: Remove mentioning cover classes from the file.
Use ira_reg_pressure_cover instead of ira_reg_class_cover. Use
ira_pressure_classes and ira_pressure_classes_num instead of
ira_reg_class_cover_size and ira_reg_class_cover. Use
sched_regno_pressure_class instead of sched_regno_cover_class.
(mark_regno_birth_or_death, setup_insn_reg_pressure_info): Use
ira_reg_class_max_nregs instead of ira_reg_class_nregs.
* ira-int.h: Add 2010 to Copyright. Remove mentioning cover
classes from the file.
(object_hard_regs_t, object_hard_regs_node_t): New typedefs.
(struct object_hard_regs, struct object_hard_regs_node): New.
(struct ira_object): New members profitable_hard_regs,
hard_regs_node, hard_regs_subnodes_start, hard_regs_subnodes_num.
(struct ira_allocno): Rename cover_class to aclass. Rename
cover_class_cost and updated_cover_class_cost to class_cost and
updated_class_cost. Remove splay_removed_p and
left_conflict_size. Add new members colorable_p.
(ALLOCNO_SPLAY_REMOVED_P, ALLOCNO_LEFT_CONFLICTS_SIZE): Remove.
(ALLOCNO_COLORABLE_P): New macro.
(ALLOCNO_COVER_CLASS): Rename to ALLOCNO_CLASS.
(ALLOCNO_COVER_CLASS_COST, ALLOCNO_UPDATED_COVER_CLASS_COST):
Rename to ALLOCNO_CLASS_COST and ALLOCNO_UPDATED__CLASS_COST.
(OBJECT_...): Rename parameter C to O.
(OBJECT_PROFITABLE_HARD_REGS): New macro.
(OBJECT_HARD_REGS_NODE, OBJECT_HARD_REGS_SUBNODES_START)
(OBJECT_HARD_REGS_SUBNODES_NUM): New macros.
(struct target_ira_int): New members x_ira_max_memory_move_cost,
x_ira_max_register_move_cost, x_ira_max_may_move_in_cost,
x_ira_max_may_move_out_cost, x_ira_reg_allocno_class_p,
x_ira_reg_pressure_class_p, x_ira_important_class_nums,
x_ira_reg_class_superunion. Rename x_prohibited_class_mode_reg to
x_ira_prohibited_class_mode_reg. Rename x_ira_reg_class_union to
x_ira_reg_class_subunion.
(ira_max_memory_move_cost, ira_max_register_move_cost)
(ira_max_may_move_in_cost, ira_max_may_move_out_cost)
(ira_reg_allocno_class_p, ira_reg_pressure_class_p)
(ira_important_class_nums, ira_reg_class_superunion): New macros.
(prohibited_class_mode_regs): Rename to
ira_prohibited_class_mode_regs.
(ira_reg_class_union): Rename to ira_reg_class_subunion.
(ira_debug_class_cover): Rename to ira_debug_allocno_classes.
(ira_set_allocno_cover_class): Rename to ira_set_allocno_class.
(ira_tune_allocno_costs_and_cover_classes): Rename to
ira_tune_allocno_costs.
(ira_debug_hard_regs_forest): New.
(ira_object_conflict_iter_init, ira_object_conflict_iter_cond)
(ira_object_conflict_iter_next): Fix comments.
(ira_hard_reg_set_intersection_p, hard_reg_set_size): New
functions.
(ira_allocate_and_set_costs, ira_allocate_and_copy_costs): Rename
cover_class to aclass.
(ira_allocate_and_accumulate_costs): Ditto.
(ira_allocate_and_set_or_copy_costs): Ditto.
* opts.c (decode_options): Remove ira_cover_class check.
* ira-color.c: Remove mentioning cover classes from the file. Use
ALLOCNO_CLASS, ALLOCNO_CLASS_COST, and ALLOCNO_UPDATED_CLASS_COST
instead of ALLOCNO_COVER_CLASS, ALLOCNO_COVER_CLASS_COST, and
ALLOCNO_UPDATED_COVER_CLASS_COST. Fix formatting.
(splay-tree.h): Remove include.
(allocno_coalesced_p, processed_coalesced_allocno_bitmap): Move
before copy_freq_compare_func.
(allocnos_for_spilling, removed_splay_allocno_vec): Remove.
(object_hard_regs_vec, object_hard_regs_htab, node_check_tick):
New definitions.
(hard_regs_roots, hard_regs_node_vec): Ditto.
(object_hard_regs_hash, object_hard_regs_eq, find_hard_regs): Ditto.
(insert_hard_regs, init_object_hard_regs, add_object_hard_regs): Ditto.
(finish_object_hard_regs, object_hard_regs_compare): Ditto.
(create_new_object_hard_regs_node): Ditto.
(add_new_object_hard_regs_node_to_forest): Ditto.
(add_object_hard_regs_to_forest, collect_object_hard_regs_cover):
Ditto.
(setup_object_hard_regs_nodes_parent, first_common_ancestor_node):
Ditto.
(print_hard_reg_set, print_hard_regs_subforest): Ditto.
(print_hard_regs_forest, ira_debug_hard_regs_forest): Ditto.
(remove_unused_object_hard_regs_nodes): Ditto.
(enumerate_object_hard_regs_nodes): Ditto.
(object_hard_regs_nodes_num, object_hard_regs_nodes): Ditto.
(object_hard_regs_subnode_t): Ditto.
(struct object_hard_regs_subnode): Ditto.
(object_hard_regs_subnodes, object_hard_regs_subnode_index): Ditto.
(setup_object_hard_regs_subnode_index): Ditto.
(get_object_hard_regs_subnodes_num): Ditto.
(form_object_hard_regs_nodes_forest): Ditto.
(finish_object_hard_regs_nodes_tree): Ditto.
(finish_object_hard_regs_nodes_forest): Ditto.
(allocnos_have_intersected_live_ranges_p): Rename to
allocnos_conflict_by_live_ranges_p. Move before
copy_freq_compare_func.
(pseudos_have_intersected_live_ranges_p): Rename to
conflict_by_live_ranges_p. Move before copy_freq_compare_func.
(setup_left_conflict_sizes_p, update_left_conflict_sizes_p): Ditto.
(empty_profitable_hard_regs, setup_profitable_hard_regs): Ditto.
(update_copy_costs): Remove assert. Skip cost update if the hard
reg does not belong the class.
(assign_hard_reg): Process only profitable hard regs.
(uncolorable_allocnos_num): Make it scalar.
(allocno_spill_priority): Use ALLOCNO_EXCESS_PRESSURE_POINTS_NUM
and ira_reg_class_max_nregs instead of ALLOCNO_LEFT_CONFLICTS_SIZE
and ira_reg_class_max_nregs.
(bucket_allocno_compare_func): Check frequency first.
(sort_bucket): Add compare function as a parameter.
(add_allocno_to_ordered_bucket): Assume no coalesced allocnos.
(uncolorable_allocnos_splay_tree, USE_SPLAY_P): Remove.
(push_allocno_to_stack): Rewrite for checking new allocno
colorability.
(remove_allocno_from_bucket_and_push): Print cost too. Remove
assert.
(push_only_colorable): Pass new parameter to sort_bucket.
(push_allocno_to_spill): Remove.
(allocno_spill_priority_compare): Make it inline and rewrite.
(splay_tree_allocate, splay_tree_free): Remove.
(allocno_spill_sort_compare): New function.
(push_allocnos_to_stack): Sort allocnos for spilling once. Don't
build and use splay tree. Choose first allocno in uncolorable
allocno bucket to spill. Remove setting spill cost.
(all_conflicting_hard_regs): Remove.
(setup_allocno_available_regs_num): Check only profitable hard
regs. Print info about hard regs nodes.
(setup_allocno_left_conflicts_size): Remove.
(put_allocno_into_bucket): Don't call
setup_allocno_left_conflicts_size. Use
setup_left_conflict_sizes_p.
(improve_allocation): New.
(color_allocnos): Call setup_profitable_hard_regs,
form_object_hard_regs_nodes_forest, improve_allocation,
finish_object_hard_regs_nodes_forest. Setup spill cost.
(print_loop_title): Use pressure classes.
(color_allocnso): Ditto.
(do_coloring): Remove allocation and freeing splay_tree_node_pool
and allocnos_for_spilling.
(ira_sort_regnos_for_alter_reg): Don't setup members
{first,next}_coalesced_allocno.
(color): Remove allocating and freeing removed_splay_allocno_vec.
(fast_allocation): Use ira_prohibited_class_mode_regs instead of
prohibited_class_mode_regs.
* ira-lives.c: Remove mentioning cover classes from the file. Fix
formatting.
(update_allocno_pressure_excess_length): Use pressure classes.
(inc_register_pressure, dec_register_pressure): Check for pressure
class.
(mark_pseudo_regno_live, mark_pseudo_regno_subword_live): Use
pressure class. Use ira_reg_class_nregs instead of
ira_reg_class_max_nregs.
(mark_pseudo_regno_dead, mark_pseudo_regno_subword_dead): Ditto.
(mark_hard_reg_live, mark_hard_reg_dead): Use pressure class.
(single_reg_class): Use ira_reg_class_nregs instead of
ira_reg_class_max_nregs.
(process_bb_node_lives): Use pressure classes.
* ira-emit.c: Remove mentioning cover classes from the file. Use
ALLOCNO_CLASS instead of ALLOCNO_COVER_CLASS. Fix formatting.
(change_loop): Use pressure classes.
(modify_move_list): Call ira_set_allocno_class instead of
ira_set_allocno_cover_class.
* ira-build.c: Remove mentioning cover classes from the file. Use
ALLOCNO_CLASS and ALLOCNO_CLASS_COST instead of
ALLOCNO_COVER_CLASS and ALLOCNO_COVER_CLASS_COST. Use
ALLOCNO_UPDATED_CLASS_COST instead of
ALLOCNO_UPDATED_COVER_CLASS_COST. Fix formatting.
(ira_create_object): Initiate OBJECT_PROFITABLE_HARD_REGS.
(ira_create_allocno): Remove initialization of
ALLOCNO_SPLAY_REMOVED_P, ALLOCNO_LEFT_CONFLICT_SIZE. Initialize
ALLOCNO_COLORABLE_P.
(ira_set_allocno_cover_class): Rename to ira_set_allocno_class.
Update conflict regs for the objects.
(create_cap_allocno): Remove assert. Don't propagate
ALLOCNO_AVAILABLE_REGS_NUM.
(ira_free_allocno_costs): New function.
(finish_allocno): Change a part of code into call of
ira_free_allocno_costs.
(low_pressure_loop_node_p): Use pressure classes.
(object_range_compare_func): Don't compare classes.
(setup_min_max_conflict_allocno_ids): Ditto.
* loop-invariant.c: Remove mentioning cover classes from the file.
Use ira_pressure_classes and ira_pressure_classes_num instead of
ira_reg_class_cover_size and ira_reg_class_cover. Fix formatting.
(get_cover_class_and_nregs): Rename to
get_cover_pressure_and_nregs. Use ira_reg_class_max_nregs instead
of ira_reg_class_nregs. Use reg_allocno_class instead of
reg_cover_class.
(get_inv_cost): Use instead ira_stack_reg_pressure_class of
STACK_REG_COVER_CLASS.
(get_regno_cover_class): Rename to get_regno_pressure_class.
(move_loop_invariants): Initialize and finalize regstat.
* ira.c: Remove mentioning cover classes from the file. Add
comments about coloring without cover classes. Use ALLOCNO_CLASS
instead of ALLOCNO_COVER_CLASS. Fix formatting.
(alloc_reg_class_subclasses, setup_reg_subclasses): Move it before
setup_class_subset_and_memory_move_costs.
(setup_stack_reg_pressure_class, setup_pressure_classes): New.
(setup_cover_and_important_classes): Rename to
setup_allocno_and_important_classes.
(setup_class_translate_array): New.
(setup_class_translate): Call it for allocno and pressure classes.
(cover_class_order): Rename to allocno_class_order.
(comp_reg_classes_func): Use ira_allocno_class_translate instead
of ira_class_translate.
(reorder_important_classes): Set up ira_important_class_nums.
(setup_reg_class_relations): Set up ira_reg_class_superunion.
(print_class_cover): Rename to print_classes. Add parameter.
(ira_debug_class_cover): Rename to ira_debug_allocno_classes.
Print pressure classes too.
(find_reg_class_closure): Rename to find_reg_classes. Don't call
setup_reg_subclasses.
(ira_hard_regno_cover_class): Rename to
ira_hard_regno_allocno_class.
(ira_reg_class_nregs): Rename to ira_reg_class_max_nregs.
(setup_prohibited_class_mode_regs): Use
ira_prohibited_class_mode_regs instead of
prohibited_class_mode_regs.
(clarify_prohibited_class_mode_regs): New function.
(ira_init_register_move_cost): Set up ira_max_register_move_cost,
ira_max_may_move_in_cost, and ira_max_may_move_out_cost.
(ira_init_once): Initialize them.
(free_register_move_costs): Process them.
(ira_init): Move calls of find_reg_classes and
setup_hard_regno_aclass after setup_prohibited_class_mode_regs.
Call clarify_prohibited_class_mode_regs.
(ira_no_alloc_reg): Remove.
(too_high_register_pressure_p): Use pressure classes.
* sched-deps.c: Remove mentioning cover classes from the file.
Use ira_reg_pressure_cover instead of ira_reg_class_cover. Use
ira_pressure_classes and ira_pressure_classes_num instead of
ira_reg_class_cover_size and ira_reg_class_cover.
(mark_insn_hard_regno_birth, mark_hard_regno_death): Use
sched_regno_pressure_class instead of sched_regno_cover_class.
(mark_insn_pseudo_birth, mark_pseudo_death): Ditto. Use
ira_reg_class_max_nregs instead of ira_reg_class_nregs.
* ira.h: Add 2010 to Copyright.
(ira_no_alloc_reg): Remove external.
(struct target_ira): Rename x_ira_hard_regno_cover_class,
x_ira_reg_class_cover_size, x_ira_reg_class_cover, and
x_ira_class_translate to x_ira_hard_regno_allocno_class,
x_ira_allocno_classes_num, x_ira_allocno_classes, and
x_ira_allocno_class_translate. Add x_ira_pressure_classes_num,
x_ira_pressure_classes, x_ira_pressure_class_translate, and
x_ira_stack_reg_pressure_class. Rename x_ira_reg_class_nregs to
x_ira_reg_class_max_nregs. Add x_ira_reg_class_min_nregs and
x_ira_no_alloc_regs.
(ira_hard_regno_cover_class): Rename to
ira_hard_regno_allocno_class.
(ira_reg_class_cover_size, ira_reg_class_cover): Rename to
ira_allocno_classes_num and ira_allocno_classes.
(ira_class_translate): Rename to ira_allocno_class_translate.
(ira_pressure_classes_num, ira_pressure_classes): New definitions.
(ira_pressure_class_translate, ira_stack_reg_pressure_class): Ditto.
(ira_reg_class_nregs): Rename to ira_reg_class_max_nregs.
(ira_reg_class_min_nregs, ira_stack_reg_pressure_class): New
(ira_no_alloc_regs): New.
* ira-costs.c: Add 2010 to Copyright. Remove mentioning cover
classes from the file. Use ALLOCNO_CLASS instead of
ALLOCNO_COVER_CLASS. Use ALLOCNO_CLASS_COST instead of
ALLOCNO_COVER_CLASS_COST.
(regno_cover_class): Rename to regno_aclass.
(record_reg_classes): Use ira_reg_class_subunion instead of
ira_reg_class_union.
(record_address_regs): Check overflow.
(scan_one_insn): Ditto.
(print_allocno_costs): Print total mem cost fore regional
allocation.
(print_pseudo_costs): Use REG_N_REFS.
(find_costs_and_classes): Use classes intersected with them on the
1st pass. Check overflow. Use ira_reg_class_subunion instead of
ira_reg_class_union. Use ira_allocno_class_translate and
regno_aclass instead of ira_class_translate and regno_cover_class.
Modify code for finding regno_aclass. Setup preferred classes for
the next pass.
(setup_allocno_cover_class_and_costs): Rename to
setup_allocno_class_and_costs. Use regno_aclass instead of
regno_cover_class. Use ira_set_allocno_class instead of
ira_set_allocno_cover_class.
(init_costs, finish_costs): Use regno_aclass instead of
regno_cover_class.
(ira_costs): Use setup_allocno_class_and_costs instead of
setup_allocno_cover_class_and_costs.
(ira_tune_allocno_costs_and_cover_classes): Rename to
ira_tune_allocno_costs. Check overflow. Skip conflict hard regs
by processing objects. Use ira_reg_class_max_nregs instead of
ira_reg_class_nregs.
* rtl.h (reg_cover_class): Rename to reg_allocno_class.
* sched-int.h: Remove mentioning cover classes from the file.
(sched_regno_cover_class): Rename to sched_regno_pressure_class.
* reginfo.c: Add 2010 to Copyright. Remove mentioning cover
classes from the file.
(struct reg_pref): Rename coverclass into allocnoclass.
(reg_cover_class): Rename to reg_allocno_class.
* Makefile.in (ira-color.o): Remove SPLAY_TREE_H from
dependencies.
* config/alpha/alpha.h (IRA_COVER_CLASSES): Remove.
* config/arm/arm.h (IRA_COVER_CLASSES): Ditto.
* config/avr/avr.h (IRA_COVER_CLASSES): Ditto.
* config/bfin/bfin.h (IRA_COVER_CLASSES): Ditto.
* config/cris/cris.h (IRA_COVER_CLASSES): Ditto.
* config/fr30/fr30.h (IRA_COVER_CLASSES): Ditto.
* config/frv/frv.h (IRA_COVER_CLASSES): Ditto.
* config/h8300/h8300.h (IRA_COVER_CLASSES): Ditto.
* config/i386/i386.h (STACK_REG_COVER_CLASS): Ditto.
* config/i386/i386.c (TARGET_IRA_COVER_CLASSES)
(i386_ira_cover_classes): Ditto.
* config/ia64/ia64.h (IRA_COVER_CLASSES): Ditto.
* config/iq2000/iq2000.h (IRA_COVER_CLASSES): Ditto.
* config/m32r/m32r.h (IRA_COVER_CLASSES): Ditto.
* config/m68k/m68k.h (IRA_COVER_CLASSES): Ditto.
* config/mcore/mcore.h (IRA_COVER_CLASSES): Ditto.
* config/mep/mep.h (IRA_COVER_CLASSES): Ditto.
* config/mips/mips.c (TARGET_IRA_COVER_CLASSES)
(mips_ira_cover_classes): Ditto.
* config/mn10300/mn10300.h (IRA_COVER_CLASSES): Ditto.
* config/moxie/moxie.h (IRA_COVER_CLASSES): Ditto.
* config/pa/pa64-regs.h (IRA_COVER_CLASSES): Ditto.
* config/pa/pa32-regs.h (IRA_COVER_CLASSES): Ditto.
* config/picochip/picochip.h (IRA_COVER_CLASSES): Ditto.
* config/rs6000/rs6000.h (IRA_COVER_CLASSES_PRE_VSX)
(IRA_COVER_CLASSES_VSX): Ditto.
* config/rs6000/rs6000.c (TARGET_IRA_COVER_CLASSES)
(rs6000_ira_cover_classes): Ditto.
* config/rx/rx.h (IRA_COVER_CLASSES): Ditto.
* config/s390/s390.h (IRA_COVER_CLASSES): Ditto.
* config/score/score.h (IRA_COVER_CLASSES): Ditto.
* config/sh/sh.h (IRA_COVER_CLASSES): Ditto.
* config/sparc/sparc.h (IRA_COVER_CLASSES): Ditto.
* config/spu/spu.h (IRA_COVER_CLASSES): Ditto.
* config/stormy16/stormy16.h (IRA_COVER_CLASSES): Ditto.
* config/v850/v850.h (IRA_COVER_CLASSES): Ditto.
* config/vax/vax.h (IRA_COVER_CLASSES): Ditto.
* config/xtensa/xtensa.h (IRA_COVER_CLASSES): Ditto.
From-SVN: r171583
Diffstat (limited to 'gcc/ira-build.c')
-rw-r--r-- | gcc/ira-build.c | 349 |
1 files changed, 188 insertions, 161 deletions
diff --git a/gcc/ira-build.c b/gcc/ira-build.c index b3c1e14f8f7..f7cb36e8766 100644 --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -415,7 +415,8 @@ initiate_allocnos (void) = VEC_alloc (ira_object_t, heap, max_reg_num () * 2); ira_object_id_map = NULL; ira_regno_allocno_map - = (ira_allocno_t *) ira_allocate (max_reg_num () * sizeof (ira_allocno_t)); + = (ira_allocno_t *) ira_allocate (max_reg_num () + * sizeof (ira_allocno_t)); memset (ira_regno_allocno_map, 0, max_reg_num () * sizeof (ira_allocno_t)); } @@ -423,7 +424,7 @@ initiate_allocnos (void) static ira_object_t ira_create_object (ira_allocno_t a, int subword) { - enum reg_class cover_class = ALLOCNO_COVER_CLASS (a); + enum reg_class aclass = ALLOCNO_CLASS (a); ira_object_t obj = (ira_object_t) pool_alloc (object_pool); OBJECT_ALLOCNO (obj) = a; @@ -435,12 +436,13 @@ ira_create_object (ira_allocno_t a, int subword) COPY_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), ira_no_alloc_regs); COPY_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), ira_no_alloc_regs); IOR_COMPL_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), - reg_class_contents[cover_class]); + reg_class_contents[aclass]); IOR_COMPL_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), - reg_class_contents[cover_class]); + reg_class_contents[aclass]); OBJECT_MIN (obj) = INT_MAX; OBJECT_MAX (obj) = -1; OBJECT_LIVE_RANGES (obj) = NULL; + OBJECT_ADD_DATA (obj) = NULL; VEC_safe_push (ira_object_t, heap, ira_object_id_map_vec, obj); ira_object_id_map @@ -454,7 +456,8 @@ ira_create_object (ira_allocno_t a, int subword) LOOP_TREE_NODE. Add the allocno to the list of allocnos with the same regno if CAP_P is FALSE. */ ira_allocno_t -ira_create_allocno (int regno, bool cap_p, ira_loop_tree_node_t loop_tree_node) +ira_create_allocno (int regno, bool cap_p, + ira_loop_tree_node_t loop_tree_node) { ira_allocno_t a; @@ -484,35 +487,24 @@ ira_create_allocno (int regno, bool cap_p, ira_loop_tree_node_t loop_tree_node) ALLOCNO_NO_STACK_REG_P (a) = false; ALLOCNO_TOTAL_NO_STACK_REG_P (a) = false; #endif - ALLOCNO_MEM_OPTIMIZED_DEST (a) = NULL; - ALLOCNO_MEM_OPTIMIZED_DEST_P (a) = false; - ALLOCNO_SOMEWHERE_RENAMED_P (a) = false; - ALLOCNO_CHILD_RENAMED_P (a) = false; ALLOCNO_DONT_REASSIGN_P (a) = false; ALLOCNO_BAD_SPILL_P (a) = false; - ALLOCNO_IN_GRAPH_P (a) = false; ALLOCNO_ASSIGNED_P (a) = false; - ALLOCNO_MAY_BE_SPILLED_P (a) = false; - ALLOCNO_SPLAY_REMOVED_P (a) = false; ALLOCNO_MODE (a) = (regno < 0 ? VOIDmode : PSEUDO_REGNO_MODE (regno)); ALLOCNO_COPIES (a) = NULL; ALLOCNO_HARD_REG_COSTS (a) = NULL; ALLOCNO_CONFLICT_HARD_REG_COSTS (a) = NULL; ALLOCNO_UPDATED_HARD_REG_COSTS (a) = NULL; ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a) = NULL; - ALLOCNO_LEFT_CONFLICTS_SIZE (a) = -1; - ALLOCNO_COVER_CLASS (a) = NO_REGS; - ALLOCNO_UPDATED_COVER_CLASS_COST (a) = 0; - ALLOCNO_COVER_CLASS_COST (a) = 0; + ALLOCNO_CLASS (a) = NO_REGS; + ALLOCNO_UPDATED_CLASS_COST (a) = 0; + ALLOCNO_CLASS_COST (a) = 0; ALLOCNO_MEMORY_COST (a) = 0; ALLOCNO_UPDATED_MEMORY_COST (a) = 0; ALLOCNO_EXCESS_PRESSURE_POINTS_NUM (a) = 0; - ALLOCNO_NEXT_BUCKET_ALLOCNO (a) = NULL; - ALLOCNO_PREV_BUCKET_ALLOCNO (a) = NULL; - ALLOCNO_FIRST_COALESCED_ALLOCNO (a) = a; - ALLOCNO_NEXT_COALESCED_ALLOCNO (a) = a; ALLOCNO_NUM_OBJECTS (a) = 0; + ALLOCNO_ADD_DATA (a) = NULL; VEC_safe_push (ira_allocno_t, heap, allocno_vec, a); ira_allocnos = VEC_address (ira_allocno_t, allocno_vec); ira_allocnos_num = VEC_length (ira_allocno_t, allocno_vec); @@ -520,11 +512,22 @@ ira_create_allocno (int regno, bool cap_p, ira_loop_tree_node_t loop_tree_node) return a; } -/* Set up cover class for A and update its conflict hard registers. */ +/* Set up register class for A and update its conflict hard + registers. */ void -ira_set_allocno_cover_class (ira_allocno_t a, enum reg_class cover_class) +ira_set_allocno_class (ira_allocno_t a, enum reg_class aclass) { - ALLOCNO_COVER_CLASS (a) = cover_class; + ira_allocno_object_iterator oi; + ira_object_t obj; + + ALLOCNO_CLASS (a) = aclass; + FOR_EACH_ALLOCNO_OBJECT (a, obj, oi) + { + IOR_COMPL_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), + reg_class_contents[aclass]); + IOR_COMPL_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), + reg_class_contents[aclass]); + } } /* Determine the number of objects we should associate with allocno A @@ -533,8 +536,8 @@ void ira_create_allocno_objects (ira_allocno_t a) { enum machine_mode mode = ALLOCNO_MODE (a); - enum reg_class cover_class = ALLOCNO_COVER_CLASS (a); - int n = ira_reg_class_nregs[cover_class][mode]; + enum reg_class aclass = ALLOCNO_CLASS (a); + int n = ira_reg_class_max_nregs[aclass][mode]; int i; if (GET_MODE_SIZE (mode) != 2 * UNITS_PER_WORD || n != 2) @@ -546,7 +549,7 @@ ira_create_allocno_objects (ira_allocno_t a) } /* For each allocno, set ALLOCNO_NUM_OBJECTS and create the - ALLOCNO_OBJECT structures. This must be called after the cover + ALLOCNO_OBJECT structures. This must be called after the allocno classes are known. */ static void create_allocno_objects (void) @@ -571,6 +574,7 @@ merge_hard_reg_conflicts (ira_allocno_t from, ira_allocno_t to, { ira_object_t from_obj = ALLOCNO_OBJECT (from, i); ira_object_t to_obj = ALLOCNO_OBJECT (to, i); + if (!total_only) IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (to_obj), OBJECT_CONFLICT_HARD_REGS (from_obj)); @@ -592,6 +596,7 @@ ior_hard_reg_conflicts (ira_allocno_t a, HARD_REG_SET *set) { ira_allocno_object_iterator i; ira_object_t obj; + FOR_EACH_ALLOCNO_OBJECT (a, obj, i) { IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), *set); @@ -849,25 +854,22 @@ create_cap_allocno (ira_allocno_t a) { ira_allocno_t cap; ira_loop_tree_node_t parent; - enum reg_class cover_class; + enum reg_class aclass; - ira_assert (ALLOCNO_FIRST_COALESCED_ALLOCNO (a) == a - && ALLOCNO_NEXT_COALESCED_ALLOCNO (a) == a); parent = ALLOCNO_LOOP_TREE_NODE (a)->parent; cap = ira_create_allocno (ALLOCNO_REGNO (a), true, parent); ALLOCNO_MODE (cap) = ALLOCNO_MODE (a); - cover_class = ALLOCNO_COVER_CLASS (a); - ira_set_allocno_cover_class (cap, cover_class); + aclass = ALLOCNO_CLASS (a); + ira_set_allocno_class (cap, aclass); ira_create_allocno_objects (cap); - ALLOCNO_AVAILABLE_REGS_NUM (cap) = ALLOCNO_AVAILABLE_REGS_NUM (a); ALLOCNO_CAP_MEMBER (cap) = a; ALLOCNO_CAP (a) = cap; - ALLOCNO_COVER_CLASS_COST (cap) = ALLOCNO_COVER_CLASS_COST (a); + ALLOCNO_CLASS_COST (cap) = ALLOCNO_CLASS_COST (a); ALLOCNO_MEMORY_COST (cap) = ALLOCNO_MEMORY_COST (a); ira_allocate_and_copy_costs - (&ALLOCNO_HARD_REG_COSTS (cap), cover_class, ALLOCNO_HARD_REG_COSTS (a)); + (&ALLOCNO_HARD_REG_COSTS (cap), aclass, ALLOCNO_HARD_REG_COSTS (a)); ira_allocate_and_copy_costs - (&ALLOCNO_CONFLICT_HARD_REG_COSTS (cap), cover_class, + (&ALLOCNO_CONFLICT_HARD_REG_COSTS (cap), aclass, ALLOCNO_CONFLICT_HARD_REG_COSTS (a)); ALLOCNO_BAD_SPILL_P (cap) = ALLOCNO_BAD_SPILL_P (a); ALLOCNO_NREFS (cap) = ALLOCNO_NREFS (a); @@ -1063,23 +1065,24 @@ ira_finish_live_range_list (live_range_t r) void ira_free_allocno_updated_costs (ira_allocno_t a) { - enum reg_class cover_class; + enum reg_class aclass; - cover_class = ALLOCNO_COVER_CLASS (a); + aclass = ALLOCNO_CLASS (a); if (ALLOCNO_UPDATED_HARD_REG_COSTS (a) != NULL) - ira_free_cost_vector (ALLOCNO_UPDATED_HARD_REG_COSTS (a), cover_class); + ira_free_cost_vector (ALLOCNO_UPDATED_HARD_REG_COSTS (a), aclass); ALLOCNO_UPDATED_HARD_REG_COSTS (a) = NULL; if (ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a) != NULL) ira_free_cost_vector (ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a), - cover_class); + aclass); ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a) = NULL; } -/* Free the memory allocated for allocno A. */ +/* Free and nullify all cost vectors allocated earlier for allocno + A. */ static void -finish_allocno (ira_allocno_t a) +ira_free_allocno_costs (ira_allocno_t a) { - enum reg_class cover_class = ALLOCNO_COVER_CLASS (a); + enum reg_class aclass = ALLOCNO_CLASS (a); ira_object_t obj; ira_allocno_object_iterator oi; @@ -1094,14 +1097,25 @@ finish_allocno (ira_allocno_t a) ira_allocnos[ALLOCNO_NUM (a)] = NULL; if (ALLOCNO_HARD_REG_COSTS (a) != NULL) - ira_free_cost_vector (ALLOCNO_HARD_REG_COSTS (a), cover_class); + ira_free_cost_vector (ALLOCNO_HARD_REG_COSTS (a), aclass); if (ALLOCNO_CONFLICT_HARD_REG_COSTS (a) != NULL) - ira_free_cost_vector (ALLOCNO_CONFLICT_HARD_REG_COSTS (a), cover_class); + ira_free_cost_vector (ALLOCNO_CONFLICT_HARD_REG_COSTS (a), aclass); if (ALLOCNO_UPDATED_HARD_REG_COSTS (a) != NULL) - ira_free_cost_vector (ALLOCNO_UPDATED_HARD_REG_COSTS (a), cover_class); + ira_free_cost_vector (ALLOCNO_UPDATED_HARD_REG_COSTS (a), aclass); if (ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a) != NULL) ira_free_cost_vector (ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a), - cover_class); + aclass); + ALLOCNO_HARD_REG_COSTS (a) = NULL; + ALLOCNO_CONFLICT_HARD_REG_COSTS (a) = NULL; + ALLOCNO_UPDATED_HARD_REG_COSTS (a) = NULL; + ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a) = NULL; +} + +/* Free the memory allocated for allocno A. */ +static void +finish_allocno (ira_allocno_t a) +{ + ira_free_allocno_costs (a); pool_free (allocno_pool, a); } @@ -1365,55 +1379,54 @@ finish_copies (void) -/* Pools for cost vectors. It is defined only for cover classes. */ +/* Pools for cost vectors. It is defined only for allocno classes. */ static alloc_pool cost_vector_pool[N_REG_CLASSES]; /* The function initiates work with hard register cost vectors. It - creates allocation pool for each cover class. */ + creates allocation pool for each allocno class. */ static void initiate_cost_vectors (void) { int i; - enum reg_class cover_class; + enum reg_class aclass; - for (i = 0; i < ira_reg_class_cover_size; i++) + for (i = 0; i < ira_allocno_classes_num; i++) { - cover_class = ira_reg_class_cover[i]; - cost_vector_pool[cover_class] + aclass = ira_allocno_classes[i]; + cost_vector_pool[aclass] = create_alloc_pool ("cost vectors", - sizeof (int) - * ira_class_hard_regs_num[cover_class], + sizeof (int) * ira_class_hard_regs_num[aclass], 100); } } -/* Allocate and return a cost vector VEC for COVER_CLASS. */ +/* Allocate and return a cost vector VEC for ACLASS. */ int * -ira_allocate_cost_vector (enum reg_class cover_class) +ira_allocate_cost_vector (enum reg_class aclass) { - return (int *) pool_alloc (cost_vector_pool[cover_class]); + return (int *) pool_alloc (cost_vector_pool[aclass]); } -/* Free a cost vector VEC for COVER_CLASS. */ +/* Free a cost vector VEC for ACLASS. */ void -ira_free_cost_vector (int *vec, enum reg_class cover_class) +ira_free_cost_vector (int *vec, enum reg_class aclass) { ira_assert (vec != NULL); - pool_free (cost_vector_pool[cover_class], vec); + pool_free (cost_vector_pool[aclass], vec); } /* Finish work with hard register cost vectors. Release allocation - pool for each cover class. */ + pool for each allocno class. */ static void finish_cost_vectors (void) { int i; - enum reg_class cover_class; + enum reg_class aclass; - for (i = 0; i < ira_reg_class_cover_size; i++) + for (i = 0; i < ira_allocno_classes_num; i++) { - cover_class = ira_reg_class_cover[i]; - free_alloc_pool (cost_vector_pool[cover_class]); + aclass = ira_allocno_classes[i]; + free_alloc_pool (cost_vector_pool[aclass]); } } @@ -1644,7 +1657,7 @@ propagate_allocno_info (void) int i; ira_allocno_t a, parent_a; ira_loop_tree_node_t parent; - enum reg_class cover_class; + enum reg_class aclass; if (flag_ira_region != IRA_REGION_ALL && flag_ira_region != IRA_REGION_MIXED) @@ -1670,17 +1683,17 @@ propagate_allocno_info (void) += ALLOCNO_CALLS_CROSSED_NUM (a); ALLOCNO_EXCESS_PRESSURE_POINTS_NUM (parent_a) += ALLOCNO_EXCESS_PRESSURE_POINTS_NUM (a); - cover_class = ALLOCNO_COVER_CLASS (a); - ira_assert (cover_class == ALLOCNO_COVER_CLASS (parent_a)); + aclass = ALLOCNO_CLASS (a); + ira_assert (aclass == ALLOCNO_CLASS (parent_a)); ira_allocate_and_accumulate_costs - (&ALLOCNO_HARD_REG_COSTS (parent_a), cover_class, + (&ALLOCNO_HARD_REG_COSTS (parent_a), aclass, ALLOCNO_HARD_REG_COSTS (a)); ira_allocate_and_accumulate_costs (&ALLOCNO_CONFLICT_HARD_REG_COSTS (parent_a), - cover_class, + aclass, ALLOCNO_CONFLICT_HARD_REG_COSTS (a)); - ALLOCNO_COVER_CLASS_COST (parent_a) - += ALLOCNO_COVER_CLASS_COST (a); + ALLOCNO_CLASS_COST (parent_a) + += ALLOCNO_CLASS_COST (a); ALLOCNO_MEMORY_COST (parent_a) += ALLOCNO_MEMORY_COST (a); } } @@ -1778,16 +1791,16 @@ static bool low_pressure_loop_node_p (ira_loop_tree_node_t node) { int i; - enum reg_class cover_class; + enum reg_class pclass; if (node->bb != NULL) return false; - for (i = 0; i < ira_reg_class_cover_size; i++) + for (i = 0; i < ira_pressure_classes_num; i++) { - cover_class = ira_reg_class_cover[i]; - if (node->reg_pressure[cover_class] - > ira_available_class_regs[cover_class]) + pclass = ira_pressure_classes[i]; + if (node->reg_pressure[pclass] > ira_available_class_regs[pclass] + && ira_available_class_regs[pclass] > 1) return false; } return true; @@ -2003,7 +2016,7 @@ ira_rebuild_regno_allocno_list (int regno) static void propagate_some_info_from_allocno (ira_allocno_t a, ira_allocno_t from_a) { - enum reg_class cover_class; + enum reg_class aclass; merge_hard_reg_conflicts (from_a, a, false); ALLOCNO_NREFS (a) += ALLOCNO_NREFS (from_a); @@ -2014,14 +2027,14 @@ propagate_some_info_from_allocno (ira_allocno_t a, ira_allocno_t from_a) += ALLOCNO_EXCESS_PRESSURE_POINTS_NUM (from_a); if (! ALLOCNO_BAD_SPILL_P (from_a)) ALLOCNO_BAD_SPILL_P (a) = false; - cover_class = ALLOCNO_COVER_CLASS (from_a); - ira_assert (cover_class == ALLOCNO_COVER_CLASS (a)); - ira_allocate_and_accumulate_costs (&ALLOCNO_HARD_REG_COSTS (a), cover_class, + aclass = ALLOCNO_CLASS (from_a); + ira_assert (aclass == ALLOCNO_CLASS (a)); + ira_allocate_and_accumulate_costs (&ALLOCNO_HARD_REG_COSTS (a), aclass, ALLOCNO_HARD_REG_COSTS (from_a)); ira_allocate_and_accumulate_costs (&ALLOCNO_CONFLICT_HARD_REG_COSTS (a), - cover_class, + aclass, ALLOCNO_CONFLICT_HARD_REG_COSTS (from_a)); - ALLOCNO_COVER_CLASS_COST (a) += ALLOCNO_COVER_CLASS_COST (from_a); + ALLOCNO_CLASS_COST (a) += ALLOCNO_CLASS_COST (from_a); ALLOCNO_MEMORY_COST (a) += ALLOCNO_MEMORY_COST (from_a); } @@ -2173,8 +2186,8 @@ remove_low_level_allocnos (void) /* Remove loops from consideration. We remove all loops except for root if ALL_P or loops for which a separate allocation will not improve the result. We have to do this after allocno creation and - their costs and cover class evaluation because only after that the - register pressure can be known and is calculated. */ + their costs and allocno class evaluation because only after that + the register pressure can be known and is calculated. */ static void remove_unnecessary_regions (bool all_p) { @@ -2223,27 +2236,27 @@ update_bad_spill_attribute (void) ira_allocno_object_iterator aoi; ira_object_t obj; live_range_t r; - enum reg_class cover_class; + enum reg_class aclass; bitmap_head dead_points[N_REG_CLASSES]; - for (i = 0; i < ira_reg_class_cover_size; i++) + for (i = 0; i < ira_allocno_classes_num; i++) { - cover_class = ira_reg_class_cover[i]; - bitmap_initialize (&dead_points[cover_class], ®_obstack); + aclass = ira_allocno_classes[i]; + bitmap_initialize (&dead_points[aclass], ®_obstack); } FOR_EACH_ALLOCNO (a, ai) { - cover_class = ALLOCNO_COVER_CLASS (a); - if (cover_class == NO_REGS) + aclass = ALLOCNO_CLASS (a); + if (aclass == NO_REGS) continue; FOR_EACH_ALLOCNO_OBJECT (a, obj, aoi) for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next) - bitmap_set_bit (&dead_points[cover_class], r->finish); + bitmap_set_bit (&dead_points[aclass], r->finish); } FOR_EACH_ALLOCNO (a, ai) { - cover_class = ALLOCNO_COVER_CLASS (a); - if (cover_class == NO_REGS) + aclass = ALLOCNO_CLASS (a); + if (aclass == NO_REGS) continue; if (! ALLOCNO_BAD_SPILL_P (a)) continue; @@ -2252,7 +2265,7 @@ update_bad_spill_attribute (void) for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next) { for (i = r->start + 1; i < r->finish; i++) - if (bitmap_bit_p (&dead_points[cover_class], i)) + if (bitmap_bit_p (&dead_points[aclass], i)) break; if (i < r->finish) break; @@ -2264,10 +2277,10 @@ update_bad_spill_attribute (void) } } } - for (i = 0; i < ira_reg_class_cover_size; i++) + for (i = 0; i < ira_allocno_classes_num; i++) { - cover_class = ira_reg_class_cover[i]; - bitmap_clear (&dead_points[cover_class]); + aclass = ira_allocno_classes[i]; + bitmap_clear (&dead_points[aclass]); } } @@ -2290,6 +2303,7 @@ setup_min_max_allocno_live_range_point (void) FOR_EACH_ALLOCNO (a, ai) { int n = ALLOCNO_NUM_OBJECTS (a); + for (i = 0; i < n; i++) { ira_object_t obj = ALLOCNO_OBJECT (a, i); @@ -2309,6 +2323,7 @@ setup_min_max_allocno_live_range_point (void) { int j; int n = ALLOCNO_NUM_OBJECTS (a); + for (j = 0; j < n; j++) { ira_object_t obj = ALLOCNO_OBJECT (a, j); @@ -2352,10 +2367,10 @@ setup_min_max_allocno_live_range_point (void) } /* Sort allocnos according to their live ranges. Allocnos with - smaller cover class are put first unless we use priority coloring. - Allocnos with the same cover class are ordered according their start - (min). Allocnos with the same start are ordered according their - finish (max). */ + smaller allocno class are put first unless we use priority + coloring. Allocnos with the same class are ordered according + their start (min). Allocnos with the same start are ordered + according their finish (max). */ static int object_range_compare_func (const void *v1p, const void *v2p) { @@ -2365,9 +2380,6 @@ object_range_compare_func (const void *v1p, const void *v2p) ira_allocno_t a1 = OBJECT_ALLOCNO (obj1); ira_allocno_t a2 = OBJECT_ALLOCNO (obj2); - if (flag_ira_algorithm != IRA_ALGORITHM_PRIORITY - && (diff = ALLOCNO_COVER_CLASS (a1) - ALLOCNO_COVER_CLASS (a2)) != 0) - return diff; if ((diff = OBJECT_MIN (obj1) - OBJECT_MIN (obj2)) != 0) return diff; if ((diff = OBJECT_MAX (obj1) - OBJECT_MAX (obj2)) != 0) @@ -2397,6 +2409,7 @@ sort_conflict_id_map (void) for (i = 0; i < num; i++) { ira_object_t obj = ira_object_id_map[i]; + gcc_assert (obj != NULL); OBJECT_CONFLICT_ID (obj) = i; } @@ -2409,7 +2422,7 @@ sort_conflict_id_map (void) static void setup_min_max_conflict_allocno_ids (void) { - int cover_class; + int aclass; int i, j, min, max, start, finish, first_not_finished, filled_area_start; int *live_range_min, *last_lived; int word0_min, word0_max; @@ -2417,21 +2430,20 @@ setup_min_max_conflict_allocno_ids (void) ira_allocno_iterator ai; live_range_min = (int *) ira_allocate (sizeof (int) * ira_objects_num); - cover_class = -1; + aclass = -1; first_not_finished = -1; for (i = 0; i < ira_objects_num; i++) { ira_object_t obj = ira_object_id_map[i]; + if (obj == NULL) continue; a = OBJECT_ALLOCNO (obj); - if (cover_class < 0 - || (flag_ira_algorithm != IRA_ALGORITHM_PRIORITY - && cover_class != (int) ALLOCNO_COVER_CLASS (a))) + if (aclass < 0) { - cover_class = ALLOCNO_COVER_CLASS (a); + aclass = ALLOCNO_CLASS (a); min = i; first_not_finished = i; } @@ -2456,20 +2468,19 @@ setup_min_max_conflict_allocno_ids (void) OBJECT_MIN (obj) = min; } last_lived = (int *) ira_allocate (sizeof (int) * ira_max_point); - cover_class = -1; + aclass = -1; filled_area_start = -1; for (i = ira_objects_num - 1; i >= 0; i--) { ira_object_t obj = ira_object_id_map[i]; + if (obj == NULL) continue; a = OBJECT_ALLOCNO (obj); - if (cover_class < 0 - || (flag_ira_algorithm != IRA_ALGORITHM_PRIORITY - && cover_class != (int) ALLOCNO_COVER_CLASS (a))) + if (aclass < 0) { - cover_class = ALLOCNO_COVER_CLASS (a); + aclass = ALLOCNO_CLASS (a); for (j = 0; j < ira_max_point; j++) last_lived[j] = -1; filled_area_start = ira_max_point; @@ -2507,6 +2518,7 @@ setup_min_max_conflict_allocno_ids (void) { int n = ALLOCNO_NUM_OBJECTS (a); ira_object_t obj0; + if (n < 2) continue; obj0 = ALLOCNO_OBJECT (a, 0); @@ -2519,6 +2531,7 @@ setup_min_max_conflict_allocno_ids (void) { int n = ALLOCNO_NUM_OBJECTS (a); ira_object_t obj0; + if (n < 2) continue; obj0 = ALLOCNO_OBJECT (a, 0); @@ -2611,7 +2624,7 @@ copy_info_to_removed_store_destinations (int regno) a != NULL; a = ALLOCNO_NEXT_REGNO_ALLOCNO (a)) { - if (a != regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))]) + if (a != regno_top_level_allocno_map[REGNO (allocno_emit_reg (a))]) /* This allocno will be removed. */ continue; @@ -2621,9 +2634,10 @@ copy_info_to_removed_store_destinations (int regno) parent != NULL; parent = parent->parent) if ((parent_a = parent->regno_allocno_map[regno]) == NULL - || (parent_a == regno_top_level_allocno_map[REGNO (ALLOCNO_REG - (parent_a))] - && ALLOCNO_MEM_OPTIMIZED_DEST_P (parent_a))) + || (parent_a + == regno_top_level_allocno_map[REGNO + (allocno_emit_reg (parent_a))] + && ALLOCNO_EMIT_DATA (parent_a)->mem_optimized_dest_p)) break; if (parent == NULL || parent_a == NULL) continue; @@ -2655,7 +2669,7 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) int hard_regs_num; bool new_pseudos_p, merged_p, mem_dest_p; unsigned int n; - enum reg_class cover_class; + enum reg_class aclass; ira_allocno_t a, parent_a, first, second, node_first, node_second; ira_copy_t cp; ira_loop_tree_node_t node; @@ -2664,7 +2678,8 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) ira_copy_iterator ci; regno_top_level_allocno_map - = (ira_allocno_t *) ira_allocate (max_reg_num () * sizeof (ira_allocno_t)); + = (ira_allocno_t *) ira_allocate (max_reg_num () + * sizeof (ira_allocno_t)); memset (regno_top_level_allocno_map, 0, max_reg_num () * sizeof (ira_allocno_t)); new_pseudos_p = merged_p = false; @@ -2672,6 +2687,7 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) { ira_allocno_object_iterator oi; ira_object_t obj; + if (ALLOCNO_CAP_MEMBER (a) != NULL) /* Caps are not in the regno allocno maps and they are never will be transformed into allocnos existing after IR @@ -2692,28 +2708,31 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) a != NULL; a = ALLOCNO_NEXT_REGNO_ALLOCNO (a)) { + ira_emit_data_t parent_data, data = ALLOCNO_EMIT_DATA (a); + ira_assert (ALLOCNO_CAP_MEMBER (a) == NULL); - if (ALLOCNO_SOMEWHERE_RENAMED_P (a)) + if (data->somewhere_renamed_p) new_pseudos_p = true; parent_a = ira_parent_allocno (a); if (parent_a == NULL) { ALLOCNO_COPIES (a) = NULL; - regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))] = a; + regno_top_level_allocno_map[REGNO (data->reg)] = a; continue; } ira_assert (ALLOCNO_CAP_MEMBER (parent_a) == NULL); - if (ALLOCNO_MEM_OPTIMIZED_DEST (a) != NULL) + if (data->mem_optimized_dest != NULL) mem_dest_p = true; - if (REGNO (ALLOCNO_REG (a)) == REGNO (ALLOCNO_REG (parent_a))) + parent_data = ALLOCNO_EMIT_DATA (parent_a); + if (REGNO (data->reg) == REGNO (parent_data->reg)) { merge_hard_reg_conflicts (a, parent_a, true); move_allocno_live_ranges (a, parent_a); merged_p = true; - ALLOCNO_MEM_OPTIMIZED_DEST_P (parent_a) - = (ALLOCNO_MEM_OPTIMIZED_DEST_P (parent_a) - || ALLOCNO_MEM_OPTIMIZED_DEST_P (a)); + parent_data->mem_optimized_dest_p + = (parent_data->mem_optimized_dest_p + || data->mem_optimized_dest_p); continue; } new_pseudos_p = true; @@ -2729,8 +2748,8 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) ira_assert (ALLOCNO_CALLS_CROSSED_NUM (parent_a) >= 0 && ALLOCNO_NREFS (parent_a) >= 0 && ALLOCNO_FREQ (parent_a) >= 0); - cover_class = ALLOCNO_COVER_CLASS (parent_a); - hard_regs_num = ira_class_hard_regs_num[cover_class]; + aclass = ALLOCNO_CLASS (parent_a); + hard_regs_num = ira_class_hard_regs_num[aclass]; if (ALLOCNO_HARD_REG_COSTS (a) != NULL && ALLOCNO_HARD_REG_COSTS (parent_a) != NULL) for (j = 0; j < hard_regs_num; j++) @@ -2741,15 +2760,15 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) for (j = 0; j < hard_regs_num; j++) ALLOCNO_CONFLICT_HARD_REG_COSTS (parent_a)[j] -= ALLOCNO_CONFLICT_HARD_REG_COSTS (a)[j]; - ALLOCNO_COVER_CLASS_COST (parent_a) - -= ALLOCNO_COVER_CLASS_COST (a); + ALLOCNO_CLASS_COST (parent_a) + -= ALLOCNO_CLASS_COST (a); ALLOCNO_MEMORY_COST (parent_a) -= ALLOCNO_MEMORY_COST (a); parent_a = ira_parent_allocno (parent_a); if (parent_a == NULL) break; } ALLOCNO_COPIES (a) = NULL; - regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))] = a; + regno_top_level_allocno_map[REGNO (data->reg)] = a; } if (mem_dest_p && copy_info_to_removed_store_destinations (i)) merged_p = true; @@ -2766,7 +2785,8 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) { ira_allocno_object_iterator oi; ira_object_t obj; - if (a != regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))] + + if (a != regno_top_level_allocno_map[REGNO (allocno_emit_reg (a))] || ALLOCNO_CAP_MEMBER (a) != NULL) continue; FOR_EACH_ALLOCNO_OBJECT (a, obj, oi) @@ -2782,19 +2802,21 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) for (r = ira_start_point_ranges[i]; r != NULL; r = r->start_next) { ira_object_t obj = r->object; + a = OBJECT_ALLOCNO (obj); - if (a != regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))] + if (a != regno_top_level_allocno_map[REGNO (allocno_emit_reg (a))] || ALLOCNO_CAP_MEMBER (a) != NULL) continue; - cover_class = ALLOCNO_COVER_CLASS (a); + aclass = ALLOCNO_CLASS (a); sparseset_set_bit (objects_live, OBJECT_CONFLICT_ID (obj)); EXECUTE_IF_SET_IN_SPARSESET (objects_live, n) { ira_object_t live_obj = ira_object_id_map[n]; ira_allocno_t live_a = OBJECT_ALLOCNO (live_obj); - enum reg_class live_cover = ALLOCNO_COVER_CLASS (live_a); - if (ira_reg_classes_intersect_p[cover_class][live_cover] + enum reg_class live_aclass = ALLOCNO_CLASS (live_a); + + if (ira_reg_classes_intersect_p[aclass][live_aclass] /* Don't set up conflict for the allocno with itself. */ && live_a != a) ira_add_conflict (obj, live_obj); @@ -2818,14 +2840,18 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) fprintf (ira_dump_file, " Remove cp%d:%c%dr%d-%c%dr%d\n", cp->num, ALLOCNO_CAP_MEMBER (cp->first) != NULL ? 'c' : 'a', - ALLOCNO_NUM (cp->first), REGNO (ALLOCNO_REG (cp->first)), + ALLOCNO_NUM (cp->first), + REGNO (allocno_emit_reg (cp->first)), ALLOCNO_CAP_MEMBER (cp->second) != NULL ? 'c' : 'a', - ALLOCNO_NUM (cp->second), REGNO (ALLOCNO_REG (cp->second))); + ALLOCNO_NUM (cp->second), + REGNO (allocno_emit_reg (cp->second))); cp->loop_tree_node = NULL; continue; } - first = regno_top_level_allocno_map[REGNO (ALLOCNO_REG (cp->first))]; - second = regno_top_level_allocno_map[REGNO (ALLOCNO_REG (cp->second))]; + first + = regno_top_level_allocno_map[REGNO (allocno_emit_reg (cp->first))]; + second + = regno_top_level_allocno_map[REGNO (allocno_emit_reg (cp->second))]; node = cp->loop_tree_node; if (node == NULL) keep_p = true; /* It copy generated in ira-emit.c. */ @@ -2835,10 +2861,10 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) which we will have different pseudos. */ node_first = node->regno_allocno_map[ALLOCNO_REGNO (cp->first)]; node_second = node->regno_allocno_map[ALLOCNO_REGNO (cp->second)]; - keep_p = ((REGNO (ALLOCNO_REG (first)) - == REGNO (ALLOCNO_REG (node_first))) - && (REGNO (ALLOCNO_REG (second)) - == REGNO (ALLOCNO_REG (node_second)))); + keep_p = ((REGNO (allocno_emit_reg (first)) + == REGNO (allocno_emit_reg (node_first))) + && (REGNO (allocno_emit_reg (second)) + == REGNO (allocno_emit_reg (node_second)))); } if (keep_p) { @@ -2852,28 +2878,29 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL) fprintf (ira_dump_file, " Remove cp%d:a%dr%d-a%dr%d\n", cp->num, ALLOCNO_NUM (cp->first), - REGNO (ALLOCNO_REG (cp->first)), ALLOCNO_NUM (cp->second), - REGNO (ALLOCNO_REG (cp->second))); + REGNO (allocno_emit_reg (cp->first)), + ALLOCNO_NUM (cp->second), + REGNO (allocno_emit_reg (cp->second))); } } /* Remove unnecessary allocnos on lower levels of the loop tree. */ FOR_EACH_ALLOCNO (a, ai) { - if (a != regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))] + if (a != regno_top_level_allocno_map[REGNO (allocno_emit_reg (a))] || ALLOCNO_CAP_MEMBER (a) != NULL) { if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL) fprintf (ira_dump_file, " Remove a%dr%d\n", - ALLOCNO_NUM (a), REGNO (ALLOCNO_REG (a))); + ALLOCNO_NUM (a), REGNO (allocno_emit_reg (a))); finish_allocno (a); continue; } ALLOCNO_LOOP_TREE_NODE (a) = ira_loop_tree_root; - ALLOCNO_REGNO (a) = REGNO (ALLOCNO_REG (a)); + ALLOCNO_REGNO (a) = REGNO (allocno_emit_reg (a)); ALLOCNO_CAP (a) = NULL; /* Restore updated costs for assignments from reload. */ ALLOCNO_UPDATED_MEMORY_COST (a) = ALLOCNO_MEMORY_COST (a); - ALLOCNO_UPDATED_COVER_CLASS_COST (a) = ALLOCNO_COVER_CLASS_COST (a); + ALLOCNO_UPDATED_CLASS_COST (a) = ALLOCNO_CLASS_COST (a); if (! ALLOCNO_ASSIGNED_P (a)) ira_free_allocno_updated_costs (a); ira_assert (ALLOCNO_UPDATED_HARD_REG_COSTS (a) == NULL); @@ -2942,29 +2969,28 @@ update_conflict_hard_reg_costs (void) FOR_EACH_ALLOCNO (a, ai) { - enum reg_class cover_class = ALLOCNO_COVER_CLASS (a); + enum reg_class aclass = ALLOCNO_CLASS (a); enum reg_class pref = reg_preferred_class (ALLOCNO_REGNO (a)); if (reg_class_size[pref] != 1) continue; - index = (ira_class_hard_reg_index[cover_class] - [ira_class_hard_regs[pref][0]]); + index = ira_class_hard_reg_index[aclass][ira_class_hard_regs[pref][0]]; if (index < 0) continue; if (ALLOCNO_CONFLICT_HARD_REG_COSTS (a) == NULL || ALLOCNO_HARD_REG_COSTS (a) == NULL) continue; min = INT_MAX; - for (i = ira_class_hard_regs_num[cover_class] - 1; i >= 0; i--) - if (ALLOCNO_HARD_REG_COSTS (a)[i] > ALLOCNO_COVER_CLASS_COST (a) + for (i = ira_class_hard_regs_num[aclass] - 1; i >= 0; i--) + if (ALLOCNO_HARD_REG_COSTS (a)[i] > ALLOCNO_CLASS_COST (a) && min > ALLOCNO_HARD_REG_COSTS (a)[i]) min = ALLOCNO_HARD_REG_COSTS (a)[i]; if (min == INT_MAX) continue; ira_allocate_and_set_costs (&ALLOCNO_CONFLICT_HARD_REG_COSTS (a), - cover_class, 0); + aclass, 0); ALLOCNO_CONFLICT_HARD_REG_COSTS (a)[index] - -= min - ALLOCNO_COVER_CLASS_COST (a); + -= min - ALLOCNO_CLASS_COST (a); } } @@ -3000,7 +3026,7 @@ ira_build (bool loops_p) propagate_allocno_info (); create_caps (); } - ira_tune_allocno_costs_and_cover_classes (); + ira_tune_allocno_costs (); #ifdef ENABLE_IRA_CHECKING check_allocno_creation (); #endif @@ -3042,6 +3068,7 @@ ira_build (bool loops_p) FOR_EACH_ALLOCNO (a, ai) { int j, nobj = ALLOCNO_NUM_OBJECTS (a); + if (nobj > 1) nr_big++; for (j = 0; j < nobj; j++) |