diff options
author | Paul Brook <paul@codesourcery.com> | 2006-03-29 16:33:54 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2006-03-29 16:33:54 +0000 |
commit | 67f074899d00a173c0efbca542cc8defb76ce790 (patch) | |
tree | 77d8d2307aa0441bb90fbee6a72741a4bbed79f7 /gcc | |
parent | 531e214a01d19e889065032689d727cb754861ce (diff) | |
download | gcc-67f074899d00a173c0efbca542cc8defb76ce790.zip gcc-67f074899d00a173c0efbca542cc8defb76ce790.tar.gz gcc-67f074899d00a173c0efbca542cc8defb76ce790.tar.bz2 |
reload1.c (choose_reload_regs): Check for all RTX_AUTOINC operators.
2006-03-29 Paul Brook <paul@codesourcery.com>
* reload1.c (choose_reload_regs): Check for all RTX_AUTOINC operators.
(inc_for_reload): Handle PRE_MODIFY and POST_MODIFY addresses.
From-SVN: r112500
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/reload1.c | 27 |
2 files changed, 23 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7ab85ea..19e54d9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2006-03-29 Paul Brook <paul@codesourcery.com> + * reload1.c (choose_reload_regs): Check for all RTX_AUTOINC operators. + (inc_for_reload): Handle PRE_MODIFY and POST_MODIFY addresses. + +2006-03-29 Paul Brook <paul@codesourcery.com> + PR middle-end/23623 * targhooks.c (default_narrow_bitfield): New fuction. * targhooks.h (default_narrow_bitfield): add prototype. diff --git a/gcc/reload1.c b/gcc/reload1.c index a735cfe..b9d7f8e 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -5505,10 +5505,7 @@ choose_reload_regs (struct insn_chain *chain) mode = GET_MODE (rld[r].in_reg); } #ifdef AUTO_INC_DEC - else if ((GET_CODE (rld[r].in_reg) == PRE_INC - || GET_CODE (rld[r].in_reg) == PRE_DEC - || GET_CODE (rld[r].in_reg) == POST_INC - || GET_CODE (rld[r].in_reg) == POST_DEC) + else if (GET_RTX_CLASS (GET_CODE (rld[r].in_reg)) == RTX_AUTOINC && REG_P (XEXP (rld[r].in_reg, 0))) { regno = REGNO (XEXP (rld[r].in_reg, 0)); @@ -8115,7 +8112,8 @@ inc_for_reload (rtx reloadreg, rtx in, rtx value, int inc_amount) /* REG or MEM to be copied and incremented. */ rtx incloc = XEXP (value, 0); /* Nonzero if increment after copying. */ - int post = (GET_CODE (value) == POST_DEC || GET_CODE (value) == POST_INC); + int post = (GET_CODE (value) == POST_DEC || GET_CODE (value) == POST_INC + || GET_CODE (value) == POST_MODIFY); rtx last; rtx inc; rtx add_insn; @@ -8130,10 +8128,18 @@ inc_for_reload (rtx reloadreg, rtx in, rtx value, int inc_amount) if (REG_P (incloc)) reg_last_reload_reg[REGNO (incloc)] = 0; - if (GET_CODE (value) == PRE_DEC || GET_CODE (value) == POST_DEC) - inc_amount = -inc_amount; + if (GET_CODE (value) == PRE_MODIFY || GET_CODE (value) == POST_MODIFY) + { + gcc_assert (GET_CODE (XEXP (value, 1)) == PLUS); + inc = XEXP (XEXP (value, 1), 1); + } + else + { + if (GET_CODE (value) == PRE_DEC || GET_CODE (value) == POST_DEC) + inc_amount = -inc_amount; - inc = GEN_INT (inc_amount); + inc = GEN_INT (inc_amount); + } /* If this is post-increment, first copy the location to the reload reg. */ if (post && real_in != reloadreg) @@ -8193,7 +8199,10 @@ inc_for_reload (rtx reloadreg, rtx in, rtx value, int inc_amount) emit_insn (gen_add2_insn (reloadreg, inc)); store = emit_insn (gen_move_insn (incloc, reloadreg)); - emit_insn (gen_add2_insn (reloadreg, GEN_INT (-inc_amount))); + if (GET_CODE (inc) == CONST_INT) + emit_insn (gen_add2_insn (reloadreg, GEN_INT (-INTVAL(inc)))); + else + emit_insn (gen_sub2_insn (reloadreg, inc)); } return store; |