[LLVMdev] Passes dependencies?

Devang Patel devang.patel at gmail.com
Mon Nov 16 10:34:40 PST 2009


On Sun, Nov 15, 2009 at 1:20 PM, Renato Golin <rengolin at systemcall.org> wrote:
> I was reading this page:
> http://llvm.org/docs/Passes.html
>
> and there seems to be lots of passes that depend on others to produce
> consistent non-redundant code.
>
> For instance, the DIE must run after Simple constant propagation,
> Loop-Closed SSA Form Pass is mostly (only) useful for other passes,
> such as LoopUnswitching, and a few passes that leave a good mess,
> requiring other passes to run afterwards to clean up.

Usually, a pass has two kind of dependencies.

1) Info it needs to do its job. e.g. loop info, dominator tree,  alias
analysis etc...
    A pass can request these requirements explicitly and pass manager
will sequence appropriate passes to meet the requirement.

2) IR form it needs to identify pattern and do its job. E.g. loop
unswitch. loop rotation. etc..
    In such cases, these passes should be added in pass queue by the
driver (clang, or opt, or llvm-gcc) before your pass. However, your
pass should be able to gracefully handle (and skip code) if the
incoming IR is not in suitable form.

-
Devang



More information about the llvm-dev mailing list