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 
15 namespace llvm {
16 class Function;
17 
18 class TFModelEvaluator;
19 class InlineSizeEstimatorAnalysis
20     : public AnalysisInfoMixin<InlineSizeEstimatorAnalysis> {
21 public:
22   InlineSizeEstimatorAnalysis();
23   InlineSizeEstimatorAnalysis(InlineSizeEstimatorAnalysis &&);
24   ~InlineSizeEstimatorAnalysis();
25 
26   static AnalysisKey Key;
27   using Result = Optional<size_t>;
28   Result run(const Function &F, FunctionAnalysisManager &FAM);
29   static bool isEvaluatorRequested();
30 
31 private:
32   std::unique_ptr<TFModelEvaluator> Evaluator;
33 };
34 } // namespace llvm
35 #endif // LLVM_ANALYSIS_INLINESIZEESTIMATORANALYSIS_H