This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ira] patch for fixing some bugs and code degradations
- From: Vladimir Makarov <vmakarov at redhat dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 20 Feb 2008 11:31:16 -0500
- Subject: [ira] patch for fixing some bugs and code degradations
The following patch fixes some bugs (mostly in optimistic coalescing) and code degradation for some benchmarks.
Vlad
2008-02-20 Vladimir Makarov <vmakarov@redhat.com>
* ira.h, ira-emit.c: Add year 2008 to the copyright.
* ira-int.h: Ditto.
(struct copy): Rename move_insn to insn.
(initiate_ira_assign, finish_ira_assign, debug_allocno_copies):
New function prototypes.
* ira-build.c: Add year 2008 to the copyright. Rename member
move_insn of the copies to insn.
(find_allocno_copy): New function.
(propagate_info_to_cap, add_allocno_copy): Use it.
(print_allocno_copies, debug_allocno_copies): New functions.
* ira-conflicts.c: Add year 2008 to the copyright. Rename member
move_insn of the copies to insn.
* ira.c: Ditto.
(setup_reg_class_intersect_union): Fix reg_class_union for cover
classes.
(ira): Call initiate_ira_assign and finish_ira_assign. Remove
setting reload_completed up.
* ira-costs.c: Add year 2008 to the copyright.
(ira_costs): Check modes of registers.
* ira-lives.c: Add year 2008 to the copyright.
(mark_reg_store, mark_reg_death, process_bb_node_lives): Don't use
REG_N_REFS.
(process_single_reg_class_operands): Check that the hard reg
belongs to the cover class.
* ira-color.c: Add year 2008 to the copyright. Rename member
move_insn of the copies to insn.
(initiate_cost_update, finish_cost_update, update_copy_costs_1):
New functions.
(allocno_update_cost_check, update_cost_check): New static
variables.
(update_copy_costs): Increment update_cost_check. Call
update_copy_costs_1.
(coalesce_allocnos): Don't coalesce already assigned allocnos or
copies with null insn.
(color_pass): Check loop tree node of the subloop allocno.
(finish_allocno_priorities): Remove.
(do_coloring): Move allocation/deallocation of
consideration_allocno_bitmap into initiate_cost_update and
finish_cost_update.
(reassign_conflict_allocnos): Remove allocation/deallocation of
sorted_allocnos. Remove call of finish_allocno_priorities.
(reassign_pseudos): Remove allocation/deallocation of
consideration_allocno_bitmap and sorted_allocnos. Remove call of
finish_allocno_priorities.
(initiate_ira_assign, finish_ira_assign): New fucntions.
(ira_color): Remove allocation/deallocation of sorted_allocnos.
Call initiate_ira_assign and finish_ira_assign.
* postreload.c (gate_handle_postreload): Don't do post reload
optimizations unless the reload is completed.
* cfgloopanal.c (estimate_reg_pressure_cost): Return zero if we
use regional RA.
* recog.c (peep2_free_reg_search_ofs): New static variable.
(peep2_find_free_register): Remove search_ofs. Use
peep2_free_reg_search_ofs instead of it.
(peephole2_optimize): Reset peep2_free_reg_search_ofs.
Index: cfgloopanal.c
===================================================================
--- cfgloopanal.c (revision 131021)
+++ cfgloopanal.c (working copy)
@@ -374,6 +374,10 @@ estimate_reg_pressure_cost (unsigned n_n
{
unsigned regs_needed = n_new + n_old;
+ if (flag_ira)
+ /* Let IRA itself to deal with high register pressure. */
+ return 0;
+
/* If we have enough registers, we should use them and not restrict
the transformations unnecessarily. */
if (regs_needed + target_res_regs <= target_avail_regs)
Index: ira-color.c
===================================================================
--- ira-color.c (revision 131452)
+++ ira-color.c (working copy)
@@ -1834,21 +1834,21 @@ allocno_reload_assign (allocno_t a, HARD
the hard register, and mark that register live. */
if (reg_renumber[regno] >= 0)
{
- if (internal_flag_ira_verbose > 3 && stderr != NULL)
- fprintf (stderr, ": reassign to %d", reg_renumber[regno]);
+ if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
+ fprintf (ira_dump_file, ": reassign to %d", reg_renumber[regno]);
SET_REGNO (regno_reg_rtx[regno], reg_renumber[regno]);
mark_home_live (regno);
}
- if (internal_flag_ira_verbose > 3 && stderr != NULL)
- fprintf (stderr, "\n");
+ if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
+ fprintf (ira_dump_file, "\n");
return reg_renumber[regno] >= 0;
}
-/* The function is used to sort pseudos according their usage
- frequencies (putting most frequently ones first). */
-static int
+/* The function is used to sort pseudo register numbers according
+ their usage frequencies (putting most frequently ones first). */
+int
pseudo_reg_compare (const void *v1p, const void *v2p)
{
int regno1 = *(int *) v1p;
Index: ira.h
===================================================================
--- ira.h (revision 131452)
+++ ira.h (working copy)
@@ -62,6 +62,7 @@ extern void sort_insn_chain (int);
extern void ira (FILE *);
extern void mark_allocation_change (int);
extern void mark_memory_move_deletion (int, int);
+extern int pseudo_reg_compare (const void *, const void *);
extern int reassign_pseudos (int *, int, HARD_REG_SET, HARD_REG_SET *,
HARD_REG_SET *, bitmap);
extern rtx reuse_stack_slot (int, unsigned int, unsigned int);
Index: reload1.c
===================================================================
--- reload1.c (revision 131452)
+++ reload1.c (working copy)
@@ -689,20 +689,6 @@ static int failure;
/* Temporary array of pseudo-register number. */
static int *temp_pseudo_reg_arr;
-/* The function is used to sort pseudos according their usage
- frequencies (putting most frequently ones first). */
-static int
-pseudo_reg_compare (const void *v1p, const void *v2p)
-{
- int regno1 = *(int *) v1p;
- int regno2 = *(int *) v2p;
- int diff;
-
- if ((diff = REG_FREQ (regno2) - REG_FREQ (regno1)) != 0)
- return diff;
- return regno1 - regno2;
-}
-
/* Main entry point for the reload pass.
FIRST is the first insn of the function being compiled.