From: Chung-Ju Wu Date: Fri, 21 Nov 2014 05:51:12 +0000 (+0000) Subject: [NDS32] Look into LO_SUM's operand to determine whether it is a valid address. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=344250256199f46aba4be2d35f966cb557d70344;p=gcc.git [NDS32] Look into LO_SUM's operand to determine whether it is a valid address. gcc/ * config/nds32/nds32.c (nds32_legitimate_address_p): For LO_SUM, we need to look into its operand to determine whether it is a valid address. From-SVN: r217904 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 09d1a264ccf..8cfdd62ff88 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-11-21 Chung-Ju Wu + + * config/nds32/nds32.c (nds32_legitimate_address_p): For LO_SUM, + we need to look into its operand to determine if it is a valid + address. + 2014-11-21 Chung-Ju Wu * config/nds32/nds32.c (nds32_emit_stack_push_multiple): Add new diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index 74ea4e6563f..5a8e24fc175 100644 --- a/gcc/config/nds32/nds32.c +++ b/gcc/config/nds32/nds32.c @@ -2041,8 +2041,14 @@ nds32_legitimate_address_p (machine_mode mode, rtx x, bool strict) return false; case LO_SUM: - if (!TARGET_GP_DIRECT) - return true; + /* (mem (lo_sum (reg) (symbol_ref))) */ + /* (mem (lo_sum (reg) (const))) */ + gcc_assert (REG_P (XEXP (x, 0))); + if (GET_CODE (XEXP (x, 1)) == SYMBOL_REF + || GET_CODE (XEXP (x, 1)) == CONST) + return nds32_legitimate_address_p (mode, XEXP (x, 1), strict); + else + return false; default: return false;