For current FunctionPass passes, each function in the current module will be visited _once_ under some order. If I have an algorithm that needs to visit each function more than once in order to generate the final result, how could it be arranged under the current LLVM Pass framework? Could somebody point me a pass that currently doing this? Thank you Chuck
Chuck Zhao wrote:> For current FunctionPass passes, each function in the current module > will be visited _once_ under some order. > > If I have an algorithm that needs to visit each function more than once > in order to generate the final result, how could it be arranged under > the current LLVM Pass framework? > > Could somebody point me a pass that currently doing this? >You may want to use a ModulePass if you need to examine/transform a function multiple times. -- John T.> > Thank you > > Chuck > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Thanks, John, Get the idea. Inside MyPass::runOnModule(Module &M): // scan1: for(Module::iterator F=M.begin(), E = M.end(); F != E; ++F){ ... } // scan2: for(Module::iterator F=M.begin(), E = M.end(); F != E; ++F){ ... } So that I can do it as many times I want. Chuck On 7/22/2010 1:39 PM, John Criswell wrote:> Chuck Zhao wrote: >> For current FunctionPass passes, each function in the current >> module will be visited _once_ under some order. >> >> If I have an algorithm that needs to visit each function more than >> once in order to generate the final result, how could it be arranged >> under the current LLVM Pass framework? >> >> Could somebody point me a pass that currently doing this? > > You may want to use a ModulePass if you need to examine/transform a > function multiple times. > > -- John T. > >> >> Thank you >> >> Chuck >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Jul 22, 2010, at 10:39 AM, John Criswell wrote:> Chuck Zhao wrote: >> For current FunctionPass passes, each function in the current module >> will be visited _once_ under some order. >> >> If I have an algorithm that needs to visit each function more than once >> in order to generate the final result, how could it be arranged under >> the current LLVM Pass framework? >> >> Could somebody point me a pass that currently doing this? >> > > You may want to use a ModulePass if you need to examine/transform a > function multiple times.You could also consider splitting it into multiple, sequential FunctionPass's. --Owen