LLVM 23.0.0git
InlineOrder.h
Go to the documentation of this file.
1//===- InlineOrder.h - Inlining order abstraction -*- 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//
9#ifndef LLVM_ANALYSIS_INLINEORDER_H
10#define LLVM_ANALYSIS_INLINEORDER_H
11
14#include <utility>
15
16namespace llvm {
17class CallBase;
18template <typename Fn> class function_ref;
19
21public:
22 virtual ~InlineOrder() = default;
23
24 virtual size_t size() = 0;
25
26 virtual void push(CallBase *Elt) = 0;
27
28 virtual CallBase *pop() = 0;
29
30 virtual void erase_if(function_ref<bool(CallBase *)> Pred) = 0;
31
32 bool empty() { return !size(); }
33};
34
35LLVM_ABI std::unique_ptr<InlineOrder>
36getDefaultInlineOrder(FunctionAnalysisManager &FAM, const InlineParams &Params,
38
39LLVM_ABI std::unique_ptr<InlineOrder>
40getInlineOrder(FunctionAnalysisManager &FAM, const InlineParams &Params,
42
43/// Used for dynamically loading instances of InlineOrder as plugins
44///
45/// Plugins must implement an InlineOrderFactory, for an example refer to:
46/// llvm/unittests/Analysis/InlineOrderPlugin/InlineOrderPlugin.cpp
47///
48/// If a PluginInlineOrderAnalysis has been registered with the
49/// current ModuleAnalysisManager, llvm::getInlineOrder returns an
50/// InlineOrder created by the PluginInlineOrderAnalysis' Factory.
51///
53 : public AnalysisInfoMixin<PluginInlineOrderAnalysis> {
54public:
56
57 typedef std::unique_ptr<InlineOrder> (*InlineOrderFactory)(
60
61 PluginInlineOrderAnalysis(InlineOrderFactory Factory) : Factory(Factory) {
62 assert(Factory != nullptr &&
63 "The plugin inline order factory should not be a null pointer.");
64 }
65
69
70 Result run(Module &, ModuleAnalysisManager &) { return {Factory}; }
71 Result getResult() { return {Factory}; }
72
73private:
74 InlineOrderFactory Factory;
75};
76
77} // namespace llvm
78#endif // LLVM_ANALYSIS_INLINEORDER_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_ABI
Definition Compiler.h:213
Machine Check Debug Module
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
virtual void erase_if(function_ref< bool(CallBase *)> Pred)=0
virtual ~InlineOrder()=default
virtual void push(CallBase *Elt)=0
virtual size_t size()=0
virtual CallBase * pop()=0
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
PluginInlineOrderAnalysis(InlineOrderFactory Factory)
Definition InlineOrder.h:61
static LLVM_ABI AnalysisKey Key
Definition InlineOrder.h:55
std::unique_ptr< InlineOrder >(* InlineOrderFactory)(FunctionAnalysisManager &FAM, const InlineParams &Params, ModuleAnalysisManager &MAM, Module &M)
Definition InlineOrder.h:57
Result run(Module &, ModuleAnalysisManager &)
Definition InlineOrder.h:70
An efficient, type-erasing, non-owning reference to a callable.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::unique_ptr< InlineOrder > getDefaultInlineOrder(FunctionAnalysisManager &FAM, const InlineParams &Params, ModuleAnalysisManager &MAM, Module &M)
LLVM_ABI std::unique_ptr< InlineOrder > getInlineOrder(FunctionAnalysisManager &FAM, const InlineParams &Params, ModuleAnalysisManager &MAM, Module &M)
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition PassManager.h:93
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29
Thresholds to tune inline cost analysis.
Definition InlineCost.h:207