MachineVerifier: Check that SlotIndex MBBIndexList is sorted.
[oota-llvm.git] / include / llvm / Analysis / AliasAnalysisCounter.h
1 //===- AliasAnalysisCounter.h - Alias Analysis Query Counter ----*- C++ -*-===//
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 /// This declares an alias analysis which counts and prints queries made
11 /// through it. By inserting this between other AAs you can track when specific
12 /// layers of LLVM's AA get queried.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_ANALYSIS_ALIASANALYSISCOUNTER_H
17 #define LLVM_ANALYSIS_ALIASANALYSISCOUNTER_H
18
19 #include "llvm/Analysis/AliasAnalysis.h"
20 #include "llvm/IR/Module.h"
21 #include "llvm/Pass.h"
22
23 namespace llvm {
24
25 class AliasAnalysisCounter : public ModulePass, public AliasAnalysis {
26   unsigned No, May, Partial, Must;
27   unsigned NoMR, JustRef, JustMod, MR;
28   Module *M;
29
30 public:
31   static char ID; // Class identification, replacement for typeinfo
32
33   AliasAnalysisCounter();
34   ~AliasAnalysisCounter() override;
35
36   bool runOnModule(Module &M) override;
37
38   void getAnalysisUsage(AnalysisUsage &AU) const override;
39
40   /// getAdjustedAnalysisPointer - This method is used when a pass implements
41   /// an analysis interface through multiple inheritance.  If needed, it
42   /// should override this to adjust the this pointer as needed for the
43   /// specified pass info.
44   void *getAdjustedAnalysisPointer(AnalysisID PI) override;
45
46   // Forwarding functions: just delegate to a real AA implementation, counting
47   // the number of responses...
48   AliasResult alias(const MemoryLocation &LocA,
49                     const MemoryLocation &LocB) override;
50
51   using AliasAnalysis::getModRefInfo;
52   ModRefInfo getModRefInfo(ImmutableCallSite CS,
53                            const MemoryLocation &Loc) override;
54 };
55
56 //===--------------------------------------------------------------------===//
57 //
58 // createAliasAnalysisCounterPass - This pass counts alias queries and how the
59 // alias analysis implementation responds.
60 //
61 ModulePass *createAliasAnalysisCounterPass();
62
63 }
64
65 #endif