LLVM  4.0.0
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 
39 public:
41  : FunctionCount(), NoAliasCount(), MayAliasCount(), PartialAliasCount(),
42  MustAliasCount(), NoModRefCount(), ModCount(), RefCount(),
43  ModRefCount() {}
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  ModRefCount(Arg.ModRefCount) {
51  Arg.FunctionCount = 0;
52  }
53  ~AAEvaluator();
54 
55  /// \brief Run the pass over the function.
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.
67 
68 }
69 
70 #endif
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.
#define F(x, y, z)
Definition: MD5.cpp:51
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:311
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:107
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:298
AAEvaluator(AAEvaluator &&Arg)
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.