Re: Is this a form of Data Flow Analysis, and what is the proper way solution to the problem?

George Neuner <gneuner2@comcast.net>
17 Jan 2006 21:39:16 -0500

          From comp.compilers

Related articles
Is this a form of Data Flow Analysis, and what is the proper way solut owong@castortech.com (Oliver Wong) (2006-01-12)
Re: Is this a form of Data Flow Analysis, and what is the proper way s gneuner2@comcast.net (George Neuner) (2006-01-17)
Re: Is this a form of Data Flow Analysis, and what is the proper way s henry@spsystems.net (2006-01-17)
Re: Is this a form of Data Flow Analysis, and what is the proper way s DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-01-17)
Re: Is this a form of Data Flow Analysis, and what is the proper way s paolo.bonzini@gmail.com (2006-01-17)
Re: Is this a form of Data Flow Analysis, and what is the proper way s owong@castortech.com (Oliver Wong) (2006-01-20)
Re: Is this a form of Data Flow Analysis, and what is the proper way s gneuner2@comcast.net (George Neuner) (2006-01-26)
Re: Is this a form of Data Flow Analysis, and what is the proper way s paolo.bonzini@gmail.com (2006-01-26)
[3 later articles]
| List of all articles for this month |
From: George Neuner <gneuner2@comcast.net>
Newsgroups: comp.compilers
Date: 17 Jan 2006 21:39:16 -0500
Organization: Compilers Central
References: 06-01-037
Keywords: analysis
Posted-Date: 17 Jan 2006 21:39:16 EST

On 12 Jan 2006 12:12:58 -0500, "Oliver Wong" <owong@castortech.com>
wrote:


> I'd like to do some analysis on the source code of a Java program. I've
>got the code parsed into an AST, and I've got a primitive symbol table
>built. I'd like to determine, for a given write-operation, what names (from
>the symbol table) affect the value to be written. For example, in the
>following statement:
    :
>z = y = x;
>
> Which of the following outputs would be more "correct"?
>
>* There is a read from x, which leads to a write to y.
>* There is a write to y.
>* There is a read from y, which leads to a write to z.
>* There is a write to z.
>
>OR
>
>* There is a read from x, which leads to a write to y.
>* There is a read from x, which leads to a write to z.
>* There is a write to y.
>* There is a write to z.


More like:
* There is a read from x.
* There is a write to y.
* There is a write to z.


The value will only be read once and then written as many times as
necessary. The high level syntax of the multiple copy isn't relevant.


What you seem to be after is a value dependency graph.


AST is not a good representation for extracting this type of
information because it is (usually) much too high level. The
information you are seeking depends on both the program logic and on
the executing machine (be it a VM or a real CPU). To get meaningful
results it would be better to use a representation which is closer to
the machine - e.g., 3-address code.




>I've encountered the term "Data Flow Analysis", but the examples of
>DFAs I've seen only seen marginally related to what I'm doing.


I think "def use" is the term you're looking for. I also suggest
looking into "value numbering" and/or "single static assignment" which
are both techniques to track values through the computation and avoids
confusion when symbolic names are reused.


George
--
for email reply remove "/" from address


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.