Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:13

0001 //===- InlineSizeEstimatorAnalysis.h - ML size estimator --------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 
0010 #ifndef LLVM_ANALYSIS_INLINESIZEESTIMATORANALYSIS_H
0011 #define LLVM_ANALYSIS_INLINESIZEESTIMATORANALYSIS_H
0012 
0013 #include "llvm/IR/PassManager.h"
0014 
0015 namespace llvm {
0016 class Function;
0017 
0018 class TFModelEvaluator;
0019 class InlineSizeEstimatorAnalysis
0020     : public AnalysisInfoMixin<InlineSizeEstimatorAnalysis> {
0021 public:
0022   InlineSizeEstimatorAnalysis();
0023   InlineSizeEstimatorAnalysis(InlineSizeEstimatorAnalysis &&);
0024   ~InlineSizeEstimatorAnalysis();
0025 
0026   static AnalysisKey Key;
0027   using Result = std::optional<size_t>;
0028   Result run(const Function &F, FunctionAnalysisManager &FAM);
0029   static bool isEvaluatorRequested();
0030 
0031 private:
0032   std::unique_ptr<TFModelEvaluator> Evaluator;
0033 };
0034 
0035 class InlineSizeEstimatorAnalysisPrinterPass
0036     : public PassInfoMixin<InlineSizeEstimatorAnalysisPrinterPass> {
0037   raw_ostream &OS;
0038 
0039 public:
0040   explicit InlineSizeEstimatorAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {}
0041 
0042   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
0043 
0044   static bool isRequired() { return true; }
0045 };
0046 } // namespace llvm
0047 #endif // LLVM_ANALYSIS_INLINESIZEESTIMATORANALYSIS_H