[PATCH][PR64971]Convert function pointer to Pmode when emit call.

gcc/

2016-08-04  Renlin Li  <renlin.li@arm.com>

	PR middle-end/64971
	* calls.c (prepare_call_address): Convert funexp to Pmode when
	necessary.
	* config/aarch64/aarch64.md (sibcall): Remove fix for PR 64971.
	(sibcall_value): Likewise.

From-SVN: r239300
This commit is contained in:
Renlin Li 2016-08-09 17:20:14 +00:00 committed by Renlin Li
parent d676d623eb
commit 408702b445
3 changed files with 20 additions and 18 deletions

View file

@ -1,3 +1,11 @@
2016-08-09 Renlin Li <renlin.li@arm.com>
PR middle-end/64971
* calls.c (prepare_call_address): Convert funexp to Pmode when
necessary.
* config/aarch64/aarch64.md (sibcall): Remove fix for PR 64971.
(sibcall_value): Likewise.
2016-08-09 Marek Polacek <polacek@redhat.com>
PR c/7652

View file

@ -194,10 +194,19 @@ prepare_call_address (tree fndecl_or_type, rtx funexp, rtx static_chain_value,
&& targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
? force_not_mem (memory_address (FUNCTION_MODE, funexp))
: memory_address (FUNCTION_MODE, funexp));
else if (! sibcallp)
else
{
if (!NO_FUNCTION_CSE && optimize && ! flag_no_function_cse)
funexp = force_reg (Pmode, funexp);
/* funexp could be a SYMBOL_REF represents a function pointer which is
of ptr_mode. In this case, it should be converted into address mode
to be a valid address for memory rtx pattern. See PR 64971. */
if (GET_MODE (funexp) != Pmode)
funexp = convert_memory_address (Pmode, funexp);
if (! sibcallp)
{
if (!NO_FUNCTION_CSE && optimize && ! flag_no_function_cse)
funexp = force_reg (Pmode, funexp);
}
}
if (static_chain_value != 0

View file

@ -859,13 +859,6 @@
|| aarch64_is_noplt_call_p (callee)))
XEXP (operands[0], 0) = force_reg (Pmode, callee);
/* FIXME: This is a band-aid. Need to analyze why expand_expr_addr_expr
is generating an SImode symbol reference. See PR 64971. */
if (TARGET_ILP32
&& GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
&& GET_MODE (XEXP (operands[0], 0)) == SImode)
XEXP (operands[0], 0) = convert_memory_address (Pmode,
XEXP (operands[0], 0));
if (operands[2] == NULL_RTX)
operands[2] = const0_rtx;
@ -897,14 +890,6 @@
|| aarch64_is_noplt_call_p (callee)))
XEXP (operands[1], 0) = force_reg (Pmode, callee);
/* FIXME: This is a band-aid. Need to analyze why expand_expr_addr_expr
is generating an SImode symbol reference. See PR 64971. */
if (TARGET_ILP32
&& GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
&& GET_MODE (XEXP (operands[1], 0)) == SImode)
XEXP (operands[1], 0) = convert_memory_address (Pmode,
XEXP (operands[1], 0));
if (operands[3] == NULL_RTX)
operands[3] = const0_rtx;