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 /gcc/ira-build.c | |
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
Diffstat (limited to 'gcc/ira-build.c')
-rw-r--r-- | gcc/ira-build.c | 43 |
1 files changed, 33 insertions, 10 deletions
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; |