mirror of git://gcc.gnu.org/git/gcc.git
[NDS32] Consider -mcmodel=X in nds32_legitimate_address_p implementation.
gcc/ * config/nds32/nds32.c (nds32_legitimate_address_p): Consider TARGET_CMODEL_LARGE and TARGET_CMODEL_MEDIUM cases. From-SVN: r219515
This commit is contained in:
parent
511a41d799
commit
4855be8434
|
|
@ -1,3 +1,8 @@
|
||||||
|
2015-01-13 Chung-Ju Wu <jasonwucj@gmail.com>
|
||||||
|
|
||||||
|
* config/nds32/nds32.c (nds32_legitimate_address_p): Consider
|
||||||
|
TARGET_CMODEL_LARGE and TARGET_CMODEL_MEDIUM cases.
|
||||||
|
|
||||||
2015-01-13 Chung-Ju Wu <jasonwucj@gmail.com>
|
2015-01-13 Chung-Ju Wu <jasonwucj@gmail.com>
|
||||||
|
|
||||||
* config/nds32/nds32.h (NDS32_SYMBOL_FLAG_RODATA): Define our own
|
* config/nds32/nds32.h (NDS32_SYMBOL_FLAG_RODATA): Define our own
|
||||||
|
|
|
||||||
|
|
@ -1961,24 +1961,27 @@ nds32_legitimate_address_p (machine_mode mode, rtx x, bool strict)
|
||||||
return nds32_address_register_rtx_p (x, strict);
|
return nds32_address_register_rtx_p (x, strict);
|
||||||
|
|
||||||
case SYMBOL_REF:
|
case SYMBOL_REF:
|
||||||
|
/* (mem (symbol_ref A)) => [symbol_ref] */
|
||||||
if (!TARGET_GP_DIRECT
|
/* If -mcmodel=large, the 'symbol_ref' is not a valid address
|
||||||
|
during or after LRA/reload phase. */
|
||||||
|
if (TARGET_CMODEL_LARGE
|
||||||
|
&& (reload_completed
|
||||||
|
|| reload_in_progress
|
||||||
|
|| lra_in_progress))
|
||||||
|
return false;
|
||||||
|
/* If -mcmodel=medium and the symbol references to rodata section,
|
||||||
|
the 'symbol_ref' is not a valid address during or after
|
||||||
|
LRA/reload phase. */
|
||||||
|
if (TARGET_CMODEL_MEDIUM
|
||||||
|
&& NDS32_SYMBOL_REF_RODATA_P (x)
|
||||||
&& (reload_completed
|
&& (reload_completed
|
||||||
|| reload_in_progress
|
|| reload_in_progress
|
||||||
|| lra_in_progress))
|
|| lra_in_progress))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* (mem (symbol_ref A)) => [symbol_ref] */
|
return true;
|
||||||
return !currently_expanding_to_rtl;
|
|
||||||
|
|
||||||
case CONST:
|
case CONST:
|
||||||
|
|
||||||
if (!TARGET_GP_DIRECT
|
|
||||||
&& (reload_completed
|
|
||||||
|| reload_in_progress
|
|
||||||
|| lra_in_progress))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* (mem (const (...)))
|
/* (mem (const (...)))
|
||||||
=> [ + const_addr ], where const_addr = symbol_ref + const_int */
|
=> [ + const_addr ], where const_addr = symbol_ref + const_int */
|
||||||
if (GET_CODE (XEXP (x, 0)) == PLUS)
|
if (GET_CODE (XEXP (x, 0)) == PLUS)
|
||||||
|
|
@ -1989,9 +1992,30 @@ nds32_legitimate_address_p (machine_mode mode, rtx x, bool strict)
|
||||||
rtx op1 = XEXP (plus_op, 1);
|
rtx op1 = XEXP (plus_op, 1);
|
||||||
|
|
||||||
if (GET_CODE (op0) == SYMBOL_REF && CONST_INT_P (op1))
|
if (GET_CODE (op0) == SYMBOL_REF && CONST_INT_P (op1))
|
||||||
return true;
|
{
|
||||||
else
|
/* Now we see the [ + const_addr ] pattern, but we need
|
||||||
return false;
|
some further checking. */
|
||||||
|
/* If -mcmodel=large, the 'const_addr' is not a valid address
|
||||||
|
during or after LRA/reload phase. */
|
||||||
|
if (TARGET_CMODEL_LARGE
|
||||||
|
&& (reload_completed
|
||||||
|
|| reload_in_progress
|
||||||
|
|| lra_in_progress))
|
||||||
|
return false;
|
||||||
|
/* If -mcmodel=medium and the symbol references to rodata section,
|
||||||
|
the 'const_addr' is not a valid address during or after
|
||||||
|
LRA/reload phase. */
|
||||||
|
if (TARGET_CMODEL_MEDIUM
|
||||||
|
&& NDS32_SYMBOL_REF_RODATA_P (op0)
|
||||||
|
&& (reload_completed
|
||||||
|
|| reload_in_progress
|
||||||
|
|| lra_in_progress))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* At this point we can make sure 'const_addr' is a
|
||||||
|
valid address. */
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue