File indexing completed on 2026-05-10 08:43:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_ANALYSIS_MODULESUMMARYANALYSIS_H
0014 #define LLVM_ANALYSIS_MODULESUMMARYANALYSIS_H
0015
0016 #include "llvm/IR/ModuleSummaryIndex.h"
0017 #include "llvm/IR/PassManager.h"
0018 #include "llvm/Pass.h"
0019 #include <functional>
0020 #include <optional>
0021
0022 namespace llvm {
0023
0024 class BlockFrequencyInfo;
0025 class Function;
0026 class Module;
0027 class ProfileSummaryInfo;
0028 class StackSafetyInfo;
0029
0030
0031
0032
0033
0034
0035
0036 ModuleSummaryIndex buildModuleSummaryIndex(
0037 const Module &M,
0038 std::function<BlockFrequencyInfo *(const Function &F)> GetBFICallback,
0039 ProfileSummaryInfo *PSI,
0040 std::function<const StackSafetyInfo *(const Function &F)> GetSSICallback =
0041 [](const Function &F) -> const StackSafetyInfo * { return nullptr; });
0042
0043
0044 class ModuleSummaryIndexAnalysis
0045 : public AnalysisInfoMixin<ModuleSummaryIndexAnalysis> {
0046 friend AnalysisInfoMixin<ModuleSummaryIndexAnalysis>;
0047
0048 static AnalysisKey Key;
0049
0050 public:
0051 using Result = ModuleSummaryIndex;
0052
0053 Result run(Module &M, ModuleAnalysisManager &AM);
0054 };
0055
0056
0057 class ModuleSummaryIndexWrapperPass : public ModulePass {
0058 std::optional<ModuleSummaryIndex> Index;
0059
0060 public:
0061 static char ID;
0062
0063 ModuleSummaryIndexWrapperPass();
0064
0065
0066 ModuleSummaryIndex &getIndex() { return *Index; }
0067 const ModuleSummaryIndex &getIndex() const { return *Index; }
0068
0069 bool runOnModule(Module &M) override;
0070 bool doFinalization(Module &M) override;
0071 void getAnalysisUsage(AnalysisUsage &AU) const override;
0072 };
0073
0074
0075
0076
0077
0078
0079 ModulePass *createModuleSummaryIndexWrapperPass();
0080
0081
0082 class ImmutableModuleSummaryIndexWrapperPass : public ImmutablePass {
0083 const ModuleSummaryIndex *Index;
0084
0085 public:
0086 static char ID;
0087
0088 ImmutableModuleSummaryIndexWrapperPass(
0089 const ModuleSummaryIndex *Index = nullptr);
0090 const ModuleSummaryIndex *getIndex() const { return Index; }
0091 void getAnalysisUsage(AnalysisUsage &AU) const override;
0092 };
0093
0094
0095
0096
0097
0098
0099 ImmutablePass *
0100 createImmutableModuleSummaryIndexWrapperPass(const ModuleSummaryIndex *Index);
0101
0102
0103
0104 bool mayHaveMemprofSummary(const CallBase *CB);
0105
0106 }
0107
0108 #endif