LLVM: include/llvm/Support/BlockFrequency.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_SUPPORT_BLOCKFREQUENCY_H
14#define LLVM_SUPPORT_BLOCKFREQUENCY_H
15
17#include
18#include
19#include
20
21namespace llvm {
22
25
26
29
30public:
33
34
36
37
38
40
41
42
45
46
47
50
51
53 uint64_t Before = Freq.Frequency;
54 Frequency += Freq.Frequency;
55
56
57 if (Frequency < Before)
59
60 return *this;
61 }
64 NewFreq += Freq;
65 return NewFreq;
66 }
67
68
70
71 if (Frequency <= Freq.Frequency)
72 Frequency = 0;
73 else
74 Frequency -= Freq.Frequency;
75 return *this;
76 }
79 NewFreq -= Freq;
80 return NewFreq;
81 }
82
83
85
86
88
89 assert(Frequency != 0);
90
91
92 Frequency >>= count;
93
94
95 Frequency |= Frequency == 0;
96 return *this;
97 }
98
100 return Frequency < RHS.Frequency;
101 }
102
104 return Frequency <= RHS.Frequency;
105 }
106
108 return Frequency > RHS.Frequency;
109 }
110
112 return Frequency >= RHS.Frequency;
113 }
114
116 return Frequency == RHS.Frequency;
117 }
118
120 return Frequency != RHS.Frequency;
121 }
122};
123
125 BlockFrequency Freq);
126
127}
128
129#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Definition BlockFrequency.h:27
bool operator!=(BlockFrequency RHS) const
Definition BlockFrequency.h:119
BlockFrequency operator+(BlockFrequency Freq) const
Definition BlockFrequency.h:62
LLVM_ABI BlockFrequency operator/(BranchProbability Prob) const
bool operator>=(BlockFrequency RHS) const
Definition BlockFrequency.h:111
BlockFrequency(uint64_t Freq)
Definition BlockFrequency.h:32
static BlockFrequency max()
Returns the maximum possible frequency, the saturation value.
Definition BlockFrequency.h:35
BlockFrequency & operator-=(BlockFrequency Freq)
Subtracts another block frequency using saturating arithmetic.
Definition BlockFrequency.h:69
LLVM_ABI std::optional< BlockFrequency > mul(uint64_t Factor) const
Multiplies frequency with Factor. Returns nullopt in case of overflow.
uint64_t getFrequency() const
Returns the frequency as a fixpoint number scaled by the entry frequency.
Definition BlockFrequency.h:39
bool operator<(BlockFrequency RHS) const
Definition BlockFrequency.h:99
bool operator==(BlockFrequency RHS) const
Definition BlockFrequency.h:115
BlockFrequency & operator+=(BlockFrequency Freq)
Adds another block frequency using saturating arithmetic.
Definition BlockFrequency.h:52
LLVM_ABI BlockFrequency operator*(BranchProbability Prob) const
bool operator>(BlockFrequency RHS) const
Definition BlockFrequency.h:107
bool operator<=(BlockFrequency RHS) const
Definition BlockFrequency.h:103
BlockFrequency & operator>>=(const unsigned count)
Shift block frequency to the right by count digits saturating to 1.
Definition BlockFrequency.h:87
BlockFrequency()
Definition BlockFrequency.h:31
LLVM_ABI BlockFrequency & operator*=(BranchProbability Prob)
Multiplies with a branch probability.
BlockFrequency operator-(BlockFrequency Freq) const
Definition BlockFrequency.h:77
LLVM_ABI BlockFrequency & operator/=(BranchProbability Prob)
Divide by a non-zero branch probability using saturating arithmetic.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
LLVM_ABI void printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq, BlockFrequency Freq)