Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 14 | pmbaty | 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 = std::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 | |||
| 35 | class InlineSizeEstimatorAnalysisPrinterPass |
||
| 36 | : public PassInfoMixin<InlineSizeEstimatorAnalysisPrinterPass> { |
||
| 37 | raw_ostream &OS; |
||
| 38 | |||
| 39 | public: |
||
| 40 | explicit InlineSizeEstimatorAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} |
||
| 41 | |||
| 42 | PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); |
||
| 43 | }; |
||
| 44 | } // namespace llvm |
||
| 45 | #endif // LLVM_ANALYSIS_INLINESIZEESTIMATORANALYSIS_H |