Is eliminate_regs_in_insn allowed to generate invalid instruction?
Ulrich Weigand
uweigand@de.ibm.com
Mon Dec 20 13:47:00 GMT 2010
Bingfeng Mei wrote:
> > -----Original Message-----
> > This means that the RTL that is passed to your EXTRA_CONSTRAINT_STR
> > implementation will still be the *original* un-reloaded address.
> > And most likely, your back-end will then reject this address as
> > not valid for your machine.
>
> Thanks, that is exactly what I see. But is only EXTRA_CONSTRAINT_STR
> that suffers this issue? It sounds that normal memory constraint should
> have this problem too.
Actually, it doesn't. If you look at the corresponding code:
case TARGET_MEM_CONSTRAINT:
if (force_reload)
break;
if (MEM_P (operand)
|| (REG_P (operand)
&& REGNO (operand) >= FIRST_PSEUDO_REGISTER
&& reg_renumber[REGNO (operand)] < 0))
win = 1;
if (CONST_POOL_OK_P (operand))
badop = 0;
constmemok = 1;
break;
you'll notice that *every* MEM is accepted for the normal memory
constraint here; there is no checking whatsoever that the address
is legitimate. (If there were, we'd run into exactly the same
problem.)
The reasoning behind this approach is: Before reload, we know the
address must have been valid. During find_reloads_address, the
code is careful to either leave the address valid, or else create
reloads that are known to be sufficient to make the address valid
again. Therefore, we can simply assume that the final address
after all reloads are applied will be legitimate, without having
to explicitly check for that ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
More information about the Gcc
mailing list