re PR target/21412 (ICE loading TLS address)
PR target/21412 * config/rs6000/rs6000.c (rs6000_emit_move): Look for tls addresses with constant offsets. From-SVN: r99352
This commit is contained in:
parent
f2f84cbaeb
commit
84f52ebdf1
|
@ -1,3 +1,9 @@
|
|||
2005-05-07 Richard Henderson <rth@redhat.com>
|
||||
|
||||
PR target/21412
|
||||
* config/rs6000/rs6000.c (rs6000_emit_move): Look for tls addresses
|
||||
with constant offsets.
|
||||
|
||||
2005-05-07 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* config/v850/v850.c (print_operand): Use gcc_assert and
|
||||
|
|
|
@ -3575,11 +3575,29 @@ rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
|
|||
|
||||
/* Recognize the case where operand[1] is a reference to thread-local
|
||||
data and load its address to a register. */
|
||||
if (GET_CODE (operands[1]) == SYMBOL_REF)
|
||||
if (rs6000_tls_referenced_p (operands[1]))
|
||||
{
|
||||
enum tls_model model = SYMBOL_REF_TLS_MODEL (operands[1]);
|
||||
if (model != 0)
|
||||
operands[1] = rs6000_legitimize_tls_address (operands[1], model);
|
||||
enum tls_model model;
|
||||
rtx tmp = operands[1];
|
||||
rtx addend = NULL;
|
||||
|
||||
if (GET_CODE (tmp) == CONST && GET_CODE (XEXP (tmp, 0)) == PLUS)
|
||||
{
|
||||
addend = XEXP (XEXP (tmp, 0), 1);
|
||||
tmp = XEXP (XEXP (tmp, 0), 0);
|
||||
}
|
||||
|
||||
gcc_assert (GET_CODE (tmp) == SYMBOL_REF);
|
||||
model = SYMBOL_REF_TLS_MODEL (tmp);
|
||||
gcc_assert (model != 0);
|
||||
|
||||
tmp = rs6000_legitimize_tls_address (tmp, model);
|
||||
if (addend)
|
||||
{
|
||||
tmp = gen_rtx_PLUS (mode, tmp, addend);
|
||||
tmp = force_operand (tmp, operands[0]);
|
||||
}
|
||||
operands[1] = tmp;
|
||||
}
|
||||
|
||||
/* Handle the case where reload calls us with an invalid address. */
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
/* PR 21412 */
|
||||
/* { dg-do compile */
|
||||
/* { dg-options "-O2 -fPIC" } */
|
||||
|
||||
struct S { int x[10]; };
|
||||
extern __thread struct S s;
|
||||
int *foo() { return &s.x[2]; }
|
Loading…
Reference in New Issue