Xref: utzoo comp.lang.fortran:854 comp.lang.c:11035
Path: utzoo!attcan!uunet!nbires!ncar!noao!arizona!mike
From: mike@arizona.edu (Mike Coffin)
Newsgroups: comp.lang.fortran,comp.lang.c
Subject: Re: Should I convert FORTRAN code to C?
Message-ID: <6067@megaron.arizona.edu>
Date: 1 Jul 88 01:05:12 GMT
References: <20454@beta.lanl.gov>
Organization: U of Arizona CS Dept, Tucson
Lines: 39

From article <20454@beta.lanl.gov>, by jlg@beta.lanl.gov (Jim Giles):
> By the way, I've not seen any C compilers which optimize static 2-d
> arrays anyway.  An early step in the compiler usually turns the array
> reference into a linear function on the indices - this throws out the
> dependency information.

This is not true.  How can information be lost by changing "a[i]" to
"*(a+i)"?  In fact at least one very fancy FORTRAN compiler converts
array references to exactly that form to extract dependency
information that is difficult to recognize otherwise.  See
"Interprocedural Dependency Analysis and Parallelization" by Michael
Burke and Ron Cytron, in the 1986 SIGPLAN Symposium on Compiler
Construction, pp 162-175.

For instance they are able to parallelize a loop with the following
references:

	DO i = 1 to N
		A(2i,2i+1) = ...
		... = A(i,i)
		END

They say (page 166) 
    "Existing techniques separately analyze the two dimensions of A,
    and so separately consider two dependence equations, neither of
    which can demonstrate independence.  However, the dependencies
    that exist independently in each dimension cannot hold
    simultaneously: for any value of i, the expressions at the
    definition (2i and 2i+1) are never equal but the expressions at
    the use (i and i) are equivalent.  Since the dependencies cannot
    hold simultaneously, no dependence exists between the definition
    and use of A.  By linearizing the references to A, we couple the
    two equations into one, allowing us to determine the independence
    of the accessed regions."
-- 

Mike Coffin				mike@arizona.edu
Univ. of Ariz. Dept. of Comp. Sci.	{allegra,cmcl2,ihnp4}!arizona!mike
Tucson, AZ  85721			(602)621-4252