1//===- InlineSizeEstimatorAnalysis.h - ML size estimator --------*- 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
10#ifndef LLVM_ANALYSIS_INLINESIZEESTIMATORANALYSIS_H
11#define LLVM_ANALYSIS_INLINESIZEESTIMATORANALYSIS_H
12
13#include "llvm/IR/PassManager.h"
14
15namespace llvm {
16class Function;
17
18class TFModelEvaluator;
19class InlineSizeEstimatorAnalysis
20 : public AnalysisInfoMixin<InlineSizeEstimatorAnalysis> {
21public:
22 InlineSizeEstimatorAnalysis();
23 InlineSizeEstimatorAnalysis(InlineSizeEstimatorAnalysis &&);
24 ~InlineSizeEstimatorAnalysis();
25
26 static AnalysisKey Key;
27 using Result = std::optional<size_t>;
28 Result run(const Function &F, FunctionAnalysisManager &FAM);
29 static bool isEvaluatorRequested();
30
31private:
32 std::unique_ptr<TFModelEvaluator> Evaluator;
33};
34
35class InlineSizeEstimatorAnalysisPrinterPass
36 : public PassInfoMixin<InlineSizeEstimatorAnalysisPrinterPass> {
37 raw_ostream &OS;
38
39public:
40 explicit InlineSizeEstimatorAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {}
41
42 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
43
44 static bool isRequired() { return true; }
45};
46} // namespace llvm
47#endif // LLVM_ANALYSIS_INLINESIZEESTIMATORANALYSIS_H
48

source code of llvm/include/llvm/Analysis/InlineSizeEstimatorAnalysis.h