IPA based pass


I’m trying to write a pass that deals with the whole program, and should be based on the CallGraph information.

I understand that the way of doing that is inherit from CallGraphSCCPass. Is that correct?

In addition, I would like to know:

  1. I read that this pass works bottom-up. Is there a pass that works top-down?

  2. How do I get the Module and the Context in runOnSCC function? I need them in order to insert new function calls into existing functions? What’s the meaning of Module and Context exactly?

Thanks a lot in advance,