This is the mail archive of the
mailing list for the GCC project.
Re: Reload problem: asm operand requires impossible reload
- From: Ian Lance Taylor <iant at google dot com>
- To: "Bingfeng Mei" <bmei at broadcom dot com>
- Cc: "gcc\ at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, "bernd dot schmidt\ at analog dot com" <bernd dot schmidt at analog dot com>, "weigand\ at de dot ibm dot com" <weigand at de dot ibm dot com>
- Date: Fri, 01 May 2009 07:31:38 -0700
- Subject: Re: Reload problem: asm operand requires impossible reload
- References: <7FB04A5C213E9943A72EE127DB74F0AD5C65CBA75E@SJEXCHCCR02.corp.ad.broadcom.com>
"Bingfeng Mei" <firstname.lastname@example.org> writes:
> I experienced "asm operand requires impossible reload" error in our private porting.
> After digging into the reloading pass, I found something a bit fishy.
> The error message is produced in reload_as_needed function (reload1.c)
> /* If this was an ASM, make sure that all the reload insns
> we have generated are valid. If not, give an error
> and delete them. */
> if (asm_noperands (PATTERN (insn)) >= 0)
> for (p = NEXT_INSN (prev); p != next; p = NEXT_INSN (p))
> if (p != insn && INSN_P (p)
> && GET_CODE (PATTERN (p)) != USE
> && (recog_memoized (p) < 0
> || (extract_insn (p), ! constrain_operands (1))))
> error_for_asm (insn,
> "%<asm%> operand requires "
> "impossible reload");
> delete_insn (p);
> Here the code checks whether all generated reload insns are valid. The "strict"
> argument of the constraint_oeprands is set to 1, thus any pseudo register operand
> will fail the check if I understood correctly. However, at this stage, all the
> generated reload instructions, including normal and asm insns, seems to have
> pseudo register operands. Only later they are replaced by memory operand. If I
> disable this piece of code, the code is compiled without problem.
> Did I misunderstand something here, or is it an possible bug? The code base is
> GCC 4.4 branch.
That code is only checking the insns which were created by
emit_reload_insns, and after subst_reloads has run. Those instructions
should not have any remaining references to pseudo-registers. If they
do, it means that reload is generating instructions which refer to
pseudo-registers, and that would be wrong. That check has been there
for several releases, so I don't think it is obviously buggy.
If this is still puzzling we may need to see an example.