LLVM API Documentation
Mass of a block. More...
#include <BlockFrequencyInfoImpl.h>
Public Member Functions | |
BlockMass () | |
BlockMass (uint64_t Mass) | |
uint64_t | getMass () const |
bool | isFull () const |
bool | isEmpty () const |
bool | operator! () const |
BlockMass & | operator+= (const BlockMass &X) |
Add another mass. | |
BlockMass & | operator-= (const BlockMass &X) |
Subtract another mass. | |
BlockMass & | operator*= (const BranchProbability &P) |
bool | operator== (const BlockMass &X) const |
bool | operator!= (const BlockMass &X) const |
bool | operator<= (const BlockMass &X) const |
bool | operator>= (const BlockMass &X) const |
bool | operator< (const BlockMass &X) const |
bool | operator> (const BlockMass &X) const |
ScaledNumber< uint64_t > | toScaled () const |
Convert to scaled number. | |
void | dump () const |
raw_ostream & | print (raw_ostream &OS) const |
Static Public Member Functions | |
static BlockMass | getEmpty () |
static BlockMass | getFull () |
Mass of a block.
This class implements a sort of fixed-point fraction always between 0.0 and 1.0. getMass() == UINT64_MAX indicates a value of 1.0.
Masses can be added and subtracted. Simple saturation arithmetic is used, so arithmetic operations never overflow or underflow.
Masses can be multiplied. Multiplication treats full mass as 1.0 and uses an inexpensive floating-point algorithm that's off-by-one (almost, but not quite, maximum precision).
Masses can be scaled by BranchProbability at maximum precision.
Definition at line 67 of file BlockFrequencyInfoImpl.h.
llvm::bfi_detail::BlockMass::BlockMass | ( | ) | [inline] |
Definition at line 71 of file BlockFrequencyInfoImpl.h.
Referenced by getEmpty(), and getFull().
llvm::bfi_detail::BlockMass::BlockMass | ( | uint64_t | Mass | ) | [inline, explicit] |
Definition at line 72 of file BlockFrequencyInfoImpl.h.
void BlockMass::dump | ( | ) | const |
Definition at line 30 of file BlockFrequencyInfoImpl.cpp.
References llvm::dbgs().
static BlockMass llvm::bfi_detail::BlockMass::getEmpty | ( | ) | [inline, static] |
Definition at line 74 of file BlockFrequencyInfoImpl.h.
References BlockMass().
Referenced by llvm::bfi_detail::IrreducibleGraph::addNode().
static BlockMass llvm::bfi_detail::BlockMass::getFull | ( | ) | [inline, static] |
Definition at line 75 of file BlockFrequencyInfoImpl.h.
References BlockMass(), and UINT64_MAX.
uint64_t llvm::bfi_detail::BlockMass::getMass | ( | ) | const [inline] |
Definition at line 77 of file BlockFrequencyInfoImpl.h.
Referenced by llvm::BlockFrequencyInfoImplBase::distributeMass().
bool llvm::bfi_detail::BlockMass::isEmpty | ( | ) | const [inline] |
Definition at line 80 of file BlockFrequencyInfoImpl.h.
Referenced by operator!().
bool llvm::bfi_detail::BlockMass::isFull | ( | ) | const [inline] |
Definition at line 79 of file BlockFrequencyInfoImpl.h.
References UINT64_MAX.
bool llvm::bfi_detail::BlockMass::operator! | ( | ) | const [inline] |
Definition at line 82 of file BlockFrequencyInfoImpl.h.
References isEmpty().
bool llvm::bfi_detail::BlockMass::operator!= | ( | const BlockMass & | X | ) | const [inline] |
Definition at line 109 of file BlockFrequencyInfoImpl.h.
BlockMass& llvm::bfi_detail::BlockMass::operator*= | ( | const BranchProbability & | P | ) | [inline] |
Definition at line 103 of file BlockFrequencyInfoImpl.h.
References llvm::BranchProbability::scale().
Add another mass.
Adds another mass, saturating at isFull() rather than overflowing.
Definition at line 87 of file BlockFrequencyInfoImpl.h.
References UINT64_MAX.
Subtract another mass.
Subtracts another mass, saturating at isEmpty() rather than undeflowing.
Definition at line 97 of file BlockFrequencyInfoImpl.h.
Definition at line 112 of file BlockFrequencyInfoImpl.h.
Definition at line 110 of file BlockFrequencyInfoImpl.h.
Definition at line 108 of file BlockFrequencyInfoImpl.h.
Definition at line 113 of file BlockFrequencyInfoImpl.h.
Definition at line 111 of file BlockFrequencyInfoImpl.h.
raw_ostream & BlockMass::print | ( | raw_ostream & | OS | ) | const |
Definition at line 38 of file BlockFrequencyInfoImpl.cpp.
References getHexDigit().
Referenced by llvm::bfi_detail::operator<<().
ScaledNumber< uint64_t > BlockMass::toScaled | ( | ) | const |
Convert to scaled number.
Convert to ScaledNumber. isFull() gives 1.0, while isEmpty() gives slightly above 0.0.
Definition at line 24 of file BlockFrequencyInfoImpl.cpp.
Referenced by llvm::BlockFrequencyInfoImplBase::computeLoopScale(), and llvm::BlockFrequencyInfoImplBase::unwrapLoops().