1 //===-- ProfilePaths.h - interface to insert instrumentation -----*- C++ -*--=//
3 // This inserts intrumentation for counting
4 // execution of paths though a given method
5 // Its implemented as a "Method" Pass, and called using opt
7 // This pass is implemented by using algorithms similar to
8 // 1."Efficient Path Profiling": Ball, T. and Larus, J. R.,
9 // Proceedings of Micro-29, Dec 1996, Paris, France.
10 // 2."Efficiently Counting Program events with support for on-line
11 // "queries": Ball T., ACM Transactions on Programming Languages
12 // and systems, Sep 1994.
14 // The algorithms work on a Graph constructed over the nodes
15 // made from Basic Blocks: The transformations then take place on
16 // the constucted graph (implementation in Graph.cpp and GraphAuxillary.cpp)
17 // and finally, appropriate instrumentation is placed over suitable edges.
18 // (code inserted through EdgeCode.cpp).
20 // The algorithm inserts code such that every acyclic path in the CFG
21 // of a method is identified through a unique number. the code insertion
22 // is optimal in the sense that its inserted over a minimal set of edges. Also,
23 // the algorithm makes sure than initialization, path increment and counter
24 // update can be collapsed into minmimum number of edges.
25 //===----------------------------------------------------------------------===//
27 #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_PROFILE_PATHS_H
28 #define LLVM_TRANSFORMS_INSTRUMENTATION_PROFILE_PATHS_H
30 #include "llvm/Pass.h"
32 class ProfilePaths: public MethodPass {
34 bool runOnMethod(Method *M);
36 // getAnalysisUsageInfo - transform cfg to have just one exit node
37 virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
38 Pass::AnalysisSet &Destroyed,
39 Pass::AnalysisSet &Provided);