/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h
Line | Count | Source |
1 | | //===- AliasAnalysisEvaluator.h - Alias Analysis Accuracy Evaluator -------===// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | /// \file |
10 | | /// |
11 | | /// This file implements a simple N^2 alias analysis accuracy evaluator. The |
12 | | /// analysis result is a set of statistics of how many times the AA |
13 | | /// infrastructure provides each kind of alias result and mod/ref result when |
14 | | /// queried with all pairs of pointers in the function. |
15 | | /// |
16 | | /// It can be used to evaluate a change in an alias analysis implementation, |
17 | | /// algorithm, or the AA pipeline infrastructure itself. It acts like a stable |
18 | | /// and easily tested consumer of all AA information exposed. |
19 | | /// |
20 | | /// This is inspired and adapted from code by: Naveen Neelakantam, Francesco |
21 | | /// Spadini, and Wojciech Stryjewski. |
22 | | /// |
23 | | //===----------------------------------------------------------------------===// |
24 | | |
25 | | #ifndef LLVM_ANALYSIS_ALIASANALYSISEVALUATOR_H |
26 | | #define LLVM_ANALYSIS_ALIASANALYSISEVALUATOR_H |
27 | | |
28 | | #include "llvm/IR/Function.h" |
29 | | #include "llvm/IR/PassManager.h" |
30 | | |
31 | | namespace llvm { |
32 | | class AAResults; |
33 | | |
34 | | class AAEvaluator : public PassInfoMixin<AAEvaluator> { |
35 | | int64_t FunctionCount; |
36 | | int64_t NoAliasCount, MayAliasCount, PartialAliasCount, MustAliasCount; |
37 | | int64_t NoModRefCount, ModCount, RefCount, ModRefCount; |
38 | | |
39 | | public: |
40 | | AAEvaluator() |
41 | | : FunctionCount(), NoAliasCount(), MayAliasCount(), PartialAliasCount(), |
42 | | MustAliasCount(), NoModRefCount(), ModCount(), RefCount(), |
43 | 145 | ModRefCount() {} |
44 | | AAEvaluator(AAEvaluator &&Arg) |
45 | | : FunctionCount(Arg.FunctionCount), NoAliasCount(Arg.NoAliasCount), |
46 | | MayAliasCount(Arg.MayAliasCount), |
47 | | PartialAliasCount(Arg.PartialAliasCount), |
48 | | MustAliasCount(Arg.MustAliasCount), NoModRefCount(Arg.NoModRefCount), |
49 | | ModCount(Arg.ModCount), RefCount(Arg.RefCount), |
50 | 88 | ModRefCount(Arg.ModRefCount) { |
51 | 88 | Arg.FunctionCount = 0; |
52 | 88 | } |
53 | | ~AAEvaluator(); |
54 | | |
55 | | /// \brief Run the pass over the function. |
56 | | PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); |
57 | | |
58 | | private: |
59 | | // Allow the legacy pass to run this using an internal API. |
60 | | friend class AAEvalLegacyPass; |
61 | | |
62 | | void runInternal(Function &F, AAResults &AA); |
63 | | }; |
64 | | |
65 | | /// Create a wrapper of the above for the legacy pass manager. |
66 | | FunctionPass *createAAEvalPass(); |
67 | | |
68 | | } |
69 | | |
70 | | #endif |