summaryrefslogtreecommitdiff
path: root/gcc/reload1.c
diff options
context:
space:
mode:
authorBin Cheng <bin.cheng@arm.com>2012-05-04 02:52:27 +0000
committerBin Cheng <amker@gcc.gnu.org>2012-05-04 02:52:27 +0000
commit73292fcf29ebad0ff753d0d57d7bef3677187b0e (patch)
treeb353a2df6244bb00d33f5acdd7a5bbea679cfe7f /gcc/reload1.c
parent244541410209602edc266168fdb1adba099eee88 (diff)
downloadgcc-73292fcf29ebad0ff753d0d57d7bef3677187b0e.tar.gz
re PR rtl-optimization/52804 (IRA/RELOAD allocate wrong register on ARM for cortex-m0)
PR rtl-optimization/52804 * reload1.c (reload_reg_reaches_end_p): Check whether successor reload with type RELOAD_FOR_INPUT_ADDRESS kills reload register of current one with type RELOAD_FOR_INPADDR_ADDRESS. Same stands for reloads with type RELOAD_FOR_OUTPUT_ADDRESS and RELOAD_FOR_OUTADDR_ADDRESS. From-SVN: r187139
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r--gcc/reload1.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 71cea8171d4..359a89313f0 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -5429,6 +5429,13 @@ reload_reg_reaches_end_p (unsigned int regno, int reloadnum)
if (TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno))
return 0;
+ /* Reload register of reload with type RELOAD_FOR_INPADDR_ADDRESS
+ could be killed if the register is also used by reload with type
+ RELOAD_FOR_INPUT_ADDRESS, so check it. */
+ if (type == RELOAD_FOR_INPADDR_ADDRESS
+ && TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[opnum], regno))
+ return 0;
+
for (i = opnum + 1; i < reload_n_operands; i++)
if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
|| TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno))
@@ -5503,6 +5510,13 @@ reload_reg_reaches_end_p (unsigned int regno, int reloadnum)
|| TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[i], regno))
return 0;
+ /* Reload register of reload with type RELOAD_FOR_OUTADDR_ADDRESS
+ could be killed if the register is also used by reload with type
+ RELOAD_FOR_OUTPUT_ADDRESS, so check it. */
+ if (type == RELOAD_FOR_OUTADDR_ADDRESS
+ && TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[opnum], regno))
+ return 0;
+
return 1;
default: