[LLVMdev] Enforcing execution order of passes

nullnull null.function at gmail.com
Thu Feb 17 20:42:38 PST 2011


I'd like to run my own passes (implemented as .so) via the opt tool on a
linked bitcode.

>opt -load=my_own_pass.so -do_my_passes  ... test.bc > test.output.bc

However, my passes require other LLVM's passes before and after. For
example, the ordering of passes that I want:

(1) A couple of LLVM's passes ==> (2) my_loop_pass ==> (3) my_module_pass
==> (4) Other LLVM's standard O3 optimizations (a bunch of passes).

Can I enfore such complex pass ordering easily? I'd like to pass just a
single argument in opt, which trigers the whole pipeline of passes.

I tried to use getAnalysisUsage and addRequired. But, the documentation is
somewhat vague, I wasn't able even to enforce the pass in (1) to be executed
before (2) my loop pass.

Also, I'm wondering there is a way to run other passes after my pass.

Actually, I did it by hard coding in clang and LLVM source code. But, I'd
like to avoid the changes in clang/LLVM as much as possible so that I don't
need to compile LLVM suite.

Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110217/2a5799b1/attachment.html>


More information about the llvm-dev mailing list