This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: SSA usage question
- From: Paul Brook <paul at codesourcery dot com>
- To: gcc at gcc dot gnu dot org
- Cc: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner), dnovillo at redhat dot com
- Date: Mon, 7 Jun 2004 19:16:23 +0100
- Subject: Re: SSA usage question
- Organization: CodeSourcery
- References: <10406071641.AA10883@vlsi1.ultra.nyu.edu>
> These things can change from reference to reference? That is,
> given the array 'a' above, will every reference to 'a' use a
> potentially different 'x' and 'v'?
>
> No. They are the unchanging over the lifetime of an object. If the
> type has placeholders, then it may be different between two objects of
> the same type, though.
Fortran does need to be able to change these values. Obviously they will only
ever be changed when used via a pointer type.
For example:
program test
real, target :: a(4)
real, pointer :: x(:)
a = (/11, 12, 13, 14/)
x => a ! Point x at a
print *, x(2) ! Expected output is "12"
x => a(1::2) ! Point x at every other element of a
print *, x(2) ! Expected output is "13"
end program
Will expand into something like:
void main()
{
real[6] a;
real[] *x_base;
int x_lbound, x_stride;
x_base = addr_expr<a>;
x_lbound = 1;
x_stride = 1; // Maybe (1 * sizeof(real))
print (array_ref<indirect<a_base>, 2, x_lbound, x_stride>);
x_base = addr_expr <a>;
x_lbound = 1;
x_stride = 2;
print (array_ref<indirect<a_base>, 2, x_lbound, x_stride>);
}
Paul