From: Kaz Kojima Date: Fri, 19 Dec 2014 04:36:54 +0000 (+0000) Subject: lra-constraints.c (process_address_1): Swap base_term and index_term if INDEX_REG_CLA... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=70712859a1068dfd0683199fe6fa669280ecfec4;p=gcc.git lra-constraints.c (process_address_1): Swap base_term and index_term if INDEX_REG_CLASS is assigned to base_term... * lra-constraints.c (process_address_1): Swap base_term and index_term if INDEX_REG_CLASS is assigned to base_term already when INDEX_REG_CLASS is a single register class. From-SVN: r218885 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 72e8dfdc553..4d83cadb0ee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-12-19 Kaz Kojima + + * lra-constraints.c (process_address_1): Swap base_term and + index_term if INDEX_REG_CLASS is assigned to base_term already + when INDEX_REG_CLASS is a single register class. + 2014-12-18 Vladimir Makarov * lra-constraints.c (lra-constraints.c): Exchange places of sclass diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 23fd44db54a..8fc2cb77a5d 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -2834,6 +2834,20 @@ process_address_1 (int nop, bool check_only_p, decompose_mem_address (&ad, SUBREG_REG (op)); else return false; + /* If INDEX_REG_CLASS is assigned to base_term already and isn't to + index_term, swap them so to avoid assigning INDEX_REG_CLASS to both + when INDEX_REG_CLASS is a single register class. */ + if (ad.base_term != NULL + && ad.index_term != NULL + && ira_class_hard_regs_num[INDEX_REG_CLASS] == 1 + && REG_P (*ad.base_term) + && REG_P (*ad.index_term) + && in_class_p (*ad.base_term, INDEX_REG_CLASS, NULL) + && ! in_class_p (*ad.index_term, INDEX_REG_CLASS, NULL)) + { + std::swap (ad.base, ad.index); + std::swap (ad.base_term, ad.index_term); + } if (! check_only_p) change_p = equiv_address_substitution (&ad); if (ad.base_term != NULL