|
LLVM 24.0.0git
|
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) |
| LLVM_ABI void | normalize () |
| Normalize the distribution. | |
Public Attributes | |
| WeightList | Weights |
| Individual successor weights. | |
| uint64_t | Total = 0 |
| Sum of all weights. | |
| bool | DidOverflow = false |
| Whether Total did overflow. | |
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 360 of file BlockFrequencyInfoImpl.h.
Definition at line 361 of file BlockFrequencyInfoImpl.h.
|
default |
|
inline |
Definition at line 377 of file BlockFrequencyInfoImpl.h.
References llvm::BlockFrequencyInfoImplBase::Weight::Backedge, and uint64_t.
Referenced by llvm::BlockFrequencyInfoImplBase::addToDist().
|
inline |
Definition at line 373 of file BlockFrequencyInfoImpl.h.
References llvm::BlockFrequencyInfoImplBase::Weight::Exit, and uint64_t.
Referenced by llvm::BlockFrequencyInfoImplBase::addToDist().
|
inline |
Definition at line 369 of file BlockFrequencyInfoImpl.h.
References llvm::BlockFrequencyInfoImplBase::Weight::Local, and uint64_t.
Referenced by llvm::BlockFrequencyInfoImplBase::addToDist().
| 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 236 of file BlockFrequencyInfoImpl.cpp.
References assert(), combineWeights(), llvm::countl_zero(), DidOverflow, normalize(), shiftRightAndRound(), Total, and Weights.
Referenced by normalize().
| bool llvm::BlockFrequencyInfoImplBase::Distribution::DidOverflow = false |
Whether Total did overflow.
Definition at line 365 of file BlockFrequencyInfoImpl.h.
Referenced by normalize().
| uint64_t llvm::BlockFrequencyInfoImplBase::Distribution::Total = 0 |
Sum of all weights.
Definition at line 364 of file BlockFrequencyInfoImpl.h.
Referenced by normalize().
| WeightList llvm::BlockFrequencyInfoImplBase::Distribution::Weights |
Individual successor weights.
Definition at line 363 of file BlockFrequencyInfoImpl.h.
Referenced by llvm::BlockFrequencyInfoImplBase::distributeMass(), and normalize().