> > + gcc_assert (ok);
> > + base = parts.base;
> > + index = parts.index;
> > + disp = parts.disp;
> > +
> > + if (TARGET_64BIT && !base && !index)
> > + {
> > + rtx symbol = disp;
> > +
> > + if (GET_CODE (disp) == CONST
> > + && GET_CODE (XEXP (disp, 0)) == PLUS
> > + && CONST_INT_P (XEXP (XEXP (disp, 0), 1)))
> > + symbol = XEXP (XEXP (disp, 0), 0);
> > +
> > + if (GET_CODE (symbol) == LABEL_REF
> > + || (GET_CODE (symbol) == SYMBOL_REF
> > + && SYMBOL_REF_TLS_MODEL (symbol) == 0))
> > + return true;
> > + }
> > + if (flag_pic && !base && !index)
> > + {
> > + if (GET_CODE (disp) == CONST
> > + && GET_CODE (XEXP (disp, 0)) == UNSPEC
> > + && (XINT (XEXP (disp, 0), 1) == UNSPEC_PCREL
> > + || XINT (XEXP (disp, 0), 1) == UNSPEC_GOTPCREL
> > + || (TARGET_64BIT
> > + && XINT (XEXP (disp, 0), 1) == UNSPEC_GOTNTPOFF)))
> > + return true;
> > + }
> > + return false;
> > +}
> > +
>
> It doesn't look right. IP relative address is only possible
> with TARGET_64BIT and
>
> 1. base == pc. Or
> 2. UUNSPEC_PCREL, UNSPEC_GOTPCREL, and
> NSPEC_GOTNTPOFF.
Target 64bit should be tested above. We however output RIP addresses
also for basic symbol references. I.e. when base is an symbol addresss.
such as in:
int a;
int t()
{
return a;
}
memory_address_length already contains logic to figure out if there is IP
relative addressing going on (I am not sure it is completely accurate either).
Better to break it out to a common predicate and perhaps unify with what
ix86_print_operand_address is doing.
Honza
>
>
> --
> H.J.