LLVM
8.0.1
|
Distribution of unscaled probability weight. More...
#include "llvm/Analysis/BlockFrequencyInfoImpl.h"
Public Types | |
using | WeightList = SmallVector< Weight, 4 > |
Public Member Functions | |
Distribution ()=default | |
void | addLocal (const BlockNode &Node, uint64_t Amount) |
void | addExit (const BlockNode &Node, uint64_t Amount) |
void | addBackedge (const BlockNode &Node, uint64_t Amount) |
void | normalize () |
Normalize the distribution. More... | |
Public Attributes | |
WeightList | Weights |
Individual successor weights. More... | |
uint64_t | Total = 0 |
Sum of all weights. More... | |
bool | DidOverflow = false |
Whether Total did overflow. More... | |
Distribution of unscaled probability weight.
Distribution of unscaled probability weight to a set of successors.
This class collates the successor edge weights for later processing.
DidOverflow indicates whether Total did overflow while adding to the distribution. It should never overflow twice.
Definition at line 380 of file BlockFrequencyInfoImpl.h.
Definition at line 381 of file BlockFrequencyInfoImpl.h.
|
default |
|
inline |
Definition at line 397 of file BlockFrequencyInfoImpl.h.
|
inline |
Definition at line 393 of file BlockFrequencyInfoImpl.h.
|
inline |
Definition at line 389 of file BlockFrequencyInfoImpl.h.
Referenced by llvm::BlockFrequencyInfoImplBase::adjustLoopHeaderMass().
void Distribution::normalize | ( | ) |
Normalize the distribution.
Combines multiple edges to the same Weight::TargetNode and scales down so that Total fits into 32-bits.
This is linear in the size of Weights. For the vast majority of cases, adjacent edge weights are combined by sorting WeightList and combining adjacent weights. However, for very large edge lists an auxiliary hash table is used.
Definition at line 215 of file BlockFrequencyInfoImpl.cpp.
References assert(), combineWeights(), llvm::countLeadingZeros(), llvm::max(), shiftRightAndRound(), and llvm::RISCVFenceField::W.
Whether Total did overflow.
Definition at line 385 of file BlockFrequencyInfoImpl.h.
uint64_t llvm::BlockFrequencyInfoImplBase::Distribution::Total = 0 |
Sum of all weights.
Definition at line 384 of file BlockFrequencyInfoImpl.h.
WeightList llvm::BlockFrequencyInfoImplBase::Distribution::Weights |
Individual successor weights.
Definition at line 383 of file BlockFrequencyInfoImpl.h.
Referenced by llvm::BlockFrequencyInfoImplBase::adjustLoopHeaderMass(), llvm::BlockFrequencyInfoImplBase::distributeIrrLoopHeaderMass(), and llvm::BlockFrequencyInfoImplBase::distributeMass().