LCOV - code coverage report
Current view: top level - include/llvm/Support - BlockFrequency.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 3 12 25.0 %
Date: 2018-10-20 13:21:21 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-------- BlockFrequency.h - Block Frequency Wrapper --------*- 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             : //
      10             : // This file implements Block Frequency class.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #ifndef LLVM_SUPPORT_BLOCKFREQUENCY_H
      15             : #define LLVM_SUPPORT_BLOCKFREQUENCY_H
      16             : 
      17             : #include "llvm/Support/BranchProbability.h"
      18             : #include "llvm/Support/DataTypes.h"
      19             : 
      20             : namespace llvm {
      21             : 
      22             : class raw_ostream;
      23             : 
      24             : // This class represents Block Frequency as a 64-bit value.
      25             : class BlockFrequency {
      26             :   uint64_t Frequency;
      27             : 
      28             : public:
      29    11366620 :   BlockFrequency(uint64_t Freq = 0) : Frequency(Freq) { }
      30             : 
      31             :   /// Returns the maximum possible frequency, the saturation value.
      32             :   static uint64_t getMaxFrequency() { return -1ULL; }
      33             : 
      34             :   /// Returns the frequency as a fixpoint number scaled by the entry
      35             :   /// frequency.
      36           0 :   uint64_t getFrequency() const { return Frequency; }
      37             : 
      38             :   /// Multiplies with a branch probability. The computation will never
      39             :   /// overflow.
      40             :   BlockFrequency &operator*=(BranchProbability Prob);
      41             :   BlockFrequency operator*(BranchProbability Prob) const;
      42             : 
      43             :   /// Divide by a non-zero branch probability using saturating
      44             :   /// arithmetic.
      45             :   BlockFrequency &operator/=(BranchProbability Prob);
      46             :   BlockFrequency operator/(BranchProbability Prob) const;
      47             : 
      48             :   /// Adds another block frequency using saturating arithmetic.
      49             :   BlockFrequency &operator+=(BlockFrequency Freq);
      50             :   BlockFrequency operator+(BlockFrequency Freq) const;
      51             : 
      52             :   /// Subtracts another block frequency using saturating arithmetic.
      53             :   BlockFrequency &operator-=(BlockFrequency Freq);
      54             :   BlockFrequency operator-(BlockFrequency Freq) const;
      55             : 
      56             :   /// Shift block frequency to the right by count digits saturating to 1.
      57             :   BlockFrequency &operator>>=(const unsigned count);
      58             : 
      59           0 :   bool operator<(BlockFrequency RHS) const {
      60        4280 :     return Frequency < RHS.Frequency;
      61             :   }
      62             : 
      63           0 :   bool operator<=(BlockFrequency RHS) const {
      64           0 :     return Frequency <= RHS.Frequency;
      65             :   }
      66             : 
      67           0 :   bool operator>(BlockFrequency RHS) const {
      68           0 :     return Frequency > RHS.Frequency;
      69             :   }
      70             : 
      71           0 :   bool operator>=(BlockFrequency RHS) const {
      72     2037267 :     return Frequency >= RHS.Frequency;
      73             :   }
      74             : 
      75           0 :   bool operator==(BlockFrequency RHS) const {
      76           0 :     return Frequency == RHS.Frequency;
      77             :   }
      78             : };
      79             : 
      80             : }
      81             : 
      82             : #endif

Generated by: LCOV version 1.13