Re: Dataflow and function calls

kamal <kamalpr@gmail.com>
Sat, 1 Aug 2009 07:02:48 -0700 (PDT)

          From comp.compilers

Related articles
Dataflow and function calls tetra2005@googlemail.com (Yuri Gribov) (2009-07-23)
Re: Dataflow and function calls gopi.onthemove@gmail.com (gopi) (2009-07-28)
Re: Dataflow and function calls tetra2005@googlemail.com (Yuri Gribov) (2009-07-29)
Re: Dataflow and function calls kamalpr@gmail.com (kamal) (2009-08-01)
| List of all articles for this month |

From: kamal <kamalpr@gmail.com>
Newsgroups: comp.compilers
Date: Sat, 1 Aug 2009 07:02:48 -0700 (PDT)
Organization: Compilers Central
References: 09-07-084
Keywords: code, analysis
Posted-Date: 01 Aug 2009 16:50:30 EDT

On Jul 23, 11:01 am, Yuri Gribov <tetra2...@googlemail.com> wrote:
> Now comes the question. Imagine that I want to calculate reach-defs
> via standard dataflow techniques (we use simple three-address code
> without SSA). How should I handle call instructions? Should call kill
> all definitions or keep them? ...


> Finally my questions are:
> 0) How do you generally handle call instructions when doing dataflow
> analysis?
> 1) Is my approach with explicit loads/stores correct? If yes - how do
> I place them to avoid inefficient code above?


data-flow analysis does not assume anything about function calls. Its
for you to define a basic-block and its associated def-use [or better
mod-use] chains.
Depending on the language and type of arguments, I would try to assume
a function call is not the end of a basic block and instead modify def-
use chains appropriately (eg:- a pointer can only modify some variable
to which it points -or ones adjacent to it in memory, or that a
function that does a pass-by-value cannot possibly modify variables in
the caller). The larger the basic block, the greater the amt of
optimization one can do.


> 2) Why is this important topic (calls/ambiguous commands + dataflow,
> optimal placing of loads/stores) not covered in compiler textbooks (I
> did not find it neither in dragon-book nor in draft version of
> "Engineering a compiler")?


think they don't cover a hell lot of things in the dragon book. Look
for research papers on what techniques were used, and how effective
they were.


> 3) Could you recommend a textbook or online course which covers such
> deep but important details?
>


This one is pretty good for optimizations implemented in HP's C/C++
compiler.


http://www.amazon.com/Advanced-Compiler-Design-Implementation-Muchnick/dp/155
8603204/ref=sr_1_1?ie=UTF8&qid=1249135286&sr=1-1


regards
-kamal


Post a followup to this message

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