LLVM  14.0.0git
ModuleSummaryAnalysis.h
Go to the documentation of this file.
1 //===- ModuleSummaryAnalysis.h - Module summary index builder ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 /// This is the interface to build a ModuleSummaryIndex for a module.
10 ///
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_ANALYSIS_MODULESUMMARYANALYSIS_H
14 #define LLVM_ANALYSIS_MODULESUMMARYANALYSIS_H
15 
16 #include "llvm/ADT/Optional.h"
18 #include "llvm/IR/PassManager.h"
19 #include "llvm/Pass.h"
20 #include <functional>
21 
22 namespace llvm {
23 
24 class BlockFrequencyInfo;
25 class Function;
26 class Module;
27 class ProfileSummaryInfo;
28 class StackSafetyInfo;
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  std::function<const StackSafetyInfo *(const Function &F)> GetSSICallback =
41  [](const Function &F) -> const StackSafetyInfo * { return nullptr; });
42 
43 /// Analysis pass to provide the ModuleSummaryIndex object.
45  : public AnalysisInfoMixin<ModuleSummaryIndexAnalysis> {
47 
48  static AnalysisKey Key;
49 
50 public:
52 
54 };
55 
56 /// Legacy wrapper pass to provide the ModuleSummaryIndex object.
59 
60 public:
61  static char ID;
62 
64 
65  /// Get the index built by pass
66  ModuleSummaryIndex &getIndex() { return *Index; }
67  const ModuleSummaryIndex &getIndex() const { return *Index; }
68 
69  bool runOnModule(Module &M) override;
70  bool doFinalization(Module &M) override;
71  void getAnalysisUsage(AnalysisUsage &AU) const override;
72 };
73 
74 //===--------------------------------------------------------------------===//
75 //
76 // createModuleSummaryIndexWrapperPass - This pass builds a ModuleSummaryIndex
77 // object for the module, to be written to bitcode or LLVM assembly.
78 //
80 
81 /// Legacy wrapper pass to provide the ModuleSummaryIndex object.
83  const ModuleSummaryIndex *Index;
84 
85 public:
86  static char ID;
87 
89  const ModuleSummaryIndex *Index = nullptr);
90  const ModuleSummaryIndex *getIndex() const { return Index; }
91  void getAnalysisUsage(AnalysisUsage &AU) const override;
92 };
93 
94 //===--------------------------------------------------------------------===//
95 //
96 // ImmutableModuleSummaryIndexWrapperPass - This pass wrap provided
97 // ModuleSummaryIndex object for the module, to be used by other passes.
98 //
99 ImmutablePass *
100 createImmutableModuleSummaryIndexWrapperPass(const ModuleSummaryIndex *Index);
101 
102 } // end namespace llvm
103 
104 #endif // LLVM_ANALYSIS_MODULESUMMARYANALYSIS_H
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
Optional.h
llvm::ModulePass
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:238
llvm::ImmutablePass
ImmutablePass class - This class is used to provide information that does not need to be run.
Definition: Pass.h:269
Pass.h
llvm::ImmutableModuleSummaryIndexWrapperPass
Legacy wrapper pass to provide the ModuleSummaryIndex object.
Definition: ModuleSummaryAnalysis.h:82
llvm::ModuleSummaryIndexAnalysis
Analysis pass to provide the ModuleSummaryIndex object.
Definition: ModuleSummaryAnalysis.h:44
llvm::ModuleSummaryIndexWrapperPass::ModuleSummaryIndexWrapperPass
ModuleSummaryIndexWrapperPass()
Definition: ModuleSummaryAnalysis.cpp:888
llvm::createImmutableModuleSummaryIndexWrapperPass
ImmutablePass * createImmutableModuleSummaryIndexWrapperPass(const ModuleSummaryIndex *Index)
Definition: ModuleSummaryAnalysis.cpp:939
llvm::Optional
Definition: APInt.h:33
llvm::ImmutableModuleSummaryIndexWrapperPass::getIndex
const ModuleSummaryIndex * getIndex() const
Definition: ModuleSummaryAnalysis.h:90
ModuleSummaryIndex.h
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::ImmutableModuleSummaryIndexWrapperPass::ID
static char ID
Definition: ModuleSummaryAnalysis.h:86
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::ModuleSummaryIndexAnalysis::run
Result run(Module &M, ModuleAnalysisManager &AM)
Definition: ModuleSummaryAnalysis.cpp:856
llvm::ImmutableModuleSummaryIndexWrapperPass::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: ModuleSummaryAnalysis.cpp:934
llvm::ImmutableModuleSummaryIndexWrapperPass::ImmutableModuleSummaryIndexWrapperPass
ImmutableModuleSummaryIndexWrapperPass(const ModuleSummaryIndex *Index=nullptr)
Definition: ModuleSummaryAnalysis.cpp:927
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::ModuleSummaryIndexWrapperPass::ID
static char ID
Definition: ModuleSummaryAnalysis.h:61
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:72
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::AnalysisInfoMixin
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:397
llvm::ModuleSummaryIndexWrapperPass::getIndex
ModuleSummaryIndex & getIndex()
Get the index built by pass.
Definition: ModuleSummaryAnalysis.h:66
llvm::ModuleSummaryIndexWrapperPass::doFinalization
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
Definition: ModuleSummaryAnalysis.cpp:913
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::createModuleSummaryIndexWrapperPass
ModulePass * createModuleSummaryIndexWrapperPass()
Definition: ModuleSummaryAnalysis.cpp:884
llvm::ModuleSummaryIndexWrapperPass::getIndex
const ModuleSummaryIndex & getIndex() const
Definition: ModuleSummaryAnalysis.h:67
PassManager.h
llvm::buildModuleSummaryIndex
ModuleSummaryIndex buildModuleSummaryIndex(const Module &M, std::function< BlockFrequencyInfo *(const Function &F)> GetBFICallback, ProfileSummaryInfo *PSI, std::function< const StackSafetyInfo *(const Function &F)> GetSSICallback=[](const Function &F) -> const StackSafetyInfo *{ return nullptr;})
Direct function to compute a ModuleSummaryIndex from a given module.
Definition: ModuleSummaryAnalysis.cpp:658
llvm::ModuleSummaryIndexWrapperPass::runOnModule
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
Definition: ModuleSummaryAnalysis.cpp:893
llvm::ModuleSummaryIndex
Class to hold module path string table and global value map, and encapsulate methods for operating on...
Definition: ModuleSummaryIndex.h:1028
llvm::ModuleSummaryIndexWrapperPass::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: ModuleSummaryAnalysis.cpp:918
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::ModuleSummaryIndexWrapperPass
Legacy wrapper pass to provide the ModuleSummaryIndex object.
Definition: ModuleSummaryAnalysis.h:57
llvm::codeview::PublicSymFlags::Function
@ Function