Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.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/IR/ModuleSummaryIndex.h"
17#include "llvm/IR/PassManager.h"
18#include "llvm/Pass.h"
19#include <functional>
20#include <optional>
21
22namespacellvm {
23
24classBlockFrequencyInfo;
25classFunction;
26classModule;
27classProfileSummaryInfo;
28classStackSafetyInfo;
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.
36ModuleSummaryIndexbuildModuleSummaryIndex(
37constModule &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 * {returnnullptr; });
42
43/// Analysis pass to provide the ModuleSummaryIndex object.
44classModuleSummaryIndexAnalysis
45 :publicAnalysisInfoMixin<ModuleSummaryIndexAnalysis> {
46friendAnalysisInfoMixin<ModuleSummaryIndexAnalysis>;
47
48staticAnalysisKey Key;
49
50public:
51usingResult =ModuleSummaryIndex;
52
53Resultrun(Module &M,ModuleAnalysisManager &AM);
54};
55
56/// Legacy wrapper pass to provide the ModuleSummaryIndex object.
57classModuleSummaryIndexWrapperPass :publicModulePass {
58 std::optional<ModuleSummaryIndex> Index;
59
60public:
61staticcharID;
62
63ModuleSummaryIndexWrapperPass();
64
65 /// Get the index built by pass
66ModuleSummaryIndex &getIndex() {return *Index; }
67constModuleSummaryIndex &getIndex() const{return *Index; }
68
69boolrunOnModule(Module &M)override;
70booldoFinalization(Module &M)override;
71voidgetAnalysisUsage(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//
79ModulePass *createModuleSummaryIndexWrapperPass();
80
81/// Legacy wrapper pass to provide the ModuleSummaryIndex object.
82classImmutableModuleSummaryIndexWrapperPass :publicImmutablePass {
83constModuleSummaryIndex *Index;
84
85public:
86staticcharID;
87
88ImmutableModuleSummaryIndexWrapperPass(
89constModuleSummaryIndex *Index =nullptr);
90constModuleSummaryIndex *getIndex() const{return Index; }
91voidgetAnalysisUsage(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//
99ImmutablePass *
100createImmutableModuleSummaryIndexWrapperPass(const ModuleSummaryIndex *Index);
101
102/// Returns true if the instruction could have memprof metadata, used to ensure
103/// consistency between summary analysis and the ThinLTO backend processing.
104boolmayHaveMemprofSummary(constCallBase *CB);
105
106}// end namespace llvm
107
108#endif// LLVM_ANALYSIS_MODULESUMMARYANALYSIS_H
Index
uint32_t Index
Definition:ELFObjHandler.cpp:83
PassManager.h
This header defines various interfaces for pass management in LLVM.
F
#define F(x, y, z)
Definition:MD5.cpp:55
Module
Machine Check Debug Module
Definition:MachineCheckDebugify.cpp:124
ModuleSummaryIndex.h
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
Pass.h
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition:PassManager.h:253
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition:PassAnalysisSupport.h:47
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition:InstrTypes.h:1112
llvm::ImmutableModuleSummaryIndexWrapperPass
Legacy wrapper pass to provide the ModuleSummaryIndex object.
Definition:ModuleSummaryAnalysis.h:82
llvm::ImmutableModuleSummaryIndexWrapperPass::ID
static char ID
Definition:ModuleSummaryAnalysis.h:86
llvm::ImmutableModuleSummaryIndexWrapperPass::getIndex
const ModuleSummaryIndex * getIndex() const
Definition:ModuleSummaryAnalysis.h:90
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:1206
llvm::ImmutablePass
ImmutablePass class - This class is used to provide information that does not need to be run.
Definition:Pass.h:281
llvm::ModulePass
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition:Pass.h:251
llvm::ModuleSummaryIndexAnalysis
Analysis pass to provide the ModuleSummaryIndex object.
Definition:ModuleSummaryAnalysis.h:45
llvm::ModuleSummaryIndexAnalysis::run
Result run(Module &M, ModuleAnalysisManager &AM)
Definition:ModuleSummaryAnalysis.cpp:1128
llvm::ModuleSummaryIndexWrapperPass
Legacy wrapper pass to provide the ModuleSummaryIndex object.
Definition:ModuleSummaryAnalysis.h:57
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:1190
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:1185
llvm::ModuleSummaryIndexWrapperPass::ModuleSummaryIndexWrapperPass
ModuleSummaryIndexWrapperPass()
Definition:ModuleSummaryAnalysis.cpp:1160
llvm::ModuleSummaryIndexWrapperPass::runOnModule
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
Definition:ModuleSummaryAnalysis.cpp:1165
llvm::ModuleSummaryIndexWrapperPass::getIndex
ModuleSummaryIndex & getIndex()
Get the index built by pass.
Definition:ModuleSummaryAnalysis.h:66
llvm::ModuleSummaryIndexWrapperPass::getIndex
const ModuleSummaryIndex & getIndex() const
Definition:ModuleSummaryAnalysis.h:67
llvm::ModuleSummaryIndexWrapperPass::ID
static char ID
Definition:ModuleSummaryAnalysis.h:61
llvm::ModuleSummaryIndex
Class to hold module path string table and global value map, and encapsulate methods for operating on...
Definition:ModuleSummaryIndex.h:1345
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition:Module.h:65
llvm::codeview::PublicSymFlags::Function
@ Function
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
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:914
llvm::createModuleSummaryIndexWrapperPass
ModulePass * createModuleSummaryIndexWrapperPass()
Definition:ModuleSummaryAnalysis.cpp:1156
llvm::createImmutableModuleSummaryIndexWrapperPass
ImmutablePass * createImmutableModuleSummaryIndexWrapperPass(const ModuleSummaryIndex *Index)
Definition:ModuleSummaryAnalysis.cpp:1211
llvm::mayHaveMemprofSummary
bool mayHaveMemprofSummary(const CallBase *CB)
Returns true if the instruction could have memprof metadata, used to ensure consistency between summa...
llvm::AnalysisInfoMixin
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition:PassManager.h:92
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition:Analysis.h:28

Generated on Sun Jul 20 2025 06:27:02 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp