This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: insn does not satisfy its constraints
On Thu, Oct 04, 2007 at 11:14:12AM +0200, Boris Boesler wrote:
> Hi
>
> Am 02.10.2007 um 20:02 schrieb Rask Ingemann Lambertsen:
>
> >On Tue, Oct 02, 2007 at 02:50:50PM +0200, Boris Boesler wrote:
> >
> > What does the .lreg dump file (-fdump-rtl-lreg) say about
> >register costs?
[snip]
> Register 101 costs: Rx_REGS:1000 Ax_REGS:0 GENERAL_REGS:1000
> ALL_REGS:1000 MEM:4000
[snip]
> Register 101 pref Ax_REGS, else Rx_REGS
> 102 registers.
> [8<]
>
> Register 101 used 2 times across 2 insns in block 3; set 1 time; pref
> Ax_REGS, else Rx_REGS; pointer.
>
> Register 101 is the important one. And it says prefer Ax; but it
> worries be that the costs for Ax is 0. Does this mean the value is
> placed in an Ax register or does it mean it is impossible to place
> the value in a Ax register?
Cost 0 means that all instructions which use register 101 accept a
register of class Ax_REGS, so that's good.
The next step would be to check the .greg dump to see why register 101
ends up being assigned to a hard register in class Rx_REGS.
> > GO_IF_LEGITIMATE_ADDRESS() must reject addresses which use hard
> >registers
> >of the wrong class. Even when !REG_OK_STRICT.
>
> Ok, I check the registers in any case: now I can' compile anything!
>
> const_assign.c:19: error: unrecognizable insn:
> (insn 9 8 10 3 (set (mem/c/i:SI (reg/f:SI 102) [0 c+0 S4 A32])
> (const_int 4711 [0x1267])) -1 (nil)
> (nil))
> const_assign.c:19: internal compiler error: in extract_insn, at
> recog.c:2077
But register 102 is a pseudo register, isn't it? A pseudo register must
be accepted when !REG_OK_STRICT. You should have something like this:
#ifdef REG_OK_STRICT
#define REGNO_OK_FOR_BASE_P(r) \
(TEST_HARD_REG_BIT (reg_class_contents[BASE_REG_CLASS], (r)))
#else /* !REG_OK_STRICT */
#define REGNO_OK_FOR_BASE_P(r) \
(!HARD_REGISTER_NUM_P (r) \
|| TEST_HARD_REG_BIT (reg_class_contents[BASE_REG_CLASS], (r)))
#endif /* !REG_OK_STRICT */
Then define GO_IF_LEGITIMATE_ADDRESS() using REGNO_OK_FOR_BASE_P().
There was discussion of a very similar problem on the GCC development
list, which is really where question of this kind belongs since it is about
development of GCC itself.
http://gcc.gnu.org/ml/gcc/2007-09/msg00242.html
> The .unshare file:
[snip]
> insn 7: load a symbol reference into a register 101
> insn 8: copy register 101 to register 102
> insn 9: store constant
Don't worry about the needless reg->reg copy here, the unshare pass runs
very early in the optimization.
--
Rask Ingemann Lambertsen
Danish law requires addresses in e-mail to be logged and stored for a year