From 2bae4acc54e8f37edc1d5e913c6be6f8284fe3cf Mon Sep 17 00:00:00 2001 From: vmakarov Date: Wed, 3 Sep 2008 20:20:57 +0000 Subject: [PATCH] 2008-09-03 Vladimir Makarov PR rtl-opt/37243 * ira-int.h (ira_loop_tree_node): Rename mentioned_allocnos to all_allocnos. * ira-color.c (print_loop_title): Use all_allocnos. (color_pass): Ditto. Don't add border_allocnos. Check that subloop allocno in the correspdoning bitmap all_allocnos. * ira-emit.c (change_loop): Use all_allocnos. * ira-build.c (create_loop_tree_nodes, finish_loop_tree_node): Ditto. (ira_create_allocno): Set up all_allocnos bit for the created allocno. (create_cap_allocno): Remove setting mentioned_allocnos. (create_insn_allocnos): Ditto. (remove_unnecessary_allocnos): Use all_allocnos. (check_allocno_creation): Check that allocnos are in the corresponding bitmap all_allocnos. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139952 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 23 +++++++++++++++++++++++ gcc/ira-build.c | 36 ++++++++++++++++-------------------- gcc/ira-color.c | 20 +++++++++----------- gcc/ira-emit.c | 2 +- gcc/ira-int.h | 11 ++++++----- 5 files changed, 55 insertions(+), 37 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 60a17b2..42f70cd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -7,6 +7,29 @@ 2008-09-03 Vladimir Makarov PR rtl-opt/37243 + + * ira-int.h (ira_loop_tree_node): Rename mentioned_allocnos to + all_allocnos. + + * ira-color.c (print_loop_title): Use all_allocnos. + (color_pass): Ditto. Don't add border_allocnos. Check that + subloop allocno in the correspdoning bitmap all_allocnos. + + * ira-emit.c (change_loop): Use all_allocnos. + + * ira-build.c (create_loop_tree_nodes, finish_loop_tree_node): + Ditto. + (ira_create_allocno): Set up all_allocnos bit for the created + allocno. + (create_cap_allocno): Remove setting mentioned_allocnos. + (create_insn_allocnos): Ditto. + (remove_unnecessary_allocnos): Use all_allocnos. + (check_allocno_creation): Check that allocnos are in the + corresponding bitmap all_allocnos. + +2008-09-03 Vladimir Makarov + + PR rtl-opt/37243 * ira-conflicts.c (REG_SUBREG_P, go_through_subreg): New. (process_regs_for_copy): Process subregs. Refine check when cost diff --git a/gcc/ira-build.c b/gcc/ira-build.c index 979a3c8..4f2fb8f 100644 --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -113,7 +113,7 @@ create_loop_tree_nodes (bool loops_p) ira_bb_nodes[i].regno_allocno_map = NULL; memset (ira_bb_nodes[i].reg_pressure, 0, sizeof (ira_bb_nodes[i].reg_pressure)); - ira_bb_nodes[i].mentioned_allocnos = NULL; + ira_bb_nodes[i].all_allocnos = NULL; ira_bb_nodes[i].modified_regnos = NULL; ira_bb_nodes[i].border_allocnos = NULL; ira_bb_nodes[i].local_copies = NULL; @@ -156,7 +156,7 @@ create_loop_tree_nodes (bool loops_p) sizeof (ira_allocno_t) * max_regno); memset (ira_loop_nodes[i].reg_pressure, 0, sizeof (ira_loop_nodes[i].reg_pressure)); - ira_loop_nodes[i].mentioned_allocnos = ira_allocate_bitmap (); + ira_loop_nodes[i].all_allocnos = ira_allocate_bitmap (); ira_loop_nodes[i].modified_regnos = ira_allocate_bitmap (); ira_loop_nodes[i].border_allocnos = ira_allocate_bitmap (); ira_loop_nodes[i].local_copies = ira_allocate_bitmap (); @@ -188,7 +188,7 @@ finish_loop_tree_node (ira_loop_tree_node_t loop) ira_free_bitmap (loop->local_copies); ira_free_bitmap (loop->border_allocnos); ira_free_bitmap (loop->modified_regnos); - ira_free_bitmap (loop->mentioned_allocnos); + ira_free_bitmap (loop->all_allocnos); ira_free (loop->regno_allocno_map); loop->regno_allocno_map = NULL; } @@ -212,8 +212,8 @@ finish_loop_tree_nodes (void) ira_free_bitmap (ira_bb_nodes[i].border_allocnos); if (ira_bb_nodes[i].modified_regnos != NULL) ira_free_bitmap (ira_bb_nodes[i].modified_regnos); - if (ira_bb_nodes[i].mentioned_allocnos != NULL) - ira_free_bitmap (ira_bb_nodes[i].mentioned_allocnos); + if (ira_bb_nodes[i].all_allocnos != NULL) + ira_free_bitmap (ira_bb_nodes[i].all_allocnos); if (ira_bb_nodes[i].regno_allocno_map != NULL) ira_free (ira_bb_nodes[i].regno_allocno_map); } @@ -437,6 +437,7 @@ ira_create_allocno (int regno, bool cap_p, ira_loop_tree_node_t loop_tree_node) ALLOCNO_CAP (a) = NULL; ALLOCNO_CAP_MEMBER (a) = NULL; ALLOCNO_NUM (a) = ira_allocnos_num; + bitmap_set_bit (loop_tree_node->all_allocnos, ALLOCNO_NUM (a)); ALLOCNO_CONFLICT_ALLOCNO_ARRAY (a) = NULL; ALLOCNO_CONFLICT_ALLOCNOS_NUM (a) = 0; COPY_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a), ira_no_alloc_regs); @@ -765,7 +766,6 @@ create_cap_allocno (ira_allocno_t a) ira_set_allocno_cover_class (cap, cover_class); ALLOCNO_AVAILABLE_REGS_NUM (cap) = ALLOCNO_AVAILABLE_REGS_NUM (a); ALLOCNO_CAP_MEMBER (cap) = a; - bitmap_set_bit (parent->mentioned_allocnos, ALLOCNO_NUM (cap)); ALLOCNO_CAP (a) = cap; ALLOCNO_COVER_CLASS_COST (cap) = ALLOCNO_COVER_CLASS_COST (a); ALLOCNO_MEMORY_COST (cap) = ALLOCNO_MEMORY_COST (a); @@ -1290,8 +1290,6 @@ create_insn_allocnos (rtx x, bool output_p) ALLOCNO_NREFS (a)++; ALLOCNO_FREQ (a) += REG_FREQ_FROM_BB (curr_bb); - bitmap_set_bit (ira_curr_loop_tree_node->mentioned_allocnos, - ALLOCNO_NUM (a)); if (output_p) bitmap_set_bit (ira_curr_loop_tree_node->modified_regnos, regno); } @@ -1709,7 +1707,7 @@ remove_unnecessary_allocnos (void) prev_a = a; ALLOCNO_LOOP_TREE_NODE (a) = parent; parent->regno_allocno_map[regno] = a; - bitmap_set_bit (parent->mentioned_allocnos, ALLOCNO_NUM (a)); + bitmap_set_bit (parent->all_allocnos, ALLOCNO_NUM (a)); } else { @@ -2358,20 +2356,18 @@ check_allocno_creation (void) FOR_EACH_ALLOCNO (a, ai) { - if (ALLOCNO_LOOP_TREE_NODE (a) == ira_loop_tree_root) + loop_tree_node = ALLOCNO_LOOP_TREE_NODE (a); + ira_assert (bitmap_bit_p (loop_tree_node->all_allocnos, + ALLOCNO_NUM (a))); + if (loop_tree_node == ira_loop_tree_root) continue; if (ALLOCNO_CAP_MEMBER (a) != NULL) - { - ira_assert (ALLOCNO_CAP (a) != NULL); - } + ira_assert (ALLOCNO_CAP (a) != NULL); else if (ALLOCNO_CAP (a) == NULL) - { - loop_tree_node = ALLOCNO_LOOP_TREE_NODE (a); - ira_assert (loop_tree_node->parent - ->regno_allocno_map[ALLOCNO_REGNO (a)] != NULL - && bitmap_bit_p (loop_tree_node->border_allocnos, - ALLOCNO_NUM (a))); - } + ira_assert (loop_tree_node->parent + ->regno_allocno_map[ALLOCNO_REGNO (a)] != NULL + && bitmap_bit_p (loop_tree_node->border_allocnos, + ALLOCNO_NUM (a))); } } #endif diff --git a/gcc/ira-color.c b/gcc/ira-color.c index 71e3f68..8afc010 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -1606,13 +1606,13 @@ print_loop_title (ira_loop_tree_node_t loop_tree_node) ira_assert (loop_tree_node->loop != NULL); fprintf (ira_dump_file, - "\n Loop %d (parent %d, header bb%d, depth %d)\n ref:", + "\n Loop %d (parent %d, header bb%d, depth %d)\n all:", loop_tree_node->loop->num, (loop_tree_node->parent == NULL ? -1 : loop_tree_node->parent->loop->num), loop_tree_node->loop->header->index, loop_depth (loop_tree_node->loop)); - EXECUTE_IF_SET_IN_BITMAP (loop_tree_node->mentioned_allocnos, 0, j, bi) + EXECUTE_IF_SET_IN_BITMAP (loop_tree_node->all_allocnos, 0, j, bi) fprintf (ira_dump_file, " %dr%d", j, ALLOCNO_REGNO (ira_allocnos[j])); fprintf (ira_dump_file, "\n modified regnos:"); EXECUTE_IF_SET_IN_BITMAP (loop_tree_node->modified_regnos, 0, j, bi) @@ -1654,8 +1654,7 @@ color_pass (ira_loop_tree_node_t loop_tree_node) if (internal_flag_ira_verbose > 1 && ira_dump_file != NULL) print_loop_title (loop_tree_node); - bitmap_copy (coloring_allocno_bitmap, loop_tree_node->mentioned_allocnos); - bitmap_ior_into (coloring_allocno_bitmap, loop_tree_node->border_allocnos); + bitmap_copy (coloring_allocno_bitmap, loop_tree_node->all_allocnos); bitmap_copy (consideration_allocno_bitmap, coloring_allocno_bitmap); EXECUTE_IF_SET_IN_BITMAP (consideration_allocno_bitmap, 0, j, bi) { @@ -1669,7 +1668,7 @@ color_pass (ira_loop_tree_node_t loop_tree_node) /* Process caps. They are processed just once. */ if (flag_ira_algorithm == IRA_ALGORITHM_MIXED || flag_ira_algorithm == IRA_ALGORITHM_REGIONAL) - EXECUTE_IF_SET_IN_BITMAP (loop_tree_node->mentioned_allocnos, 0, j, bi) + EXECUTE_IF_SET_IN_BITMAP (loop_tree_node->all_allocnos, 0, j, bi) { a = ira_allocnos[j]; if (ALLOCNO_CAP_MEMBER (a) == NULL) @@ -1725,12 +1724,11 @@ color_pass (ira_loop_tree_node_t loop_tree_node) if (subloop_allocno == NULL || ALLOCNO_CAP (subloop_allocno) != NULL) continue; - if ((flag_ira_algorithm == IRA_ALGORITHM_MIXED - && (loop_tree_node->reg_pressure[rclass] - <= ira_available_class_regs[rclass])) - || (hard_regno < 0 - && ! bitmap_bit_p (subloop_node->mentioned_allocnos, - ALLOCNO_NUM (subloop_allocno)))) + ira_assert (bitmap_bit_p (subloop_node->all_allocnos, + ALLOCNO_NUM (subloop_allocno))); + if (flag_ira_algorithm == IRA_ALGORITHM_MIXED + && (loop_tree_node->reg_pressure[rclass] + <= ira_available_class_regs[rclass])) { if (! ALLOCNO_ASSIGNED_P (subloop_allocno)) { diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c index d18be80..1119923 100644 --- a/gcc/ira-emit.c +++ b/gcc/ira-emit.c @@ -424,7 +424,7 @@ change_loop (ira_loop_tree_node_t node) might get the different hard register. So we need to change ALLOCNO_REG. */ bitmap_and_compl (local_allocno_bitmap, - ira_curr_loop_tree_node->mentioned_allocnos, + ira_curr_loop_tree_node->all_allocnos, ira_curr_loop_tree_node->border_allocnos); EXECUTE_IF_SET_IN_REG_SET (local_allocno_bitmap, 0, i, bi) { diff --git a/gcc/ira-int.h b/gcc/ira-int.h index f656cf1..5f88e27 100644 --- a/gcc/ira-int.h +++ b/gcc/ira-int.h @@ -111,16 +111,17 @@ struct ira_loop_tree_node (defined only for the cover classes). */ int reg_pressure[N_REG_CLASSES]; - /* Numbers of allocnos referred in the loop node. */ - bitmap mentioned_allocnos; + /* Numbers of allocnos referred or living in the loop node (except + for its subloops). */ + bitmap all_allocnos; + + /* Numbers of allocnos living at the loop borders. */ + bitmap border_allocnos; /* Regnos of pseudos modified in the loop node (including its subloops). */ bitmap modified_regnos; - /* Numbers of allocnos living at the loop borders. */ - bitmap border_allocnos; - /* Numbers of copies referred in the corresponding loop. */ bitmap local_copies; }; -- 2.7.4