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-int.h | |
parent | 5e85ab88f180bbaf34f36a55cd83cad81c682b71 (diff) | |
download | gcc-fe82cdfb597c2b56a60c079f06c1a47005130b9b.zip gcc-fe82cdfb597c2b56a60c079f06c1a47005130b9b.tar.gz gcc-fe82cdfb597c2b56a60c079f06c1a47005130b9b.tar.bz2 |
[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-int.h')
-rw-r--r-- | gcc/ira-int.h | 448 |
1 files changed, 240 insertions, 208 deletions
diff --git a/gcc/ira-int.h b/gcc/ira-int.h index 049a07f8..9ea8041 100644 --- a/gcc/ira-int.h +++ b/gcc/ira-int.h @@ -43,9 +43,9 @@ along with GCC; see the file COPYING3. If not see profile driven feedback is available and the function is never executed, frequency is always equivalent. Otherwise rescale the edge frequency. */ -#define REG_FREQ_FROM_EDGE_FREQ(freq) \ - (optimize_size || (flag_branch_probabilities && !ENTRY_BLOCK_PTR->count) \ - ? REG_FREQ_MAX : (freq * REG_FREQ_MAX / BB_FREQ_MAX) \ +#define REG_FREQ_FROM_EDGE_FREQ(freq) \ + (optimize_size || (flag_branch_probabilities && !ENTRY_BLOCK_PTR->count) \ + ? REG_FREQ_MAX : (freq * REG_FREQ_MAX / BB_FREQ_MAX) \ ? (freq * REG_FREQ_MAX / BB_FREQ_MAX) : 1) /* All natural loops. */ @@ -122,7 +122,7 @@ struct ira_loop_tree_node bool entered_from_non_parent_p; /* Maximal register pressure inside loop for given register class - (defined only for the cover classes). */ + (defined only for the pressure classes). */ int reg_pressure[N_REG_CLASSES]; /* Numbers of allocnos referred or living in the loop node (except @@ -193,11 +193,8 @@ extern ira_loop_tree_node_t ira_loop_nodes; /* The structure describes program points where a given allocno lives. - To save memory we store allocno conflicts only for the same cover - class allocnos which is enough to assign hard registers. To find - conflicts for other allocnos (e.g. to assign stack memory slot) we - use the live ranges. If the live ranges of two allocnos are - intersected, the allocnos are in conflict. */ + If the live ranges of two allocnos are intersected, the allocnos + are in conflict. */ struct live_range { /* Object whose live range is described by given structure. */ @@ -232,8 +229,7 @@ struct ira_object ira_allocno_t allocno; /* Vector of accumulated conflicting conflict_redords with NULL end marker (if OBJECT_CONFLICT_VEC_P is true) or conflict bit vector - otherwise. Only ira_objects belonging to allocnos with the - same cover class are in the vector or in the bit vector. */ + otherwise. */ void *conflicts_array; /* Pointer to structures describing at what program point the object lives. We always maintain the list in such way that *the @@ -256,7 +252,7 @@ struct ira_object int min, max; /* Initial and accumulated hard registers conflicting with this object and as a consequences can not be assigned to the allocno. - All non-allocatable hard regs and hard regs of cover classes + All non-allocatable hard regs and hard regs of register classes different from given allocno one are included in the sets. */ HARD_REG_SET conflict_hard_regs, total_conflict_hard_regs; /* Number of accumulated conflicts in the vector of conflicting @@ -266,6 +262,9 @@ struct ira_object ira_object structures. Otherwise, we use a bit vector indexed by conflict ID numbers. */ unsigned int conflict_vec_p : 1; + /* Different additional data. It is used to decrease size of + allocno data footprint. */ + void *add_data; }; /* A structure representing an allocno (allocation entity). Allocno @@ -285,16 +284,40 @@ struct ira_allocno int regno; /* Mode of the allocno which is the mode of the corresponding pseudo-register. */ - enum machine_mode mode; + ENUM_BITFIELD (machine_mode) mode : 8; + /* Register class which should be used for allocation for given + allocno. NO_REGS means that we should use memory. */ + ENUM_BITFIELD (reg_class) aclass : 16; + /* During the reload, value TRUE means that we should not reassign a + hard register to the allocno got memory earlier. It is set up + when we removed memory-memory move insn before each iteration of + the reload. */ + unsigned int dont_reassign_p : 1; +#ifdef STACK_REGS + /* Set to TRUE if allocno can't be assigned to the stack hard + register correspondingly in this region and area including the + region and all its subregions recursively. */ + unsigned int no_stack_reg_p : 1, total_no_stack_reg_p : 1; +#endif + /* TRUE value means that there is no sense to spill the allocno + during coloring because the spill will result in additional + reloads in reload pass. */ + unsigned int bad_spill_p : 1; + /* TRUE if a hard register or memory has been assigned to the + allocno. */ + unsigned int assigned_p : 1; + /* TRUE if conflicts for given allocno are represented by vector of + pointers to the conflicting allocnos. Otherwise, we use a bit + vector where a bit with given index represents allocno with the + same number. */ + unsigned int conflict_vec_p : 1; /* Hard register assigned to given allocno. Negative value means that memory was allocated to the allocno. During the reload, spilled allocno has value equal to the corresponding stack slot number (0, ...) - 2. Value -1 is used for allocnos spilled by the reload (at this point pseudo-register has only one allocno) which did not get stack slot yet. */ - int hard_regno; - /* Final rtx representation of the allocno. */ - rtx reg; + short int hard_regno; /* Allocnos with the same regno are linked by the following member. Allocnos corresponding to inner loops are first in the list (it corresponds to depth-first traverse of the loops). */ @@ -312,12 +335,9 @@ struct ira_allocno int nrefs; /* Accumulated frequency of usage of the allocno. */ int freq; - /* Register class which should be used for allocation for given - allocno. NO_REGS means that we should use memory. */ - enum reg_class cover_class; /* Minimal accumulated and updated costs of usage register of the - cover class for the allocno. */ - int cover_class_cost, updated_cover_class_cost; + allocno class. */ + int class_cost, updated_class_cost; /* Minimal accumulated, and updated costs of memory for the allocno. At the allocation start, the original and updated costs are equal. The updated cost may be changed after finishing @@ -342,11 +362,6 @@ struct ira_allocno /* It is a link to allocno (cap) on lower loop level represented by given cap. Null if given allocno is not a cap. */ ira_allocno_t cap_member; - /* Coalesced allocnos form a cyclic list. One allocno given by - FIRST_COALESCED_ALLOCNO represents all coalesced allocnos. The - list is chained by NEXT_COALESCED_ALLOCNO. */ - ira_allocno_t first_coalesced_allocno; - ira_allocno_t next_coalesced_allocno; /* The number of objects tracked in the following array. */ int num_objects; /* An array of structures describing conflict information and live @@ -359,86 +374,34 @@ struct ira_allocno int call_freq; /* Accumulated number of the intersected calls. */ int calls_crossed_num; - /* TRUE if the allocno assigned to memory was a destination of - removed move (see ira-emit.c) at loop exit because the value of - the corresponding pseudo-register is not changed inside the - loop. */ - unsigned int mem_optimized_dest_p : 1; - /* TRUE if the corresponding pseudo-register has disjoint live - ranges and the other allocnos of the pseudo-register except this - one changed REG. */ - unsigned int somewhere_renamed_p : 1; - /* TRUE if allocno with the same REGNO in a subregion has been - renamed, in other words, got a new pseudo-register. */ - unsigned int child_renamed_p : 1; - /* During the reload, value TRUE means that we should not reassign a - hard register to the allocno got memory earlier. It is set up - when we removed memory-memory move insn before each iteration of - the reload. */ - unsigned int dont_reassign_p : 1; -#ifdef STACK_REGS - /* Set to TRUE if allocno can't be assigned to the stack hard - register correspondingly in this region and area including the - region and all its subregions recursively. */ - unsigned int no_stack_reg_p : 1, total_no_stack_reg_p : 1; -#endif - /* TRUE value means that there is no sense to spill the allocno - during coloring because the spill will result in additional - reloads in reload pass. */ - unsigned int bad_spill_p : 1; - /* TRUE value means that the allocno was not removed yet from the - conflicting graph during colouring. */ - unsigned int in_graph_p : 1; - /* TRUE if a hard register or memory has been assigned to the - allocno. */ - unsigned int assigned_p : 1; - /* TRUE if it is put on the stack to make other allocnos - colorable. */ - unsigned int may_be_spilled_p : 1; - /* TRUE if the allocno was removed from the splay tree used to - choose allocn for spilling (see ira-color.c::. */ - unsigned int splay_removed_p : 1; - /* Non NULL if we remove restoring value from given allocno to - MEM_OPTIMIZED_DEST at loop exit (see ira-emit.c) because the - allocno value is not changed inside the loop. */ - ira_allocno_t mem_optimized_dest; /* Array of usage costs (accumulated and the one updated during - coloring) for each hard register of the allocno cover class. The + coloring) for each hard register of the allocno class. The member value can be NULL if all costs are the same and equal to - COVER_CLASS_COST. For example, the costs of two different hard + CLASS_COST. For example, the costs of two different hard registers can be different if one hard register is callee-saved and another one is callee-used and the allocno lives through calls. Another example can be case when for some insn the corresponding pseudo-register value should be put in specific register class (e.g. AREG for x86) which is a strict subset of - the allocno cover class (GENERAL_REGS for x86). We have updated - costs to reflect the situation when the usage cost of a hard - register is decreased because the allocno is connected to another - allocno by a copy and the another allocno has been assigned to - the hard register. */ + the allocno class (GENERAL_REGS for x86). We have updated costs + to reflect the situation when the usage cost of a hard register + is decreased because the allocno is connected to another allocno + by a copy and the another allocno has been assigned to the hard + register. */ int *hard_reg_costs, *updated_hard_reg_costs; /* Array of decreasing costs (accumulated and the one updated during coloring) for allocnos conflicting with given allocno for hard - regno of the allocno cover class. The member value can be NULL - if all costs are the same. These costs are used to reflect - preferences of other allocnos not assigned yet during assigning - to given allocno. */ + regno of the allocno class. The member value can be NULL if all + costs are the same. These costs are used to reflect preferences + of other allocnos not assigned yet during assigning to given + allocno. */ int *conflict_hard_reg_costs, *updated_conflict_hard_reg_costs; - /* Size (in hard registers) of the same cover class allocnos with - TRUE in_graph_p value and conflicting with given allocno during - each point of graph coloring. */ - int left_conflicts_size; - /* Number of hard registers of the allocno cover class really - available for the allocno allocation. */ - int available_regs_num; - /* Allocnos in a bucket (used in coloring) chained by the following - two members. */ - ira_allocno_t next_bucket_allocno; - ira_allocno_t prev_bucket_allocno; - /* Used for temporary purposes. */ - int temp; + /* Different additional data. It is used to decrease size of + allocno data footprint. */ + void *add_data; }; + /* All members of the allocno structures should be accessed only through the following macros. */ #define ALLOCNO_NUM(A) ((A)->num) @@ -463,10 +426,7 @@ struct ira_allocno #define ALLOCNO_TOTAL_NO_STACK_REG_P(A) ((A)->total_no_stack_reg_p) #endif #define ALLOCNO_BAD_SPILL_P(A) ((A)->bad_spill_p) -#define ALLOCNO_IN_GRAPH_P(A) ((A)->in_graph_p) #define ALLOCNO_ASSIGNED_P(A) ((A)->assigned_p) -#define ALLOCNO_MAY_BE_SPILLED_P(A) ((A)->may_be_spilled_p) -#define ALLOCNO_SPLAY_REMOVED_P(A) ((A)->splay_removed_p) #define ALLOCNO_MODE(A) ((A)->mode) #define ALLOCNO_COPIES(A) ((A)->allocno_copies) #define ALLOCNO_HARD_REG_COSTS(A) ((A)->hard_reg_costs) @@ -475,36 +435,71 @@ struct ira_allocno ((A)->conflict_hard_reg_costs) #define ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS(A) \ ((A)->updated_conflict_hard_reg_costs) -#define ALLOCNO_LEFT_CONFLICTS_SIZE(A) ((A)->left_conflicts_size) -#define ALLOCNO_COVER_CLASS(A) ((A)->cover_class) -#define ALLOCNO_COVER_CLASS_COST(A) ((A)->cover_class_cost) -#define ALLOCNO_UPDATED_COVER_CLASS_COST(A) ((A)->updated_cover_class_cost) +#define ALLOCNO_CLASS(A) ((A)->aclass) +#define ALLOCNO_CLASS_COST(A) ((A)->class_cost) +#define ALLOCNO_UPDATED_CLASS_COST(A) ((A)->updated_class_cost) #define ALLOCNO_MEMORY_COST(A) ((A)->memory_cost) #define ALLOCNO_UPDATED_MEMORY_COST(A) ((A)->updated_memory_cost) -#define ALLOCNO_EXCESS_PRESSURE_POINTS_NUM(A) ((A)->excess_pressure_points_num) -#define ALLOCNO_AVAILABLE_REGS_NUM(A) ((A)->available_regs_num) -#define ALLOCNO_NEXT_BUCKET_ALLOCNO(A) ((A)->next_bucket_allocno) -#define ALLOCNO_PREV_BUCKET_ALLOCNO(A) ((A)->prev_bucket_allocno) -#define ALLOCNO_TEMP(A) ((A)->temp) -#define ALLOCNO_FIRST_COALESCED_ALLOCNO(A) ((A)->first_coalesced_allocno) -#define ALLOCNO_NEXT_COALESCED_ALLOCNO(A) ((A)->next_coalesced_allocno) +#define ALLOCNO_EXCESS_PRESSURE_POINTS_NUM(A) \ + ((A)->excess_pressure_points_num) #define ALLOCNO_OBJECT(A,N) ((A)->objects[N]) #define ALLOCNO_NUM_OBJECTS(A) ((A)->num_objects) +#define ALLOCNO_ADD_DATA(A) ((A)->add_data) -#define OBJECT_ALLOCNO(C) ((C)->allocno) -#define OBJECT_SUBWORD(C) ((C)->subword) -#define OBJECT_CONFLICT_ARRAY(C) ((C)->conflicts_array) -#define OBJECT_CONFLICT_VEC(C) ((ira_object_t *)(C)->conflicts_array) -#define OBJECT_CONFLICT_BITVEC(C) ((IRA_INT_TYPE *)(C)->conflicts_array) -#define OBJECT_CONFLICT_ARRAY_SIZE(C) ((C)->conflicts_array_size) -#define OBJECT_CONFLICT_VEC_P(C) ((C)->conflict_vec_p) -#define OBJECT_NUM_CONFLICTS(C) ((C)->num_accumulated_conflicts) -#define OBJECT_CONFLICT_HARD_REGS(C) ((C)->conflict_hard_regs) -#define OBJECT_TOTAL_CONFLICT_HARD_REGS(C) ((C)->total_conflict_hard_regs) -#define OBJECT_MIN(C) ((C)->min) -#define OBJECT_MAX(C) ((C)->max) -#define OBJECT_CONFLICT_ID(C) ((C)->id) -#define OBJECT_LIVE_RANGES(A) ((A)->live_ranges) +/* Typedef for pointer to the subsequent structure. */ +typedef struct ira_emit_data *ira_emit_data_t; + +/* Allocno bound data used for emit pseudo live range split insns and + to flattening IR. */ +struct ira_emit_data +{ + /* TRUE if the allocno assigned to memory was a destination of + removed move (see ira-emit.c) at loop exit because the value of + the corresponding pseudo-register is not changed inside the + loop. */ + unsigned int mem_optimized_dest_p : 1; + /* TRUE if the corresponding pseudo-register has disjoint live + ranges and the other allocnos of the pseudo-register except this + one changed REG. */ + unsigned int somewhere_renamed_p : 1; + /* TRUE if allocno with the same REGNO in a subregion has been + renamed, in other words, got a new pseudo-register. */ + unsigned int child_renamed_p : 1; + /* Final rtx representation of the allocno. */ + rtx reg; + /* Non NULL if we remove restoring value from given allocno to + MEM_OPTIMIZED_DEST at loop exit (see ira-emit.c) because the + allocno value is not changed inside the loop. */ + ira_allocno_t mem_optimized_dest; +}; + +#define ALLOCNO_EMIT_DATA(a) ((ira_emit_data_t) ALLOCNO_ADD_DATA (a)) + +/* Data used to emit live range split insns and to flattening IR. */ +extern ira_emit_data_t ira_allocno_emit_data; + +/* Abbreviation for frequent emit data access. */ +static inline rtx +allocno_emit_reg (ira_allocno_t a) +{ + return ALLOCNO_EMIT_DATA (a)->reg; +} + +#define OBJECT_ALLOCNO(O) ((O)->allocno) +#define OBJECT_SUBWORD(O) ((O)->subword) +#define OBJECT_CONFLICT_ARRAY(O) ((O)->conflicts_array) +#define OBJECT_CONFLICT_VEC(O) ((ira_object_t *)(O)->conflicts_array) +#define OBJECT_CONFLICT_BITVEC(O) ((IRA_INT_TYPE *)(O)->conflicts_array) +#define OBJECT_CONFLICT_ARRAY_SIZE(O) ((O)->conflicts_array_size) +#define OBJECT_CONFLICT_VEC_P(O) ((O)->conflict_vec_p) +#define OBJECT_NUM_CONFLICTS(O) ((O)->num_accumulated_conflicts) +#define OBJECT_CONFLICT_HARD_REGS(O) ((O)->conflict_hard_regs) +#define OBJECT_TOTAL_CONFLICT_HARD_REGS(O) ((O)->total_conflict_hard_regs) +#define OBJECT_MIN(O) ((O)->min) +#define OBJECT_MAX(O) ((O)->max) +#define OBJECT_CONFLICT_ID(O) ((O)->id) +#define OBJECT_LIVE_RANGES(O) ((O)->live_ranges) +#define OBJECT_ADD_DATA(O) ((O)->add_data) /* Map regno -> allocnos with given regno (see comments for allocno member `next_regno_allocno'). */ @@ -590,6 +585,7 @@ extern int ira_overall_cost; extern int ira_reg_cost, ira_mem_cost; extern int ira_load_cost, ira_store_cost, ira_shuffle_cost; extern int ira_move_loops_num, ira_additional_jumps_num; + /* This page contains a bitset implementation called 'min/max sets' used to record conflicts in IRA. @@ -757,11 +753,6 @@ struct target_ira_int { struct costs *x_op_costs[MAX_RECOG_OPERANDS]; struct costs *x_this_op_costs[MAX_RECOG_OPERANDS]; - /* Classes used for cost calculation. They may be different on - different iterations of the cost calculations or in different - optimization modes. */ - enum reg_class *x_cost_classes; - /* Hard registers that can not be used for the register allocator for all functions of the current compilation unit. */ HARD_REG_SET x_no_unit_alloc_regs; @@ -776,6 +767,12 @@ struct target_ira_int { ira_get_may_move_cost instead. */ move_table *x_ira_register_move_cost[MAX_MACHINE_MODE]; + /* Array analogs of the macros MEMORY_MOVE_COST and + REGISTER_MOVE_COST but they contain maximal cost not minimal as + the previous two ones do. */ + short int x_ira_max_memory_move_cost[MAX_MACHINE_MODE][N_REG_CLASSES][2]; + move_table *x_ira_max_register_move_cost[MAX_MACHINE_MODE]; + /* Similar to may_move_in_cost but it is calculated in IRA instead of regclass. Another difference we take only available hard registers into account to figure out that one register class is a subset of @@ -790,6 +787,18 @@ struct target_ira_int { ira_get_may_move_cost instead. */ move_table *x_ira_may_move_out_cost[MAX_MACHINE_MODE]; +/* Similar to ira_may_move_in_cost and ira_may_move_out_cost but they + return maximal cost. */ + move_table *x_ira_max_may_move_in_cost[MAX_MACHINE_MODE]; + move_table *x_ira_max_may_move_out_cost[MAX_MACHINE_MODE]; + + /* Map class->true if class is a possible allocno class, false + otherwise. */ + bool x_ira_reg_allocno_class_p[N_REG_CLASSES]; + + /* Map class->true if class is a pressure class, false otherwise. */ + bool x_ira_reg_pressure_class_p[N_REG_CLASSES]; + /* Register class subset relation: TRUE if the first class is a subset of the second one considering only hard registers available for the allocation. */ @@ -809,16 +818,20 @@ struct target_ira_int { /* Array whose values are hard regset of hard registers available for the allocation of given register class whose HARD_REGNO_MODE_OK values for given mode are zero. */ - HARD_REG_SET x_prohibited_class_mode_regs[N_REG_CLASSES][NUM_MACHINE_MODES]; + HARD_REG_SET x_ira_prohibited_class_mode_regs[N_REG_CLASSES][NUM_MACHINE_MODES]; /* The value is number of elements in the subsequent array. */ int x_ira_important_classes_num; - /* The array containing non-empty classes (including non-empty cover - classes; which are subclasses of cover classes. Such classes is + /* The array containing all non-empty classes. Such classes is important for calculation of the hard register usage costs. */ enum reg_class x_ira_important_classes[N_REG_CLASSES]; + /* The array containing indexes of important classes in the previous + array. The array elements are defined only for important + classes. */ + int x_ira_important_class_nums[N_REG_CLASSES]; + /* The biggest important class inside of intersection of the two classes (that is calculated taking only hard registers available for allocation into account;. If the both classes contain no hard @@ -837,14 +850,15 @@ struct target_ira_int { allocation into account. */ enum reg_class x_ira_reg_class_super_classes[N_REG_CLASSES][N_REG_CLASSES]; - /* The biggest important class inside of union of the two classes - (that is calculated taking only hard registers available for - allocation into account;. If the both classes contain no hard - registers available for allocation, the value is calculated with - taking all hard-registers including fixed ones into account. In - other words, the value is the corresponding reg_class_subunion - value. */ - enum reg_class x_ira_reg_class_union[N_REG_CLASSES][N_REG_CLASSES]; + /* The biggest (smallest) important class inside of (covering) union + of the two classes (that is calculated taking only hard registers + available for allocation into account). If the both classes + contain no hard registers available for allocation, the value is + calculated with taking all hard-registers including fixed ones + into account. In other words, the value is the corresponding + reg_class_subunion (reg_class_superunion) value. */ + enum reg_class x_ira_reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES]; + enum reg_class x_ira_reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES]; /* For each reg class, table listing all the classes contained in it (excluding the class itself. Non-allocatable registers are @@ -871,43 +885,58 @@ extern struct target_ira_int *this_target_ira_int; (this_target_ira_int->x_ira_reg_mode_hard_regset) #define ira_register_move_cost \ (this_target_ira_int->x_ira_register_move_cost) +#define ira_max_memory_move_cost \ + (this_target_ira_int->x_ira_max_memory_move_cost) +#define ira_max_register_move_cost \ + (this_target_ira_int->x_ira_max_register_move_cost) #define ira_may_move_in_cost \ (this_target_ira_int->x_ira_may_move_in_cost) #define ira_may_move_out_cost \ (this_target_ira_int->x_ira_may_move_out_cost) +#define ira_max_may_move_in_cost \ + (this_target_ira_int->x_ira_max_may_move_in_cost) +#define ira_max_may_move_out_cost \ + (this_target_ira_int->x_ira_max_may_move_out_cost) +#define ira_reg_allocno_class_p \ + (this_target_ira_int->x_ira_reg_allocno_class_p) +#define ira_reg_pressure_class_p \ + (this_target_ira_int->x_ira_reg_pressure_class_p) #define ira_class_subset_p \ (this_target_ira_int->x_ira_class_subset_p) #define ira_non_ordered_class_hard_regs \ (this_target_ira_int->x_ira_non_ordered_class_hard_regs) #define ira_class_hard_reg_index \ (this_target_ira_int->x_ira_class_hard_reg_index) -#define prohibited_class_mode_regs \ - (this_target_ira_int->x_prohibited_class_mode_regs) +#define ira_prohibited_class_mode_regs \ + (this_target_ira_int->x_ira_prohibited_class_mode_regs) #define ira_important_classes_num \ (this_target_ira_int->x_ira_important_classes_num) #define ira_important_classes \ (this_target_ira_int->x_ira_important_classes) +#define ira_important_class_nums \ + (this_target_ira_int->x_ira_important_class_nums) #define ira_reg_class_intersect \ (this_target_ira_int->x_ira_reg_class_intersect) #define ira_reg_classes_intersect_p \ (this_target_ira_int->x_ira_reg_classes_intersect_p) #define ira_reg_class_super_classes \ (this_target_ira_int->x_ira_reg_class_super_classes) -#define ira_reg_class_union \ - (this_target_ira_int->x_ira_reg_class_union) +#define ira_reg_class_subunion \ + (this_target_ira_int->x_ira_reg_class_subunion) +#define ira_reg_class_superunion \ + (this_target_ira_int->x_ira_reg_class_superunion) #define ira_prohibited_mode_move_regs \ (this_target_ira_int->x_ira_prohibited_mode_move_regs) /* ira.c: */ extern void *ira_allocate (size_t); -extern void *ira_reallocate (void *, size_t); extern void ira_free (void *addr); extern bitmap ira_allocate_bitmap (void); extern void ira_free_bitmap (bitmap); extern void ira_print_disposition (FILE *); extern void ira_debug_disposition (void); -extern void ira_debug_class_cover (void); +extern void ira_debug_allocno_classes (void); extern void ira_init_register_move_cost (enum machine_mode); /* The length of the two following arrays. */ @@ -938,7 +967,7 @@ extern ira_allocno_t ira_parent_allocno (ira_allocno_t); extern ira_allocno_t ira_parent_or_cap_allocno (ira_allocno_t); extern ira_allocno_t ira_create_allocno (int, bool, ira_loop_tree_node_t); extern void ira_create_allocno_objects (ira_allocno_t); -extern void ira_set_allocno_cover_class (ira_allocno_t, enum reg_class); +extern void ira_set_allocno_class (ira_allocno_t, enum reg_class); extern bool ira_conflict_vector_profitable_p (ira_object_t, int); extern void ira_allocate_conflict_vec (ira_object_t, int); extern void ira_allocate_object_conflicts (ira_object_t, int); @@ -972,7 +1001,7 @@ extern void ira_init_costs_once (void); extern void ira_init_costs (void); extern void ira_finish_costs_once (void); extern void ira_costs (void); -extern void ira_tune_allocno_costs_and_cover_classes (void); +extern void ira_tune_allocno_costs (void); /* ira-lives.c */ @@ -990,6 +1019,7 @@ extern void ira_debug_conflicts (bool); extern void ira_build_conflicts (void); /* ira-color.c */ +extern void ira_debug_hard_regs_forest (void); extern int ira_loop_edge_freq (ira_loop_tree_node_t, int, bool); extern void ira_reassign_conflict_allocnos (int); extern void ira_initiate_assign (void); @@ -997,34 +1027,18 @@ extern void ira_finish_assign (void); extern void ira_color (void); /* ira-emit.c */ +extern void ira_initiate_emit_data (void); +extern void ira_finish_emit_data (void); extern void ira_emit (bool); -/* Return cost of moving value of MODE from register of class FROM to - register of class TO. */ -static inline int -ira_get_register_move_cost (enum machine_mode mode, - enum reg_class from, enum reg_class to) -{ - if (ira_register_move_cost[mode] == NULL) - ira_init_register_move_cost (mode); - return ira_register_move_cost[mode][from][to]; -} - -/* Return cost of moving value of MODE from register of class FROM to - register of class TO. Return zero if IN_P is true and FROM is - subset of TO or if IN_P is false and FROM is superset of TO. */ -static inline int -ira_get_may_move_cost (enum machine_mode mode, - enum reg_class from, enum reg_class to, - bool in_p) +/* Initialize register costs for MODE if necessary. */ +static inline void +ira_init_register_move_cost_if_necessary (enum machine_mode mode) { if (ira_register_move_cost[mode] == NULL) ira_init_register_move_cost (mode); - return (in_p - ? ira_may_move_in_cost[mode][from][to] - : ira_may_move_out_cost[mode][from][to]); } @@ -1237,14 +1251,17 @@ ira_object_conflict_iter_cond (ira_object_conflict_iterator *i, if (i->conflict_vec_p) { - obj = ((ira_object_t *) i->vec)[i->word_num]; + obj = ((ira_object_t *) i->vec)[i->word_num++]; if (obj == NULL) return false; } else { + unsigned IRA_INT_TYPE word = i->word; + unsigned int bit_num = i->bit_num; + /* Skip words that are zeros. */ - for (; i->word == 0; i->word = ((IRA_INT_TYPE *) i->vec)[i->word_num]) + for (; word == 0; word = ((IRA_INT_TYPE *) i->vec)[i->word_num]) { i->word_num++; @@ -1252,43 +1269,59 @@ ira_object_conflict_iter_cond (ira_object_conflict_iterator *i, if (i->word_num * sizeof (IRA_INT_TYPE) >= i->size) return false; - i->bit_num = i->word_num * IRA_INT_BITS; + bit_num = i->word_num * IRA_INT_BITS; } /* Skip bits that are zero. */ - for (; (i->word & 1) == 0; i->word >>= 1) - i->bit_num++; + for (; (word & 1) == 0; word >>= 1) + bit_num++; - obj = ira_object_id_map[i->bit_num + i->base_conflict_id]; + obj = ira_object_id_map[bit_num + i->base_conflict_id]; + i->bit_num = bit_num + 1; + i->word = word >> 1; } *pobj = obj; return true; } -/* Advance to the next conflicting allocno. */ -static inline void -ira_object_conflict_iter_next (ira_object_conflict_iterator *i) -{ - if (i->conflict_vec_p) - i->word_num++; - else - { - i->word >>= 1; - i->bit_num++; - } -} - /* Loop over all objects conflicting with OBJ. In each iteration, CONF is set to the next conflicting object. ITER is an instance of ira_object_conflict_iterator used to iterate the conflicts. */ #define FOR_EACH_OBJECT_CONFLICT(OBJ, CONF, ITER) \ for (ira_object_conflict_iter_init (&(ITER), (OBJ)); \ - ira_object_conflict_iter_cond (&(ITER), &(CONF)); \ - ira_object_conflict_iter_next (&(ITER))) + ira_object_conflict_iter_cond (&(ITER), &(CONF));) +/* The function returns TRUE if at least one hard register from ones + starting with HARD_REGNO and containing value of MODE are in set + HARD_REGSET. */ +static inline bool +ira_hard_reg_set_intersection_p (int hard_regno, enum machine_mode mode, + HARD_REG_SET hard_regset) +{ + int i; + + gcc_assert (hard_regno >= 0); + for (i = hard_regno_nregs[hard_regno][mode] - 1; i >= 0; i--) + if (TEST_HARD_REG_BIT (hard_regset, hard_regno + i)) + return true; + return false; +} + +/* Return number of hard registers in hard register SET. */ +static inline int +hard_reg_set_size (HARD_REG_SET set) +{ + int i, size; + + for (size = i = 0; i < FIRST_PSEUDO_REGISTER; i++) + if (TEST_HARD_REG_BIT (set, i)) + size++; + return size; +} + /* The function returns TRUE if hard registers starting with HARD_REGNO and containing value of MODE are not in set HARD_REGSET. */ @@ -1311,61 +1344,60 @@ ira_hard_reg_not_in_set_p (int hard_regno, enum machine_mode mode, initialization of the cost vectors. We do this only when it is really necessary. */ -/* Allocate cost vector *VEC for hard registers of COVER_CLASS and +/* Allocate cost vector *VEC for hard registers of ACLASS and initialize the elements by VAL if it is necessary */ static inline void -ira_allocate_and_set_costs (int **vec, enum reg_class cover_class, int val) +ira_allocate_and_set_costs (int **vec, enum reg_class aclass, int val) { int i, *reg_costs; int len; if (*vec != NULL) return; - *vec = reg_costs = ira_allocate_cost_vector (cover_class); - len = ira_class_hard_regs_num[cover_class]; + *vec = reg_costs = ira_allocate_cost_vector (aclass); + len = ira_class_hard_regs_num[aclass]; for (i = 0; i < len; i++) reg_costs[i] = val; } -/* Allocate cost vector *VEC for hard registers of COVER_CLASS and - copy values of vector SRC into the vector if it is necessary */ +/* Allocate cost vector *VEC for hard registers of ACLASS and copy + values of vector SRC into the vector if it is necessary */ static inline void -ira_allocate_and_copy_costs (int **vec, enum reg_class cover_class, int *src) +ira_allocate_and_copy_costs (int **vec, enum reg_class aclass, int *src) { int len; if (*vec != NULL || src == NULL) return; - *vec = ira_allocate_cost_vector (cover_class); - len = ira_class_hard_regs_num[cover_class]; + *vec = ira_allocate_cost_vector (aclass); + len = ira_class_hard_regs_num[aclass]; memcpy (*vec, src, sizeof (int) * len); } -/* Allocate cost vector *VEC for hard registers of COVER_CLASS and - add values of vector SRC into the vector if it is necessary */ +/* Allocate cost vector *VEC for hard registers of ACLASS and add + values of vector SRC into the vector if it is necessary */ static inline void -ira_allocate_and_accumulate_costs (int **vec, enum reg_class cover_class, - int *src) +ira_allocate_and_accumulate_costs (int **vec, enum reg_class aclass, int *src) { int i, len; if (src == NULL) return; - len = ira_class_hard_regs_num[cover_class]; + len = ira_class_hard_regs_num[aclass]; if (*vec == NULL) { - *vec = ira_allocate_cost_vector (cover_class); + *vec = ira_allocate_cost_vector (aclass); memset (*vec, 0, sizeof (int) * len); } for (i = 0; i < len; i++) (*vec)[i] += src[i]; } -/* Allocate cost vector *VEC for hard registers of COVER_CLASS and - copy values of vector SRC into the vector or initialize it by VAL - (if SRC is null). */ +/* Allocate cost vector *VEC for hard registers of ACLASS and copy + values of vector SRC into the vector or initialize it by VAL (if + SRC is null). */ static inline void -ira_allocate_and_set_or_copy_costs (int **vec, enum reg_class cover_class, +ira_allocate_and_set_or_copy_costs (int **vec, enum reg_class aclass, int val, int *src) { int i, *reg_costs; @@ -1373,8 +1405,8 @@ ira_allocate_and_set_or_copy_costs (int **vec, enum reg_class cover_class, if (*vec != NULL) return; - *vec = reg_costs = ira_allocate_cost_vector (cover_class); - len = ira_class_hard_regs_num[cover_class]; + *vec = reg_costs = ira_allocate_cost_vector (aclass); + len = ira_class_hard_regs_num[aclass]; if (src != NULL) memcpy (reg_costs, src, sizeof (int) * len); else |