From 344250256199f46aba4be2d35f966cb557d70344 Mon Sep 17 00:00:00 2001 From: Chung-Ju Wu Date: Fri, 21 Nov 2014 05:51:12 +0000 Subject: [PATCH] [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 --- gcc/ChangeLog | 6 ++++++ gcc/config/nds32/nds32.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) 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; -- 2.30.2