diff options
author | Bernd Schmidt <bernds@codesourcery.com> | 2010-06-24 23:27:58 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2010-06-24 23:27:58 +0000 |
commit | 029da7d4c4d254bab10530df618ac6af91707876 (patch) | |
tree | 01e336c2a7447c11643f8c1e81a8184f232b64dc | |
parent | 3c55880a94aeb7595b6e109c406749f48791901e (diff) | |
download | gcc-029da7d4c4d254bab10530df618ac6af91707876.tar.gz |
ira-int.h (ira_parent_allocno, [...]): Declare.
* ira-int.h (ira_parent_allocno, ira_parent_or_cap_allocno): Declare.
* ira-build.c (ira_parent_allocno, ira_parent_or_cap_allocno): New
functions.
(ira_flattening): Use ira_parent_allocno.
* ira-conflicts.c (process_regs_for_copy, propagate_copies)
build_allocno_conflicts): Use ira_parent_or_cap_allocno.
From-SVN: r161347
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ira-build.c | 43 | ||||
-rw-r--r-- | gcc/ira-conflicts.c | 32 | ||||
-rw-r--r-- | gcc/ira-int.h | 2 |
4 files changed, 51 insertions, 33 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 843447c63bc..e807957ff8a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -26,6 +26,13 @@ (make_regno_born, make_regno_dead, mark_reg_live, mark_reg_dead, set_allocno_live, clear_allocno_live): Delete functions. + * ira-int.h (ira_parent_allocno, ira_parent_or_cap_allocno): Declare. + * ira-build.c (ira_parent_allocno, ira_parent_or_cap_allocno): New + functions. + (ira_flattening): Use ira_parent_allocno. + * ira-conflicts.c (process_regs_for_copy, propagate_copies) + build_allocno_conflicts): Use ira_parent_or_cap_allocno. + 2010-06-24 Richard Earnshaw <rearnsha@arm.com> * thumb2.md (thumb2_tlobits_cbranch): Delete. diff --git a/gcc/ira-build.c b/gcc/ira-build.c index 6900f44221b..3fa9dbaa773 100644 --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -2416,6 +2416,34 @@ create_caps (void) IR with one region. */ static ira_allocno_t *regno_top_level_allocno_map; +/* Find the allocno that corresponds to A at a level one higher up in the + loop tree. Returns NULL if A is a cap, or if it has no parent. */ +ira_allocno_t +ira_parent_allocno (ira_allocno_t a) +{ + ira_loop_tree_node_t parent; + + if (ALLOCNO_CAP (a) != NULL) + return NULL; + + parent = ALLOCNO_LOOP_TREE_NODE (a)->parent; + if (parent == NULL) + return NULL; + + return parent->regno_allocno_map[ALLOCNO_REGNO (a)]; +} + +/* Find the allocno that corresponds to A at a level one higher up in the + loop tree. If ALLOCNO_CAP is set for A, return that. */ +ira_allocno_t +ira_parent_or_cap_allocno (ira_allocno_t a) +{ + if (ALLOCNO_CAP (a) != NULL) + return ALLOCNO_CAP (a); + + return ira_parent_allocno (a); +} + /* Process all allocnos originated from pseudo REGNO and copy live ranges, hard reg conflicts, and allocno stack reg attributes from low level allocnos to final allocnos which are destinations of @@ -2478,7 +2506,7 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) enum reg_class cover_class; ira_allocno_t a, parent_a, first, second, node_first, node_second; ira_copy_t cp; - ira_loop_tree_node_t parent, node; + ira_loop_tree_node_t node; allocno_live_range_t r; ira_allocno_iterator ai; ira_copy_iterator ci; @@ -2513,10 +2541,8 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) ira_assert (ALLOCNO_CAP_MEMBER (a) == NULL); if (ALLOCNO_SOMEWHERE_RENAMED_P (a)) new_pseudos_p = true; - if (ALLOCNO_CAP (a) != NULL - || (parent = ALLOCNO_LOOP_TREE_NODE (a)->parent) == NULL - || ((parent_a = parent->regno_allocno_map[ALLOCNO_REGNO (a)]) - == NULL)) + parent_a = ira_parent_allocno (a); + if (parent_a == NULL) { ALLOCNO_COPIES (a) = NULL; regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))] = a; @@ -2564,11 +2590,8 @@ ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit) ALLOCNO_COVER_CLASS_COST (parent_a) -= ALLOCNO_COVER_CLASS_COST (a); ALLOCNO_MEMORY_COST (parent_a) -= ALLOCNO_MEMORY_COST (a); - if (ALLOCNO_CAP (parent_a) != NULL - || (parent - = ALLOCNO_LOOP_TREE_NODE (parent_a)->parent) == NULL - || (parent_a = (parent->regno_allocno_map - [ALLOCNO_REGNO (parent_a)])) == NULL) + parent_a = ira_parent_allocno (parent_a); + if (parent_a == NULL) break; } ALLOCNO_COPIES (a) = NULL; diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c index 70100acbb7f..9b6615051d5 100644 --- a/gcc/ira-conflicts.c +++ b/gcc/ira-conflicts.c @@ -346,7 +346,6 @@ process_regs_for_copy (rtx reg1, rtx reg2, bool constraint_p, 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); @@ -397,7 +396,7 @@ process_regs_for_copy (rtx reg1, rtx reg2, bool constraint_p, cost = ira_get_register_move_cost (mode, cover_class, rclass) * freq; else cost = ira_get_register_move_cost (mode, rclass, cover_class) * freq; - for (;;) + do { ira_allocate_and_set_costs (&ALLOCNO_HARD_REG_COSTS (a), cover_class, @@ -408,12 +407,9 @@ process_regs_for_copy (rtx reg1, rtx reg2, bool constraint_p, 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; + a = ira_parent_or_cap_allocno (a); } + while (a != NULL); return true; } @@ -533,7 +529,6 @@ propagate_copies (void) ira_copy_t cp; ira_copy_iterator ci; ira_allocno_t a1, a2, parent_a1, parent_a2; - ira_loop_tree_node_t parent; FOR_EACH_COPY (cp, ci) { @@ -542,11 +537,8 @@ propagate_copies (void) if (ALLOCNO_LOOP_TREE_NODE (a1) == ira_loop_tree_root) continue; ira_assert ((ALLOCNO_LOOP_TREE_NODE (a2) != ira_loop_tree_root)); - parent = ALLOCNO_LOOP_TREE_NODE (a1)->parent; - if ((parent_a1 = ALLOCNO_CAP (a1)) == NULL) - parent_a1 = parent->regno_allocno_map[ALLOCNO_REGNO (a1)]; - if ((parent_a2 = ALLOCNO_CAP (a2)) == NULL) - parent_a2 = parent->regno_allocno_map[ALLOCNO_REGNO (a2)]; + parent_a1 = ira_parent_or_cap_allocno (a1); + parent_a2 = ira_parent_or_cap_allocno (a2); ira_assert (parent_a1 != NULL && parent_a2 != NULL); if (! CONFLICT_ALLOCNO_P (parent_a1, parent_a2)) ira_add_allocno_copy (parent_a1, parent_a2, cp->freq, @@ -565,7 +557,6 @@ build_allocno_conflicts (ira_allocno_t a) { int i, px, parent_num; int conflict_bit_vec_words_num; - ira_loop_tree_node_t parent; ira_allocno_t parent_a, another_a, another_parent_a; ira_allocno_t *vec; IRA_INT_TYPE *allocno_conflicts; @@ -601,13 +592,9 @@ build_allocno_conflicts (ira_allocno_t a) ALLOCNO_CONFLICT_ALLOCNO_ARRAY_SIZE (a) = conflict_bit_vec_words_num * sizeof (IRA_INT_TYPE); } - parent = ALLOCNO_LOOP_TREE_NODE (a)->parent; - if ((parent_a = ALLOCNO_CAP (a)) == NULL - && (parent == NULL - || (parent_a = parent->regno_allocno_map[ALLOCNO_REGNO (a)]) - == NULL)) + parent_a = ira_parent_or_cap_allocno (a); + if (parent_a == NULL) return; - ira_assert (parent != NULL); ira_assert (ALLOCNO_COVER_CLASS (a) == ALLOCNO_COVER_CLASS (parent_a)); parent_num = ALLOCNO_NUM (parent_a); FOR_EACH_ALLOCNO_IN_SET (allocno_conflicts, @@ -616,9 +603,8 @@ build_allocno_conflicts (ira_allocno_t a) another_a = ira_conflict_id_allocno_map[i]; ira_assert (ira_reg_classes_intersect_p [ALLOCNO_COVER_CLASS (a)][ALLOCNO_COVER_CLASS (another_a)]); - if ((another_parent_a = ALLOCNO_CAP (another_a)) == NULL - && (another_parent_a = (parent->regno_allocno_map - [ALLOCNO_REGNO (another_a)])) == NULL) + another_parent_a = ira_parent_or_cap_allocno (another_a); + if (another_parent_a == NULL) continue; ira_assert (ALLOCNO_NUM (another_parent_a) >= 0); ira_assert (ALLOCNO_COVER_CLASS (another_a) diff --git a/gcc/ira-int.h b/gcc/ira-int.h index e56e0518945..b873b939cca 100644 --- a/gcc/ira-int.h +++ b/gcc/ira-int.h @@ -838,6 +838,8 @@ extern void ira_debug_allocno_copies (ira_allocno_t); extern void ira_traverse_loop_tree (bool, ira_loop_tree_node_t, void (*) (ira_loop_tree_node_t), void (*) (ira_loop_tree_node_t)); +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_set_allocno_cover_class (ira_allocno_t, enum reg_class); extern bool ira_conflict_vector_profitable_p (ira_allocno_t, int); |