MCPcopy Create free account
hub / github.com/banach-space/llvm-tutor / countStaticCalls

Function countStaticCalls

tools/StaticMain.cpp:44–62  ·  view source on GitHub ↗

===----------------------------------------------------------------------===// static - implementation ===----------------------------------------------------------------------===//

Source from the content-addressed store, hash-verified

42// static - implementation
43//===----------------------------------------------------------------------===//
44static 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.

Callers 1

mainFunction · 0.85

Calls 3

StaticCallCounterClass · 0.85
runMethod · 0.45

Tested by

no test coverage detected