Branch probability as a non‐negative fraction no greater than one.

Synopsis

Declared in <llvm/Support/BranchProbability.h>

class BranchProbability;

Description

Uses a fixed‐point‐like representation whose denominator is always the constant value 1<<31 for maximum precision.

Member Functions

Name

Description

BranchProbability [constructor]

Constructors

dump

Dump this probability to the debug stream.

getCompl

Return the complementary probability (1 minus this probability).

getNumerator

Return the fixed‐point numerator of this probability.

isOne

Return true if this probability is one (always taken).

isUnknown

Return true if this probability is unknown.

isZero

Return true if this probability is zero (never taken).

operator*

Multiplication operators

operator*=

Multiplication assignment operators

operator+

Add two branch probabilities, saturating at one.

operator+=

Add RHS to this probability, saturating at one.

operator‐

Subtract RHS from this probability, saturating at zero.

operator‐=

Subtract RHS from this probability, saturating at zero.

operator/

Division operators

operator/=

Division assignment operators

pow

Compute pow(Probability, N).

print

Print this probability to OS.

scale

Scale a large integer.

scaleByInverse

Scale a large integer by the inverse.

toDouble

Return this probability as a floating‐point value in [0, 1].

operator==

Return true if this probability equals RHS.

operator!=

Return true if this probability differs from RHS.

operator<

Return true if this probability is strictly less than RHS.

operator<=

Return true if this probability is less than or equal to RHS.

operator>

Return true if this probability is greater than RHS.

operator>=

Return true if this probability is greater than or equal to RHS.

Static Member Functions

Name

Description

getBranchProbability

getBranchProbability overloads

getDenominator

Return the fixed denominator used by all branch probabilities (1 << 31).

getOne

Return a probability representing one (always taken).

getRaw

Create a probability from the raw fixed‐point numerator N.

getUnknown

Return an unknown branch probability.

getZero

Return a probability representing zero (never taken).

normalizeProbabilities

normalizeProbabilities overloads

Non-Member Functions

Name

Description

getBranchProbability

Return the probability that conditional branch B takes one successor.

getBranchProbability

Return the edge probability from Src to successor Dst.

getLoopProbability

Return the probability that the latch of L continues the loop.

getWeightFromBranchProb

Convert a branch probability into an unscaled edge weight.

bfi_detail::operator*

Scale mass R by branch probability L.

Created with MrDocs