LLVM  8.0.1
AliasAnalysisEvaluator.h
Go to the documentation of this file.
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  int64_t MustCount, MustRefCount, MustModCount, MustModRefCount;
39 
40 public:
42  : FunctionCount(), NoAliasCount(), MayAliasCount(), PartialAliasCount(),
43  MustAliasCount(), NoModRefCount(), ModCount(), RefCount(),
44  ModRefCount(), MustCount(), MustRefCount(), MustModCount(),
45  MustModRefCount() {}
47  : FunctionCount(Arg.FunctionCount), NoAliasCount(Arg.NoAliasCount),
48  MayAliasCount(Arg.MayAliasCount),
49  PartialAliasCount(Arg.PartialAliasCount),
50  MustAliasCount(Arg.MustAliasCount), NoModRefCount(Arg.NoModRefCount),
51  ModCount(Arg.ModCount), RefCount(Arg.RefCount),
52  ModRefCount(Arg.ModRefCount), MustCount(Arg.MustCount),
53  MustRefCount(Arg.MustRefCount), MustModCount(Arg.MustModCount),
54  MustModRefCount(Arg.MustModRefCount) {
55  Arg.FunctionCount = 0;
56  }
57  ~AAEvaluator();
58 
59  /// Run the pass over the function.
61 
62 private:
63  // Allow the legacy pass to run this using an internal API.
64  friend class AAEvalLegacyPass;
65 
66  void runInternal(Function &F, AAResults &AA);
67 };
68 
69 /// Create a wrapper of the above for the legacy pass manager.
71 
72 }
73 
74 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
FunctionPass * createAAEvalPass()
Create a wrapper of the above for the legacy pass manager.
F(f)
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:366
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:154
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:285
AAEvaluator(AAEvaluator &&Arg)
amdgpu Simplify well known AMD library false Value Value * Arg
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.