From ec2d68da4f4b40f3931366fd7492fffd30ab9cfe Mon Sep 17 00:00:00 2001 From: jasonwucj 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217904 138bc75d-0d04-0410-961f-82ee72b054a4 --- 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 09d1a26..8cfdd62 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 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 vaarg_p argument and create correct CFI info. (nds32_expand_prologue): Pass true or false to diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index 74ea4e6..5a8e24f 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.7.4