This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Why doesn't combine like volatiles? (volatile_ok again, sorry!)
- From: Richard Earnshaw <rearnsha at gcc dot gnu dot org>
- To: Robert Dewar <dewar at gnat dot com>
- Cc: Dave Korn <dave dot korn at artimi dot com>, "'Richard Kenner'" <kenner at vlsi1 dot ultra dot nyu dot edu>, dewar at adacore dot com, gcc at gcc dot gnu dot org
- Date: Wed, 23 Nov 2005 11:26:44 +0000
- Subject: Re: Why doesn't combine like volatiles? (volatile_ok again, sorry!)
- References: <SERRANOmmlQ080Gxw8Z00000099@SERRANO.CAM.ARTIMI.COM> <43836D0C.7080705@gnat.com>
On Tue, 2005-11-22 at 19:10, Robert Dewar wrote:
> Dave Korn wrote:
> > Robert Dewar wrote:
> >
>
> > Isn't it pretty much implied by point 1, "Not more than one volatile memory
> > ref appears in the instructions being considered"?
>
> No, that allows a volatile reference to be combined with something else.
> I think this is a mistake, because people often think of volatile as
> guaranteeing what Ada would call an atomic access, one instruction
> accessing just the variable and nothing else.
If there are N volatile accesses in the sequence under consideration,
there must be exactly N volatile accesses in the resulting combination
(the only thing I've missed in my list is to say that the volatile
reference can't be eliminated -- I've already restricted N to 1, and
rule 4 already said that the mode of the access couldn't change).
There is, however, a further restriction that I thought of last night.
This is very hard to maintain generally, and may therefore be a near
show-stopper:
5) The instruction must never need to be restarted after the volatile
access has been accepted by the memory system.
This restriction rules out, for example, using a volatile value as an
input in many floating point operations (since the operations may trap
depending on the values read).
R.