[LLVMdev] AliasAnalysis tutorial 2

John Criswell criswell at uiuc.edu
Tue Dec 9 13:15:30 PST 2008


Julien Schmitt wrote:
> Hi !
> In my quest of implementing my own AA, i understood that it doesn't work
> because i don't use the 'opt' tool but i create my own PassManager (this 
> for other reasons).
> The problem is the same with other existing AA (AndersensPass or 
> globalModRefPass)  :
> these AApasses are not chained with the basicAA when they are created in 
> PassManager ...
>
> So my question is now : how to call an AAPass using a local PassManager 
> (without opt) ?
>   
I'm assuming that by "creating your own PassManager" you mean that 
you're writing your own C++ tool that creates a PassManager object and 
then explicitly adds passes using the add() method of PassManager.  Is 
this correct?

In that case, I think all you need to do is to explicitly specify your 
alias analysis as one of the passes to run:

PassManager Passes;

Passes.add (new YourAliasAnalysisPass());
Passes.add (new WhateverPassUsesTheAliasAnalysisInterface());

Creating a pass in the AliasAnalysis group doesn't mean that it will 
automatically be run when an alias analysis is needed.  Rather, what it 
means is that *if* a pass requests an AliasAnalysis group pass *and* 
your pass has already been executed, the pass requesting an 
AliasAnalysis group pass will find your pass and use it. That is why you 
need to add it explicitly.  If you don't add it explicitly, the 
PassManager will simply use the default AliasAnalisys group pass, which 
I believe is BasicAA.

Does this help answer your question, or am I misunderstanding something?

-- John T.

> Thank you !
>
> Julien
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>   




More information about the llvm-dev mailing list