diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-20 22:49:07 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-20 22:49:07 +0000 |
commit | f7ace4bcd32b0127e0f50c2a6b6fd838fd356c9f (patch) | |
tree | ad5c9a81fe8ced03d64f7354f5cdb7c56da2c287 /gcc/ira-costs.c | |
parent | 53af708b4d4776566fd8dca68f4f9fd744716607 (diff) | |
download | gcc-f7ace4bcd32b0127e0f50c2a6b6fd838fd356c9f.tar.gz |
* ira.c (ira_non_ordered_class_hard_regs): Define.
(setup_class_hard_regs): Initialize ira_non_ordered_class_hard_regs.
* ira-int.h (ira_non_ordered_class_hard_regs): Declare.
* ira-costs.c (ira_tune_allocno_costs_and_cover_classes): Increase
cost of unaligned hard regs when allocating multi-reg pseudos.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159644 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ira-costs.c')
-rw-r--r-- | gcc/ira-costs.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index 76aadff0772..6942931bdd0 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -1773,5 +1773,32 @@ ira_tune_allocno_costs_and_cover_classes (void) } if (min_cost != INT_MAX) ALLOCNO_COVER_CLASS_COST (a) = min_cost; + + /* Some targets allow pseudos to be allocated to unaligned + sequences of hard registers. However, selecting an unaligned + sequence can unnecessarily restrict later allocations. So + increase the cost of unaligned hard regs to encourage the use + of aligned hard regs. */ + { + int nregs, index; + + if ((nregs = ira_reg_class_nregs[cover_class][ALLOCNO_MODE (a)]) > 1) + { + ira_allocate_and_set_costs + (&ALLOCNO_HARD_REG_COSTS (a), cover_class, + ALLOCNO_COVER_CLASS_COST (a)); + reg_costs = ALLOCNO_HARD_REG_COSTS (a); + for (j = n - 1; j >= 0; j--) + { + if (j % nregs != 0) + { + regno = ira_non_ordered_class_hard_regs[cover_class][j]; + index = ira_class_hard_reg_index[cover_class][regno]; + ira_assert (index != 0); + reg_costs[index] += ALLOCNO_FREQ (a); + } + } + } + } } } |