applying a pass only on execution paths

Hello everyone,

I have a pass that is analyzing the entire module (using runOnFunction()). But I want to apply it on each execution path.

I assume I have to divide my module into functions by constructing a CallGraph and then divide every function into instructions by construction CFG-s in the nodes of the previous mentioned CallGraph. I assume that the execution paths from a node that I choose are all the paths finishing in the CallGraph leaves (I should be able to communicate between CFG-s). From that node I can see all the paths by using a graph search algorithm.

Is there a possibility to replace the runOnFunction() / runOnModule() method with something user defined, like runOnExecutionPath() ? And if so, there is in LLVM a structure that is appropriate to store execution paths?

Another possibility can be to use getAnalysis or getAnalysis? I am confused.

Thank you a lot for any advice !

Bests,
Alex