This is the mail archive of the
mailing list for the GCC project.
Re: condition codes, haifa-sched and virtual-stack-vars
- From: Geoff Keating <geoffk at geoffk dot org>
- To: weigand at immd1 dot informatik dot uni-erlangen dot de
- Cc: weigand at immd1 dot informatik dot uni-erlangen dot de, gcc at gcc dot gnu dot org
- Date: Thu, 31 Jan 2002 10:54:16 -0800
- Subject: Re: condition codes, haifa-sched and virtual-stack-vars
- References: <200201302316.AAA17136@faui1a.informatik.uni-erlangen.de>
- Reply-to: Geoff Keating <geoffk at redhat dot com>
> From: Ulrich Weigand <email@example.com>
> Date: Thu, 31 Jan 2002 00:16:59 +0100 (MET)
> Cc: firstname.lastname@example.org (Ulrich Weigand), email@example.com
> X-OriginalArrivalTime: 30 Jan 2002 23:24:42.0937 (UTC) FILETIME=[4BEAD290:01C1A9E5]
> Geoff Keating wrote:
> > Ulrich Weigand <firstname.lastname@example.org> writes:
> > > The problem is that reload simply calls gen_add2_insn whenever it
> > > feels like it, without consideration that this might introduce
> > > a CC clobber at an inappropriate point ...
> > On xstormy16, this problem existed with the carry register. I believe
> > it was fixed by having a reload_inhi pattern and an appropriate
> > definition of SECONDARY_RELOAD_CLASS. The result appears to work.
> This is interesting, but I'm not sure I understand *why* it works ;-)
> The reload_inhi pattern tries to allocate the carry register as the
> secondary reload scratch register. Now, in the interesting case
> where the carry register is in fact live at the location where the
> insn is inserted, this would mean that reload would need to spill
> the carry register and later on restore its old value, right?
> (Because there is only a single register in this class ...)
No, reload_inhi doesn't allocate anything; that's done by
SECONDARY_RELOAD_CLASS. reload_inhi is just to explain to reload how
to put the carry register into the add instruction.
> However, I'm not sure how the carry register can be spilled,
> given that there is no mov* insn that touches it, unless I'm
> missing something ...
Yes, the case of spills is tricky, which is why we pretty much avoid
it on xstormy16 :-). In the general case, you'd have to explain how
to spill and restore the carry register. xstormy16 has the additional
problem that certain branches can clobber the carry register, which is
why it can't really be spilled (because reload is not smart enough to
restore it after a branch).
- Geoffrey Keating <email@example.com> <firstname.lastname@example.org>