Hi, I’m trying to run multiple Module Passes automatically with clang. I’ve registered each pass with the following code to run it automatically
void addModifyStubPass(const PassManagerBuilder & /* unused */,
legacy::PassManagerBase &PM)
{
PM.add(new ModifyStubPass());
}
// Register the pass so `opt -modify-stub` runs it.
static RegisterPass<ModifyStubPass> A("modify-stub", "Modify Stub pass");
// Tell frontends to run the pass automatically.
static RegisterStandardPasses B(PassManagerBuilder::EP_ModuleOptimizerEarly,
addModifyStubPass);
static RegisterStandardPasses
C(PassManagerBuilder::EP_EnabledOnOptLevel0, addModifyStubPass);
to run it with clang I run the command
clang -Xclang -load -Xclang Pass1.so -Xclang -load -Xclang Pass2.so ./input.c
However, this runs the first specified pass twice (in this case Pass1) instead of Pass1 followed by Pass2. How to fix this?