[llvm-dev] About LLVM Pass dependency

Mahesh Attarde via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 3 10:30:33 PDT 2017


Hi Hongbin

I am not quite familiar with AnalysisUsage, let me correct question a bit.
I have read Writing Pass
<http://llvm.org/docs/WritingAnLLVMPass.html#specifying-interactions-between-passes>,
All examples that i see here are based on collecting information .i.e
Analysis Passes.
I wonder if this applies to Transformation passes also.
e.g.

void MyInliner::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addRequired<SimplifyCFGPass>();    // Transformation Pass
   AU.addRequired<AnnotatedFunctionPass>();  // Transformation like pass
   AU.addRequired<CallGraphSCCPass>();    // Analysis Pass
}

here AnnotateFunctionPass is adding meta information,so technically nothing
Functional transformational in module and
not Analysis either.
Would that be right way?

Thanks
Mahesh

On Tue, Oct 3, 2017 at 9:43 PM, Hongbin Zheng <etherzhhb at gmail.com> wrote:

> Hi Mahesh,
>
> Did you override getAnalysisUsage and require D1, D2 and D3?
>
>
> void YourPass::getAnalysisUsage(AnalysisUsage &AU) const {
>   AU.addRequired<D1>();
>   AU.addRequired<D2>();
>   AU.addRequired<D3>();
> }
>
> On Tue, Oct 3, 2017 at 2:00 AM, Mahesh Attarde via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> Hello
>>   I am working on pass which has dependency on multiple passes.  Say
>> D1,D2,D3
>> I used
>> INITIALIZE_PASS_BEGIN
>> INITIALIZE_PASS_DEPENDENCY(D1)
>> INITIALIZE_PASS_DEPENDENCY(D2)
>> INITIALIZE_PASS_DEPENDENCY(D3)
>> INITIALIZE_PASS_END.
>>
>> While running it through opt tool it, I had to specify this D1,D2,D3 pass
>> names
>> to get this pass executed before my pass.
>> Is there way, to let llvm pass manager to know  execute all dependencies
>> without
>> having to specify explicitly.?
>>
>> I suspect i am doing something wrong in my code, May be.
>>
>> Thanks
>> Mahesh
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171003/eac8aacc/attachment.html>


More information about the llvm-dev mailing list