[LLVMdev] Requiring a pass to run before/after a pass? (Adding PHIs and updating uses)

Edward Lee eslee3 at uiuc.edu
Thu Oct 16 11:20:27 PDT 2008


On Thu, Oct 16, 2008 at 11:24 AM, Devang Patel <dpatel at apple.com> wrote:
> One simplest way is to handle this is to add these passes around your
> pass in the pass manager.

How about in the context of opt assuming myOpt is built as part of
llvm and not a separate plugin. It probably wouldn't be ideal to
modify opt.cpp to do something like..

void addPass(PassManager &PM, Pass *P) {
  if (isa<myOpt>(P) {
    addPass(PM, beforePass);
    PM.add(P);
    addPass(PM, afterPass);
  }

And even then, that only fixes opt.

Perhaps Passes can get to the appropriate PassManager by going through
Pass's virtual assignPassManager method?

Ed



More information about the llvm-dev mailing list