Commit d92f4df0 by John David Anglin

re PR target/59777 (Incorrect expansion of TLS arguments in a call)

	PR target/59777
	* config/pa/pa.c (legitimize_tls_address): Return original address
	if not passed a SYMBOL_REF rtx.
	(hppa_legitimize_address): Call legitimize_tls_address for all TLS
	addresses.
	(pa_emit_move_sequence): Simplify TLS source operands.
	(pa_legitimate_constant_p): Reject all TLS constants.
	* config/pa/pa.h (PA_SYMBOL_REF_TLS_P): Correct comment.
	(CONSTANT_ADDRESS_P): Reject TLS CONST addresses.

From-SVN: r207493
parent ba057b4e
2014-02-04 John David Anglin <danglin@gcc.gnu.org>
PR target/59777
* config/pa/pa.c (legitimize_tls_address): Return original address
if not passed a SYMBOL_REF rtx.
(hppa_legitimize_address): Call legitimize_tls_address for all TLS
addresses.
(pa_emit_move_sequence): Simplify TLS source operands.
(pa_legitimate_constant_p): Reject all TLS constants.
* config/pa/pa.h (PA_SYMBOL_REF_TLS_P): Correct comment.
(CONSTANT_ADDRESS_P): Reject TLS CONST addresses.
2014-02-04 Jan Hubicka <hubicka@ucw.cz> 2014-02-04 Jan Hubicka <hubicka@ucw.cz>
* ipa.c (function_and_variable_visibility): Decompose DECL_ONE_ONLY * ipa.c (function_and_variable_visibility): Decompose DECL_ONE_ONLY
......
...@@ -916,9 +916,12 @@ static rtx ...@@ -916,9 +916,12 @@ static rtx
legitimize_tls_address (rtx addr) legitimize_tls_address (rtx addr)
{ {
rtx ret, insn, tmp, t1, t2, tp; rtx ret, insn, tmp, t1, t2, tp;
enum tls_model model = SYMBOL_REF_TLS_MODEL (addr);
switch (model) /* Currently, we can't handle anything but a SYMBOL_REF. */
if (GET_CODE (addr) != SYMBOL_REF)
return addr;
switch (SYMBOL_REF_TLS_MODEL (addr))
{ {
case TLS_MODEL_GLOBAL_DYNAMIC: case TLS_MODEL_GLOBAL_DYNAMIC:
tmp = gen_reg_rtx (Pmode); tmp = gen_reg_rtx (Pmode);
...@@ -1039,7 +1042,7 @@ hppa_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, ...@@ -1039,7 +1042,7 @@ hppa_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
&& !REG_POINTER (XEXP (x, 1))) && !REG_POINTER (XEXP (x, 1)))
return gen_rtx_PLUS (Pmode, XEXP (x, 1), XEXP (x, 0)); return gen_rtx_PLUS (Pmode, XEXP (x, 1), XEXP (x, 0));
if (PA_SYMBOL_REF_TLS_P (x)) if (pa_tls_referenced_p (x))
return legitimize_tls_address (x); return legitimize_tls_address (x);
else if (flag_pic) else if (flag_pic)
return legitimize_pic_address (x, mode, gen_reg_rtx (Pmode)); return legitimize_pic_address (x, mode, gen_reg_rtx (Pmode));
...@@ -1920,9 +1923,10 @@ pa_emit_move_sequence (rtx *operands, enum machine_mode mode, rtx scratch_reg) ...@@ -1920,9 +1923,10 @@ pa_emit_move_sequence (rtx *operands, enum machine_mode mode, rtx scratch_reg)
not consider them legitimate constants. Loop optimizations can not consider them legitimate constants. Loop optimizations can
call the emit_move_xxx with one as a source. */ call the emit_move_xxx with one as a source. */
if ((GET_CODE (operand1) != HIGH && immediate_operand (operand1, mode)) if ((GET_CODE (operand1) != HIGH && immediate_operand (operand1, mode))
|| function_label_operand (operand1, VOIDmode)
|| (GET_CODE (operand1) == HIGH || (GET_CODE (operand1) == HIGH
&& symbolic_operand (XEXP (operand1, 0), mode))) && symbolic_operand (XEXP (operand1, 0), mode))
|| function_label_operand (operand1, VOIDmode)
|| pa_tls_referenced_p (operand1))
{ {
int ishighonly = 0; int ishighonly = 0;
...@@ -10300,7 +10304,7 @@ pa_legitimate_constant_p (enum machine_mode mode, rtx x) ...@@ -10300,7 +10304,7 @@ pa_legitimate_constant_p (enum machine_mode mode, rtx x)
/* TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC are not /* TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC are not
legitimate constants. The other variants can't be handled by legitimate constants. The other variants can't be handled by
the move patterns after reload starts. */ the move patterns after reload starts. */
if (PA_SYMBOL_REF_TLS_P (x)) if (pa_tls_referenced_p (x))
return false; return false;
if (TARGET_64BIT && GET_CODE (x) == CONST_DOUBLE) if (TARGET_64BIT && GET_CODE (x) == CONST_DOUBLE)
......
...@@ -784,9 +784,9 @@ extern int may_call_alloca; ...@@ -784,9 +784,9 @@ extern int may_call_alloca;
#define MAX_REGS_PER_ADDRESS 2 #define MAX_REGS_PER_ADDRESS 2
/* Non-TLS symbolic references. */ /* TLS symbolic reference. */
#define PA_SYMBOL_REF_TLS_P(RTX) \ #define PA_SYMBOL_REF_TLS_P(X) \
(GET_CODE (RTX) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (RTX) != 0) (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (X) != 0)
/* Recognize any constant value that is a valid address except /* Recognize any constant value that is a valid address except
for symbolic addresses. We get better CSE by rejecting them for symbolic addresses. We get better CSE by rejecting them
...@@ -796,7 +796,8 @@ extern int may_call_alloca; ...@@ -796,7 +796,8 @@ extern int may_call_alloca;
#define CONSTANT_ADDRESS_P(X) \ #define CONSTANT_ADDRESS_P(X) \
((GET_CODE (X) == LABEL_REF \ ((GET_CODE (X) == LABEL_REF \
|| (GET_CODE (X) == SYMBOL_REF && !SYMBOL_REF_TLS_MODEL (X)) \ || (GET_CODE (X) == SYMBOL_REF && !SYMBOL_REF_TLS_MODEL (X)) \
|| GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \ || GET_CODE (X) == CONST_INT \
|| (GET_CODE (X) == CONST && !pa_tls_referenced_p (X)) \
|| GET_CODE (X) == HIGH) \ || GET_CODE (X) == HIGH) \
&& (reload_in_progress || reload_completed \ && (reload_in_progress || reload_completed \
|| ! pa_symbolic_expression_p (X))) || ! pa_symbolic_expression_p (X)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment