Non-representable subregs of subword pseudoregs

Eric Botcazou ebotcazou@libertysurf.fr
Sat Nov 13 20:24:00 GMT 2004


> (I assume this has word_mode == DImode?)

Of course.  Sorry for not explicitly mentioning it.

> While there's unfortunately some amount of confusion as to which
> subregs are valid, exactly, I think it should be pretty clear
> that *this* subreg is certainly *not* valid.
>
> As per the documentation, subregs can be used to denote either
> - a value re-interpreted in another mode (this always means lowpart)
> or
> - one of the words of a multi-word value (i.e. > word_mode)
> or
> - a combination of the two (a lowpart of one word of a multi-word)
>
> Since (reg:DI 126) is a single-word value, and the subreg does
> not denote the lowpart, it should be invalid.

I think this makes sense.  But take a look at gen_realpart:

  if (WORDS_BIG_ENDIAN
      && GET_MODE_BITSIZE (mode) < BITS_PER_WORD
      && REG_P (x)
      && REGNO (x) < FIRST_PSEUDO_REGISTER)
    internal_error
      ("can't access real part of complex value in hard register");
  else if (WORDS_BIG_ENDIAN)
    return gen_highpart (mode, x);
  else
    return gen_lowpart (mode, x);

You can't help but thinking that whoever wrote the check thought that highpart 
subregs of subword pseudo regs were valid.  It turns out that Jeff added it 
in rev. 1.62 of emit-rtl.c.

Jeff, what's your take on this?

-- 
Eric Botcazou



More information about the Gcc mailing list