Go to the documentation of this file.
13 #ifndef LLVM_SUPPORT_BRANCHPROBABILITY_H
14 #define LLVM_SUPPORT_BRANCHPROBABILITY_H
35 static constexpr
uint32_t D = 1u << 31;
36 static constexpr
uint32_t UnknownN = UINT32_MAX;
61 template <
class ProbabilityIter>
93 "Unknown probability cannot participate in arithmetics.");
101 "Unknown probability cannot participate in arithmetics.");
109 "Unknown probability cannot participate in arithmetics.");
116 "Unknown probability cannot participate in arithmetics.");
123 "Unknown probability cannot participate in arithmetics.");
130 "Unknown probability cannot participate in arithmetics.");
131 assert(
RHS > 0 &&
"The divider cannot be zero.");
177 "Unknown probability cannot participate in comparisons.");
183 "Unknown probability cannot participate in comparisons.");
189 "Unknown probability cannot participate in comparisons.");
190 return !(
RHS < *
this);
195 "Unknown probability cannot participate in comparisons.");
196 return !(*
this <
RHS);
201 return Prob.
print(OS);
204 template <
class ProbabilityIter>
206 ProbabilityIter End) {
210 unsigned UnknownProbCount = 0;
219 if (UnknownProbCount > 0) {
228 std::replace_if(Begin, End,
238 std::fill(Begin, End, BP);
242 for (
auto I = Begin;
I != End; ++
I)
uint64_t scaleByInverse(uint64_t Num) const
Scale a large integer by the inverse.
This is an optimization pass for GlobalISel generic memory operations.
uint32_t getNumerator() const
bool operator>(BranchProbability RHS) const
static BranchProbability getZero()
BranchProbability operator-(BranchProbability RHS) const
static BranchProbability getBranchProbability(uint64_t Numerator, uint64_t Denominator)
bool operator<(BranchProbability RHS) const
raw_ostream & print(raw_ostream &OS) const
uint64_t scale(uint64_t Num) const
Scale a large integer.
BranchProbability & operator*=(BranchProbability RHS)
static uint32_t getDenominator()
BranchProbability & operator*=(uint32_t RHS)
This class implements an extremely fast bulk output stream that can only output to a stream.
bool operator==(BranchProbability RHS) const
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
BranchProbability & operator+=(BranchProbability RHS)
bool operator!=(BranchProbability RHS) const
static BranchProbability getUnknown()
bool operator>=(BranchProbability RHS) const
BranchProbability & operator/=(uint32_t RHS)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
BranchProbability operator*(uint32_t RHS) const
BranchProbability operator/(BranchProbability RHS) const
static BranchProbability getOne()
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
BranchProbability operator/(uint32_t RHS) const
BranchProbability getCompl() const
static BranchProbability getRaw(uint32_t N)
static void normalizeProbabilities(ProbabilityIter Begin, ProbabilityIter End)
The same transformation can work with an even modulo with the addition of a and shrink the compare RHS by the same amount Unless the target supports that transformation probably isn t worthwhile The transformation can also easily be made to work with non zero equality for n
BranchProbability operator+(BranchProbability RHS) const
BranchProbability & operator/=(BranchProbability RHS)
BranchProbability & operator-=(BranchProbability RHS)
BranchProbability operator*(BranchProbability RHS) const
bool operator<=(BranchProbability RHS) const