[LLVMdev] loadable passes with dependencies?

ret val retval386 at gmail.com
Mon Nov 7 18:20:19 PST 2011


I'm writing a Pass that I would like to remain loadable by opt. The
pass also requires DominatorTree(for PromoteMemToReg).

Looking for examples the only way I found to require a dependecny is
by doing something like this:
        char Hello::ID = 0;
        namespace llvm { void initializeHelloPass(llvm::PassRegistry&); }
        INITIALIZE_PASS_BEGIN(Hello, "hello", "Hello World Pass", false, true)
        INITIALIZE_PASS_DEPENDENCY(DominatorTree)
        INITIALIZE_PASS_END(Hello, "hello", "Hello World Pass", false, true)

Unfortunately this gives me(when I try to run it).
      opt: Unknown command line argument '-hello'.

If I instead using RegisterPass like in the guide the Pass is loaded
fine, a assert is just tripped for not having DominatorTree info. I
can not seem to mix these 2 ways together or find anything trying todo
the same.

How should this be done?

Thank you



More information about the llvm-dev mailing list