|
|
|||
File indexing completed on 2026-05-10 08:43:13
0001 //===- IndirectCallPromotionAnalysis.h - Indirect call analysis -*- 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 /// \file 0009 /// Interface to identify indirect call promotion candidates. 0010 /// 0011 //===----------------------------------------------------------------------===// 0012 0013 #ifndef LLVM_ANALYSIS_INDIRECTCALLPROMOTIONANALYSIS_H 0014 #define LLVM_ANALYSIS_INDIRECTCALLPROMOTIONANALYSIS_H 0015 0016 #include "llvm/ProfileData/InstrProf.h" 0017 0018 namespace llvm { 0019 0020 class Instruction; 0021 0022 // Class for identifying profitable indirect call promotion candidates when 0023 // the indirect-call value profile metadata is available. 0024 class ICallPromotionAnalysis { 0025 private: 0026 // Allocate space to read the profile annotation. 0027 SmallVector<InstrProfValueData, 4> ValueDataArray; 0028 0029 // Count is the call count for the direct-call target. 0030 // TotalCount is the total call count for the indirect-call callsite. 0031 // RemainingCount is the TotalCount minus promoted-direct-call count. 0032 // Return true we should promote this indirect-call target. 0033 bool isPromotionProfitable(uint64_t Count, uint64_t TotalCount, 0034 uint64_t RemainingCount); 0035 0036 // Returns the number of profitable candidates to promote for the 0037 // current ValueDataArray and the given \p Inst. 0038 uint32_t getProfitablePromotionCandidates(const Instruction *Inst, 0039 uint64_t TotalCount); 0040 0041 // Noncopyable 0042 ICallPromotionAnalysis(const ICallPromotionAnalysis &other) = delete; 0043 ICallPromotionAnalysis & 0044 operator=(const ICallPromotionAnalysis &other) = delete; 0045 0046 public: 0047 ICallPromotionAnalysis() = default; 0048 0049 /// Returns reference to array of InstrProfValueData for the given 0050 /// instruction \p I. 0051 /// 0052 /// The \p TotalCount and \p NumCandidates are set to the the total profile 0053 /// count of the indirect call \p I and the number of profitable candidates 0054 /// in the given array (which is sorted in reverse order of profitability). 0055 /// 0056 /// The returned array space is owned by this class, and overwritten on 0057 /// subsequent calls. 0058 MutableArrayRef<InstrProfValueData> getPromotionCandidatesForInstruction( 0059 const Instruction *I, uint64_t &TotalCount, uint32_t &NumCandidates); 0060 }; 0061 0062 } // end namespace llvm 0063 0064 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|