9 #ifndef LLVM_ANALYSIS_MLINLINEADVISOR_H 10 #define LLVM_ANALYSIS_MLINLINEADVISOR_H 18 #include <unordered_map> 38 bool CalleeWasDeleted);
45 virtual std::unique_ptr<MLInlineAdvice>
48 virtual std::unique_ptr<MLInlineAdvice>
55 int64_t getModuleIRSize()
const;
57 std::unique_ptr<CallGraph> CG;
59 int64_t NodeCount = 0;
60 int64_t EdgeCount = 0;
61 std::map<const Function *, unsigned> FunctionLevels;
62 const int32_t InitialIRSize = 0;
63 int32_t CurrentIRSize = 0;
65 bool ForceStop =
false;
101 return static_cast<MLInlineAdvisor *>(
Advisor);
107 #endif // LLVM_ANALYSIS_MLINLINEADVISOR_H Capture state between an inlining decision having had been made, and its impact being observable.
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module.
void recordInliningImpl() override
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
const int64_t CalleeIRSize
Interface for deciding whether to inline a call site or not.
const MLModelRunner & getModelRunner() const
OptimizationRemarkEmitter & ORE
InlineResult is basically true or false.
Function * getCallee() const
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
virtual ~MLInlineAdvisor()=default
int64_t getIRSize(const Function &F) const
int64_t getLocalCalls(Function &F)
Function *const Caller
Caller and Callee are pre-inlining.
InlineAdvice that tracks changes post inlining.
void recordUnattemptedInliningImpl() override
bool isForcedToStop() const
Machine Check Debug Module
Function * getCaller() const
virtual std::unique_ptr< MLInlineAdvice > getMandatoryAdvice(CallBase &CB, OptimizationRemarkEmitter &ORE)
Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR pa...
const int64_t CallerAndCalleeEdges
virtual std::unique_ptr< MLInlineAdvice > getAdviceFromModel(CallBase &CB, OptimizationRemarkEmitter &ORE)
CallGraph * callGraph() const
void recordUnsuccessfulInliningImpl(const InlineResult &Result) override
virtual ~MLInlineAdvice()=default
void onSuccessfulInlining(const MLInlineAdvice &Advice, bool CalleeWasDeleted)
void recordInliningWithCalleeDeletedImpl() override
The basic data container for the call graph of a Module of IR.
std::unique_ptr< InlineAdvice > getAdvice(CallBase &CB) override
Get an InlineAdvice containing a recommendation on whether to inline or not.
const int64_t CallerIRSize
MLInlineAdvice(MLInlineAdvisor *Advisor, CallBase &CB, OptimizationRemarkEmitter &ORE, bool Recommendation)
InlineAdvisor *const Advisor
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.
void onPassEntry() override
This must be called when the Inliner pass is entered, to allow the InlineAdvisor update internal stat...
MLModelRunner interface: abstraction of a mechanism for evaluating a tensorflow "saved model".
std::unique_ptr< MLModelRunner > ModelRunner
MLInlineAdvisor(Module &M, ModuleAnalysisManager &MAM, std::unique_ptr< MLModelRunner > ModelRunner)