From cb1ca6ac11d48dc88a44579ed631c3d9d8a3402c Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Mon, 27 Oct 2008 16:39:26 +0000 Subject: ira-int.h (ira_allocno): Add member updated_cover_class_cost. 2008-10-27 Vladimir Makarov * ira-int.h (ira_allocno): Add member updated_cover_class_cost. (ALLOCNO_UPDATED_COVER_CLASS_COST): New. (ira_fast_allocation): Remove the prototype. * ira-color.c (update_copy_costs, allocno_cost_compare_func, assign_hard_reg, calculate_allocno_spill_cost): Use updated costs. (color_pass): Modify the updated costs. (ira_color): Rename to color. Make it static. (ira_fast_allocation): Rename to fast_allocation. Make it static. (ira_color): New function. * ira-conflicts.c (process_regs_for_copy): Propagate hard reg cost change. * ira-lives.c (last_call_num, allocno_saved_at_call): New variables. (set_allocno_live, clear_allocno_live, mark_ref_live, mark_ref_dead): Invalidate corresponding element of allocno_saved_at_call. (process_bb_node_lives): Increment last_call_num. Setup allocno_saved_at_call. Don't increase ALLOCNO_CALL_FREQ if the allocno was already saved. (ira_create_allocno_live_ranges): Initiate last_call_num and allocno_saved_at_call. * ira-build.c (ira_create_allocno): Initiate ALLOCNO_UPDATED_COVER_CLASS_COST. (create_cap_allocno, propagate_allocno_info, remove_unnecessary_allocnos): Remove setting updated costs. (ira_flattening): Set up ALLOCNO_UPDATED_COVER_CLASS_COST. * ira.c (ira): Don't call ira_fast_allocation. * ira-costs.c (setup_allocno_cover_class_and_costs): Don't set up updated costs. From-SVN: r141385 --- gcc/ira-conflicts.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'gcc/ira-conflicts.c') diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c index 9bdc3e7..01ba907 100644 --- a/gcc/ira-conflicts.c +++ b/gcc/ira-conflicts.c @@ -337,6 +337,7 @@ process_regs_for_copy (rtx reg1, rtx reg2, rtx insn, int freq) enum reg_class rclass, cover_class; enum machine_mode mode; ira_copy_t cp; + ira_loop_tree_node_t parent; gcc_assert (REG_SUBREG_P (reg1) && REG_SUBREG_P (reg2)); only_regs_p = REG_P (reg1) && REG_P (reg2); @@ -386,13 +387,23 @@ process_regs_for_copy (rtx reg1, rtx reg2, rtx insn, int freq) cost = ira_register_move_cost[mode][cover_class][rclass] * freq; else cost = ira_register_move_cost[mode][rclass][cover_class] * freq; - ira_allocate_and_set_costs - (&ALLOCNO_HARD_REG_COSTS (a), cover_class, - ALLOCNO_COVER_CLASS_COST (a)); - ira_allocate_and_set_costs - (&ALLOCNO_CONFLICT_HARD_REG_COSTS (a), cover_class, 0); - ALLOCNO_HARD_REG_COSTS (a)[index] -= cost; - ALLOCNO_CONFLICT_HARD_REG_COSTS (a)[index] -= cost; + for (;;) + { + ira_allocate_and_set_costs + (&ALLOCNO_HARD_REG_COSTS (a), cover_class, + ALLOCNO_COVER_CLASS_COST (a)); + ira_allocate_and_set_costs + (&ALLOCNO_CONFLICT_HARD_REG_COSTS (a), cover_class, 0); + ALLOCNO_HARD_REG_COSTS (a)[index] -= cost; + ALLOCNO_CONFLICT_HARD_REG_COSTS (a)[index] -= cost; + if (ALLOCNO_HARD_REG_COSTS (a)[index] < ALLOCNO_COVER_CLASS_COST (a)) + ALLOCNO_COVER_CLASS_COST (a) = ALLOCNO_HARD_REG_COSTS (a)[index]; + if (ALLOCNO_CAP (a) != NULL) + a = ALLOCNO_CAP (a); + else if ((parent = ALLOCNO_LOOP_TREE_NODE (a)->parent) == NULL + || (a = parent->regno_allocno_map[ALLOCNO_REGNO (a)]) == NULL) + break; + } return true; } -- cgit v1.1