I'd like to write a pass that does both: implements a code transformation
*and
*saves information that can be accessed by subsequent passes. If such a
pass is not an Analysis pass and that therefore subsequent passes are not
supposed to use getAnalysis() to extract the information from that pass...
what is the right way to do this?
Right now I am using getAnalysis to get the information from the
non-analysis (transformation) pass. It works, but now it sounds like
that's not correct usage....
Marc
On Fri, Jul 25, 2008 at 2:01 PM, Devang Patel <dpatel at apple.com> wrote:
>
> On Jul 25, 2008, at 10:56 AM, Marc de Kruijf wrote:
>
> > Could somebody please explain exactly what an "analysis
pass" is?
> > I've spent some time trying to understand this and I just
don't get
> > it. Right now my understanding is the following: if a pass is an
> > "analysis" pass, the "print" function is called
when giving the "-
> > analyze" switch to opt.
>
> Yes.
>
> > Is there more to it than that?
>
> Analysis pass collects information that is used by other passes, for
> example alias info., loop info, dominator info etc..
>
> > If I've got it wrong, here are some potentially clarifying
questions:
> >
> > 1. If a pass is an analysis pass, does it necessarily not alter the
> > CFG?
>
> Yes, Analysis passes do not alter CFG.
>
> > 2. Does a pass need to be an analysis pass if it is used by another
> > pass calling getAnalysisUsage?
>
> The other passes uses getAnalysisUsage() to access information
> collected by an analysis information. getAnalysisUsage() interface
> should not be used to order transformation/code generation passes.
> There are couple of cases where code generator violates this and I'd
> like to eventually fix it.
>
> > 3. How does whether or not a pass is an analysis pass or not affect
> > the pass's execution?
>
> In general it does not. Analysis pass is executed just like any other
> pass.
>
> The distinction is important for the pass manager, who is responsible
> to automatically schedule an analysis pass if the analysis info is not
> available (or dirty) and is required by a transformation pass.
>
> One small distinction is - pass manager will not re-run an analysis
> pass if the information is up-to-date. However, the pass manager will
> re-run a transformation pass if requested to do so.
>
> For example,
> $ opt -domtree -domtree a.bc -disable-output
> will run dominator tree analysis pass only once.
> $ opt -instcombine -instcombine a.bc -disable-output
> will run instruction combiner pass twice.
>
> -
> Devang
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20080725/db32cd44/attachment.html>