===----------------------------------------------------------------------===// static - implementation ===----------------------------------------------------------------------===//
| 42 | // static - implementation |
| 43 | //===----------------------------------------------------------------------===// |
| 44 | static void countStaticCalls(Module &M) { |
| 45 | // Create a module pass manager and add StaticCallCounterPrinter to it. |
| 46 | ModulePassManager MPM; |
| 47 | MPM.addPass(StaticCallCounterPrinter(llvm::errs())); |
| 48 | |
| 49 | // Create an analysis manager and register StaticCallCounter with it. |
| 50 | ModuleAnalysisManager MAM; |
| 51 | MAM.registerPass([&] { return StaticCallCounter(); }); |
| 52 | |
| 53 | // Register all available module analysis passes defined in PassRegistry.def. |
| 54 | // We only really need PassInstrumentationAnalysis (which is pulled by |
| 55 | // default by PassBuilder), but to keep this concise, let PassBuilder do all |
| 56 | // the _heavy-lifting_. |
| 57 | PassBuilder PB; |
| 58 | PB.registerModuleAnalyses(MAM); |
| 59 | |
| 60 | // Finally, run the passes registered with MPM |
| 61 | MPM.run(M, MAM); |
| 62 | } |
| 63 | |
| 64 | //===----------------------------------------------------------------------===// |
| 65 | // Main driver code. |
no test coverage detected