From bd379f7328b2ff3b17f5845dbe49796f97a79c25 Mon Sep 17 00:00:00 2001 From: Pat Haugen Date: Thu, 6 Sep 2007 13:51:21 +0000 Subject: [PATCH] reload.c (find_reloads_address_1): Try to preserve original base/index regclass of operands. ChangeLog: 2007-09-06 Pat Haugen * reload.c (find_reloads_address_1): Try to preserve original base/index regclass of operands. * regrename.c (scan_rtx_address): Likewise. (replace_oldest_value_addr): Likewise. From-SVN: r128183 --- gcc/ChangeLog | 7 +++++++ gcc/regrename.c | 34 ++++++++++++++++------------------ gcc/reload.c | 20 ++++++++++---------- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 39caec6a6eb..87a376329b9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2007-09-06 Pat Haugen + + * reload.c (find_reloads_address_1): Try to preserve original + base/index regclass of operands. + * regrename.c (scan_rtx_address): Likewise. + (replace_oldest_value_addr): Likewise. + 2007-09-06 Richard Guenther PR tree-optimization/33302 diff --git a/gcc/regrename.c b/gcc/regrename.c index a15d675f4c5..74112c3ca53 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -559,20 +559,19 @@ scan_rtx_address (rtx insn, rtx *loc, enum reg_class cl, int index_op; unsigned regno0 = REGNO (op0), regno1 = REGNO (op1); - if (REGNO_OK_FOR_INDEX_P (regno0) - && regno_ok_for_base_p (regno1, mode, PLUS, REG)) + if (REGNO_OK_FOR_INDEX_P (regno1) + && regno_ok_for_base_p (regno0, mode, PLUS, REG)) + index_op = 1; + else if (REGNO_OK_FOR_INDEX_P (regno0) + && regno_ok_for_base_p (regno1, mode, PLUS, REG)) index_op = 0; - else if (REGNO_OK_FOR_INDEX_P (regno1) - && regno_ok_for_base_p (regno0, mode, PLUS, REG)) + else if (regno_ok_for_base_p (regno0, mode, PLUS, REG) + || REGNO_OK_FOR_INDEX_P (regno1)) index_op = 1; else if (regno_ok_for_base_p (regno1, mode, PLUS, REG)) index_op = 0; - else if (regno_ok_for_base_p (regno0, mode, PLUS, REG)) - index_op = 1; - else if (REGNO_OK_FOR_INDEX_P (regno1)) - index_op = 1; else - index_op = 0; + index_op = 1; locI = &XEXP (x, index_op); locB = &XEXP (x, !index_op); @@ -1476,20 +1475,19 @@ replace_oldest_value_addr (rtx *loc, enum reg_class cl, int index_op; unsigned regno0 = REGNO (op0), regno1 = REGNO (op1); - if (REGNO_OK_FOR_INDEX_P (regno0) - && regno_ok_for_base_p (regno1, mode, PLUS, REG)) + if (REGNO_OK_FOR_INDEX_P (regno1) + && regno_ok_for_base_p (regno0, mode, PLUS, REG)) + index_op = 1; + else if (REGNO_OK_FOR_INDEX_P (regno0) + && regno_ok_for_base_p (regno1, mode, PLUS, REG)) index_op = 0; - else if (REGNO_OK_FOR_INDEX_P (regno1) - && regno_ok_for_base_p (regno0, mode, PLUS, REG)) + else if (regno_ok_for_base_p (regno0, mode, PLUS, REG) + || REGNO_OK_FOR_INDEX_P (regno1)) index_op = 1; else if (regno_ok_for_base_p (regno1, mode, PLUS, REG)) index_op = 0; - else if (regno_ok_for_base_p (regno0, mode, PLUS, REG)) - index_op = 1; - else if (REGNO_OK_FOR_INDEX_P (regno1)) - index_op = 1; else - index_op = 0; + index_op = 1; locI = &XEXP (x, index_op); locB = &XEXP (x, !index_op); diff --git a/gcc/reload.c b/gcc/reload.c index 60e36ffc6c5..6eb380202e2 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -5464,16 +5464,12 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, else if (code0 == REG && code1 == REG) { - if (REGNO_OK_FOR_INDEX_P (REGNO (op0)) - && regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG)) + if (REGNO_OK_FOR_INDEX_P (REGNO (op1)) + && regno_ok_for_base_p (REGNO (op0), mode, PLUS, REG)) return 0; - else if (REGNO_OK_FOR_INDEX_P (REGNO (op1)) - && regno_ok_for_base_p (REGNO (op0), mode, PLUS, REG)) + else if (REGNO_OK_FOR_INDEX_P (REGNO (op0)) + && regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG)) return 0; - else if (regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG)) - find_reloads_address_1 (mode, orig_op0, 1, PLUS, SCRATCH, - &XEXP (x, 0), opnum, type, ind_levels, - insn); else if (regno_ok_for_base_p (REGNO (op0), mode, PLUS, REG)) find_reloads_address_1 (mode, orig_op1, 1, PLUS, SCRATCH, &XEXP (x, 1), opnum, type, ind_levels, @@ -5482,16 +5478,20 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, find_reloads_address_1 (mode, orig_op0, 0, PLUS, REG, &XEXP (x, 0), opnum, type, ind_levels, insn); + else if (regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG)) + find_reloads_address_1 (mode, orig_op0, 1, PLUS, SCRATCH, + &XEXP (x, 0), opnum, type, ind_levels, + insn); else if (REGNO_OK_FOR_INDEX_P (REGNO (op0))) find_reloads_address_1 (mode, orig_op1, 0, PLUS, REG, &XEXP (x, 1), opnum, type, ind_levels, insn); else { - find_reloads_address_1 (mode, orig_op0, 1, PLUS, SCRATCH, + find_reloads_address_1 (mode, orig_op0, 0, PLUS, REG, &XEXP (x, 0), opnum, type, ind_levels, insn); - find_reloads_address_1 (mode, orig_op1, 0, PLUS, REG, + find_reloads_address_1 (mode, orig_op1, 1, PLUS, SCRATCH, &XEXP (x, 1), opnum, type, ind_levels, insn); } -- 2.30.2