LLVM  4.0.0
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/STLExtras.h"
19 #include "llvm/IR/PassManager.h"
20 #include "llvm/Pass.h"
21 
22 namespace llvm {
23 class BlockFrequencyInfo;
24 class ProfileSummaryInfo;
25 
26 /// Direct function to compute a \c ModuleSummaryIndex from a given module.
27 ///
28 /// If operating within a pass manager which has defined ways to compute the \c
29 /// BlockFrequencyInfo for a given function, that can be provided via
30 /// a std::function callback. Otherwise, this routine will manually construct
31 /// that information.
32 ModuleSummaryIndex buildModuleSummaryIndex(
33  const Module &M,
34  std::function<BlockFrequencyInfo *(const Function &F)> GetBFICallback,
35  ProfileSummaryInfo *PSI);
36 
37 /// Analysis pass to provide the ModuleSummaryIndex object.
39  : public AnalysisInfoMixin<ModuleSummaryIndexAnalysis> {
41  static AnalysisKey Key;
42 
43 public:
45 
47 };
48 
49 /// Legacy wrapper pass to provide the ModuleSummaryIndex object.
52 
53 public:
54  static char ID;
55 
57 
58  /// Get the index built by pass
59  ModuleSummaryIndex &getIndex() { return *Index; }
60  const ModuleSummaryIndex &getIndex() const { return *Index; }
61 
62  bool runOnModule(Module &M) override;
63  bool doFinalization(Module &M) override;
64  void getAnalysisUsage(AnalysisUsage &AU) const override;
65 };
66 
67 //===--------------------------------------------------------------------===//
68 //
69 // createModuleSummaryIndexWrapperPass - This pass builds a ModuleSummaryIndex
70 // object for the module, to be written to bitcode or LLVM assembly.
71 //
73 }
74 
75 #endif
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:52
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.
#define F(x, y, z)
Definition: MD5.cpp:51
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...
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
const ModuleSummaryIndex & getIndex() const
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:328
Represent the analysis usage information of a pass.
Result run(Module &M, ModuleAnalysisManager &AM)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:235
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
ModulePass * createModuleSummaryIndexWrapperPass()
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on...
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:64
Legacy wrapper pass to provide the ModuleSummaryIndex object.