From 55c858c57495a6bd4d444faafa91dd07268e432e Mon Sep 17 00:00:00 2001 From: vmakarov Date: Thu, 4 Sep 2008 23:35:03 +0000 Subject: [PATCH] 2008-09-04 Vladimir Makarov * ira-conflicts.c (process_regs_for_copy): Check insn to check that the cost is already taken into account in ira-costs.c * ira-int.h (ira_debug_copy, ira_debug_copies): New. * ira-build.c (print_copy, print_copies, ira_debug_copy, ira_debug_copies): New. (ira_bulid): Call print_copies. * doc/tm.texi (IRA_COVER_CLASSES): Fix the description. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140014 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++++++++++ gcc/doc/tm.texi | 8 ++++---- gcc/ira-build.c | 36 ++++++++++++++++++++++++++++++++++++ gcc/ira-conflicts.c | 4 ++-- gcc/ira-int.h | 2 ++ 5 files changed, 57 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a18657bbfe..fc5515b310c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2008-09-04 Vladimir Makarov + + * ira-conflicts.c (process_regs_for_copy): Check insn to check + that the cost is already taken into account in ira-costs.c + + * ira-int.h (ira_debug_copy, ira_debug_copies): New. + + * ira-build.c (print_copy, print_copies, ira_debug_copy, + ira_debug_copies): New. + (ira_bulid): Call print_copies. + + * doc/tm.texi (IRA_COVER_CLASSES): Fix the description. + 2008-09-04 Samuel Tardieu PR target/32783 diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index d27dfbf9ab2..d6cdc5a679f 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -2830,10 +2830,10 @@ as below: The macro defines cover classes for the Integrated Register Allocator (@acronym{IRA}). Cover classes are a set of non-intersecting register classes covering all hard registers used for register allocation -purposes. Any move between two registers in the same cover class -should be cheaper than load or store of the registers. The macro -value should be the initializer for an array of register class values, -with @code{LIM_REG_CLASSES} used as the end marker. +purposes. If a move between two registers in the same cover class are +possible, it should be cheaper than a load or store of the registers. +The macro value should be the initializer for an array of register +class values, with @code{LIM_REG_CLASSES} used as the end marker. You must define this macro in order to use the integrated register allocator for the target. diff --git a/gcc/ira-build.c b/gcc/ira-build.c index 6bd49c0cd1b..b1f496c41df 100644 --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -1097,6 +1097,40 @@ ira_add_allocno_copy (ira_allocno_t first, ira_allocno_t second, int freq, return cp; } +/* Print info about copy CP into file F. */ +static void +print_copy (FILE *f, ira_copy_t cp) +{ + fprintf (f, " cp%d:a%d(r%d)<->a%d(r%d)@%d\n", cp->num, + ALLOCNO_NUM (cp->first), ALLOCNO_REGNO (cp->first), + ALLOCNO_NUM (cp->second), ALLOCNO_REGNO (cp->second), cp->freq); +} + +/* Print info about copy CP into stderr. */ +void +ira_debug_copy (ira_copy_t cp) +{ + print_copy (stderr, cp); +} + +/* Print info about all copies into file F. */ +static void +print_copies (FILE *f) +{ + ira_copy_t cp; + ira_copy_iterator ci; + + FOR_EACH_COPY (cp, ci) + print_copy (f, cp); +} + +/* Print info about all copies into stderr. */ +void +ira_debug_copies (void) +{ + print_copies (stderr); +} + /* Print info about copies involving allocno A into file F. */ static void print_allocno_copies (FILE *f, ira_allocno_t a) @@ -2409,6 +2443,8 @@ ira_build (bool loops_p) sort_conflict_id_allocno_map (); setup_min_max_conflict_allocno_ids (); ira_build_conflicts (); + if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL) + print_copies (ira_dump_file); if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL) { int n, nr; diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c index 97da7c563df..8b8c48582ea 100644 --- a/gcc/ira-conflicts.c +++ b/gcc/ira-conflicts.c @@ -371,8 +371,8 @@ process_regs_for_copy (rtx reg1, rtx reg2, rtx insn, int freq) cover_class = ALLOCNO_COVER_CLASS (a); if (! ira_class_subset_p[rclass][cover_class]) return false; - if (reg_class_size[rclass] <= (unsigned) CLASS_MAX_NREGS (rclass, mode) - && only_regs_p) + if (only_regs_p && insn != NULL_RTX + && reg_class_size[rclass] <= (unsigned) CLASS_MAX_NREGS (rclass, mode)) /* It is already taken into account in ira-costs.c. */ return false; index = ira_class_hard_reg_index[cover_class][hard_regno]; diff --git a/gcc/ira-int.h b/gcc/ira-int.h index 5f88e271a48..727eeae905c 100644 --- a/gcc/ira-int.h +++ b/gcc/ira-int.h @@ -838,6 +838,8 @@ extern rtx *ira_reg_equiv_const; extern ira_loop_tree_node_t ira_curr_loop_tree_node; extern ira_allocno_t *ira_curr_regno_allocno_map; +extern void ira_debug_copy (ira_copy_t); +extern void ira_debug_copies (void); extern void ira_debug_allocno_copies (ira_allocno_t); extern void ira_traverse_loop_tree (bool, ira_loop_tree_node_t, -- 2.11.4.GIT