LLVM  8.0.1
ModuleSummaryAnalysis.h
Go to the documentation of this file.
1 //===- ModuleSummaryAnalysis.h - Module summary index builder ---*- 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 is the interface to build a ModuleSummaryIndex for a module.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_ANALYSIS_MODULESUMMARYANALYSIS_H
15 #define LLVM_ANALYSIS_MODULESUMMARYANALYSIS_H
16 
17 #include "llvm/ADT/Optional.h"
19 #include "llvm/IR/PassManager.h"
20 #include "llvm/Pass.h"
21 #include <functional>
22 
23 namespace llvm {
24 
25 class BlockFrequencyInfo;
26 class Function;
27 class Module;
28 class ProfileSummaryInfo;
29 
30 /// Direct function to compute a \c ModuleSummaryIndex from a given module.
31 ///
32 /// If operating within a pass manager which has defined ways to compute the \c
33 /// BlockFrequencyInfo for a given function, that can be provided via
34 /// a std::function callback. Otherwise, this routine will manually construct
35 /// that information.
36 ModuleSummaryIndex buildModuleSummaryIndex(
37  const Module &M,
38  std::function<BlockFrequencyInfo *(const Function &F)> GetBFICallback,
39  ProfileSummaryInfo *PSI);
40 
41 /// Analysis pass to provide the ModuleSummaryIndex object.
43  : public AnalysisInfoMixin<ModuleSummaryIndexAnalysis> {
45 
46  static AnalysisKey Key;
47 
48 public:
50 
52 };
53 
54 /// Legacy wrapper pass to provide the ModuleSummaryIndex object.
57 
58 public:
59  static char ID;
60 
62 
63  /// Get the index built by pass
65  const ModuleSummaryIndex &getIndex() const { return *Index; }
66 
67  bool runOnModule(Module &M) override;
68  bool doFinalization(Module &M) override;
69  void getAnalysisUsage(AnalysisUsage &AU) const override;
70 };
71 
72 //===--------------------------------------------------------------------===//
73 //
74 // createModuleSummaryIndexWrapperPass - This pass builds a ModuleSummaryIndex
75 // object for the module, to be written to bitcode or LLVM assembly.
76 //
78 
79 } // end namespace llvm
80 
81 #endif // LLVM_ANALYSIS_MODULESUMMARYANALYSIS_H
This class represents lattice values for constants.
Definition: AllocatorList.h:24
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:65
F(f)
Analysis pass to provide the ModuleSummaryIndex object.
ModuleSummaryIndex buildModuleSummaryIndex(const Module &M, std::function< BlockFrequencyInfo *(const Function &F)> GetBFICallback, ProfileSummaryInfo *PSI)
Direct function to compute a ModuleSummaryIndex from a given module.
const ModuleSummaryIndex & getIndex() const
ModuleSummaryIndex & getIndex()
Get the index built by pass.
Class to hold module path string table and global value map, and encapsulate methods for operating on...
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:383
Represent the analysis usage information of a pass.
Result run(Module &M, ModuleAnalysisManager &AM)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:225
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
ModulePass * createModuleSummaryIndexWrapperPass()
print Print MemDeps of function
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:71
Legacy wrapper pass to provide the ModuleSummaryIndex object.