LCOV - code coverage report
Current view: top level - include/llvm/Analysis - IndirectCallPromotionAnalysis.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 1 1 100.0 %
Date: 2017-09-14 15:23:50 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- IndirectCallPromotionAnalysis.h - Indirect call analysis -*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : /// \file
      10             : /// Interface to identify indirect call promotion candidates.
      11             : ///
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #ifndef LLVM_ANALYSIS_INDIRECTCALLPROMOTIONANALYSIS_H
      15             : #define LLVM_ANALYSIS_INDIRECTCALLPROMOTIONANALYSIS_H
      16             : 
      17             : #include "llvm/ProfileData/InstrProf.h"
      18             : 
      19             : namespace llvm {
      20             : 
      21             : class Instruction;
      22             : 
      23             : // Class for identifying profitable indirect call promotion candidates when
      24             : // the indirect-call value profile metadata is available.
      25        2592 : class ICallPromotionAnalysis {
      26             : private:
      27             :   // Allocate space to read the profile annotation.
      28             :   std::unique_ptr<InstrProfValueData[]> ValueDataArray;
      29             : 
      30             :   // Count is the call count for the direct-call target.
      31             :   // TotalCount is the total call count for the indirect-call callsite.
      32             :   // RemainingCount is the TotalCount minus promoted-direct-call count.
      33             :   // Return true we should promote this indirect-call target.
      34             :   bool isPromotionProfitable(uint64_t Count, uint64_t TotalCount,
      35             :                              uint64_t RemainingCount);
      36             : 
      37             :   // Returns the number of profitable candidates to promote for the
      38             :   // current ValueDataArray and the given \p Inst.
      39             :   uint32_t getProfitablePromotionCandidates(const Instruction *Inst,
      40             :                                             uint32_t NumVals,
      41             :                                             uint64_t TotalCount);
      42             : 
      43             :   // Noncopyable
      44             :   ICallPromotionAnalysis(const ICallPromotionAnalysis &other) = delete;
      45             :   ICallPromotionAnalysis &
      46             :   operator=(const ICallPromotionAnalysis &other) = delete;
      47             : 
      48             : public:
      49             :   ICallPromotionAnalysis();
      50             : 
      51             :   /// \brief Returns reference to array of InstrProfValueData for the given
      52             :   /// instruction \p I.
      53             :   ///
      54             :   /// The \p NumVals, \p TotalCount and \p NumCandidates
      55             :   /// are set to the number of values in the array, the total profile count
      56             :   /// of the indirect call \p I, and the number of profitable candidates
      57             :   /// in the given array (which is sorted in reverse order of profitability).
      58             :   ///
      59             :   /// The returned array space is owned by this class, and overwritten on
      60             :   /// subsequent calls.
      61             :   ArrayRef<InstrProfValueData>
      62             :   getPromotionCandidatesForInstruction(const Instruction *I, uint32_t &NumVals,
      63             :                                        uint64_t &TotalCount,
      64             :                                        uint32_t &NumCandidates);
      65             : };
      66             : 
      67             : } // end namespace llvm
      68             : 
      69             : #endif

Generated by: LCOV version 1.13