Trevor Harmon wrote:> Hi,
>
> I would like my FunctionPasses to be invoked in reverse call graph
> order (callees before callers). However, "Writing an LLVM Pass"
notes
> that "FunctionPass's do not require that they are executed in a
> particular order." Is there any way at all to specify an ordering?
>
> If this is not possible, I'm thinking of a workaround in which my
> runOnFunction method does not actually process the function but
> instead copies the Function object to a "work set". When
runOnFunction
> has been invoked for all functions, I would then perform the analysis
> on each saved function in the order that I desire. Does this sound
> like the right approach? (Note that my pass is analysis-only -- it
> does not modify the functions.)
>
If you write your pass as a ModulePass, then you can iterate over the
functions in any order that you want.
Unless writing your pass as a CallGraphSCCPass gets you the right
iteration order, writing your pass as a ModulePass looks like the proper
way to do this. FunctionPass'es are supposed to do only local analysis
and are required to be completely independent; a FunctionPass should not
record information between invocations of its runOnFunction() method.
-- John T.
> Thanks,
>
> Trevor
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>