comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Ada to C/C++ translator needed
Date: 1996/10/15
Date: 1996-10-15T00:00:00+00:00	[thread overview]
Message-ID: <DzAwG0.HJJ.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 53fnp2$8bs$1@goanna.cs.rmit.edu.au


Richard A. O'Keefe (ok@goanna.cs.rmit.edu.au) wrote:
: ...
: Since this is comp.lang.ada, perhaps someone could explain clearly
: whether an Ada compiler is allowed to perform this kind of optimisation
: given

: 	type Vector is array (Positive range <>) of Float;

: 	procedure Vec_Add(A: out Vector; B, C: in Vector) is
: 	begin
: 	    for I in A'Range loop A(I) := B(I) + C(I); end loop;
: 	end Vec_Add;

: I used to think that calls like

: 	declare
: 	    X, Y: Vector(3) := (1..3 => 1.0);
: 	begin
: 	    Vec_Add(X(2..3), X(1..2), Y(1..2));
: 	end;

: were forbidden, because the result depended on whether 'in Vector' was
: passed by copy or reference, but I probably got that wrong, and I am
: even less sure of exactly what the rule is in Ada 95.  A factor of 3
: speedup is worth having...

The rules regarding aliasing between parameters are given in RM95-6.2(12).
The generated code is allowed to result in the reading of an "old" value 
if there is aliasing between the parameters, and the code as written
would imply a write of an object by one access path followed by a read of 
the object by some other access path.  This implies that a loop
may be unrolled, and then different iterations interleaved by moving
certain of the reads earlier.

: Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.

-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Cambridge, MA  USA




  reply	other threads:[~1996-10-15  0:00 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-02  0:00 Ada to C/C++ translator needed Simon Johnston
1996-10-07  0:00 ` Richard Riehle
1996-10-09  0:00   ` Richard A. O'Keefe
1996-10-15  0:00     ` Tucker Taft [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-09-25  0:00 Emmanuel Champommier
1996-09-25  0:00 ` David Weller
1996-10-02  0:00   ` B|rje Norden
1996-10-04  0:00     ` David Weller
1996-10-05  0:00     ` Robert Dewar
1996-10-05  0:00       ` Frank Manning
1996-10-06  0:00         ` Samuel Tardieu
1996-10-07  0:00           ` Richard Kenner
1996-10-07  0:00             ` Robert Dewar
1996-10-08  0:00             ` Stephen Leake
1996-10-07  0:00         ` Robert Dewar
1996-10-08  0:00           ` Frank Manning
1996-10-07  0:00   ` Erik Magnuson
1996-09-26  0:00 ` Ian Ward
1996-10-02  0:00   ` Jon S Anthony
1996-10-02  0:00   ` Jon S Anthony
     [not found]   ` <52feul$os2@goanna.cs.rmit.edu.au>
1996-09-28  0:00     ` Tim Behrendsen
1996-09-29  0:00       ` Ken Pizzini
1996-09-29  0:00         ` Tim Behrendsen
1996-09-29  0:00           ` Robert Dewar
1996-09-30  0:00             ` Tim Behrendsen
1996-09-30  0:00               ` William Clodius
1996-09-30  0:00               ` Matthew Heaney
1996-09-30  0:00                 ` Tim Behrendsen
1996-10-01  0:00               ` Richard A. O'Keefe
1996-09-30  0:00           ` Richard A. O'Keefe
1996-09-30  0:00             ` Tim Behrendsen
1996-09-30  0:00       ` Richard A. O'Keefe
1996-09-30  0:00         ` Tim Behrendsen
1996-09-30  0:00           ` Peter Seebach
1996-09-30  0:00             ` Tim Behrendsen
1996-10-01  0:00           ` Richard A. O'Keefe
1996-10-01  0:00             ` Tim Behrendsen
1996-10-02  0:00               ` Ian Ward
1996-10-02  0:00                 ` Tim Behrendsen
1996-09-30  0:00         ` Peter Seebach
1996-10-02  0:00           ` Richard A. O'Keefe
1996-10-05  0:00             ` Lawrence Kirby
1996-10-06  0:00     ` Tanmoy Bhattacharya
1996-10-06  0:00       ` Lawrence Kirby
1996-10-08  0:00         ` Peter Seebach
1996-10-07  0:00     ` Tanmoy Bhattacharya
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox