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);
204template <
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)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static BranchProbability getBranchProbability(uint64_t Numerator, uint64_t Denominator)
BranchProbability operator-(BranchProbability RHS) const
BranchProbability & operator-=(BranchProbability RHS)
static uint32_t getDenominator()
bool operator<(BranchProbability RHS) const
bool operator!=(BranchProbability RHS) const
static BranchProbability getRaw(uint32_t N)
bool operator==(BranchProbability RHS) const
BranchProbability operator/(uint32_t RHS) const
BranchProbability & operator/=(BranchProbability RHS)
bool operator<=(BranchProbability RHS) const
static BranchProbability getOne()
raw_ostream & print(raw_ostream &OS) const
BranchProbability & operator*=(BranchProbability RHS)
uint64_t scaleByInverse(uint64_t Num) const
Scale a large integer by the inverse.
BranchProbability operator*(BranchProbability RHS) const
static BranchProbability getUnknown()
BranchProbability operator/(BranchProbability RHS) const
uint32_t getNumerator() const
uint64_t scale(uint64_t Num) const
Scale a large integer.
BranchProbability operator+(BranchProbability RHS) const
bool operator>=(BranchProbability RHS) const
BranchProbability operator*(uint32_t RHS) const
BranchProbability & operator*=(uint32_t RHS)
BranchProbability getCompl() const
BranchProbability & operator+=(BranchProbability RHS)
BranchProbability & operator/=(uint32_t RHS)
static BranchProbability getZero()
bool operator>(BranchProbability RHS) const
static void normalizeProbabilities(ProbabilityIter Begin, ProbabilityIter End)
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.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)