LLVM  9.0.0svn
Public Types | Public Member Functions | Public Attributes | List of all members
llvm::BlockFrequencyInfoImplBase::Distribution Struct Reference

Distribution of unscaled probability weight. More...

#include "llvm/Analysis/BlockFrequencyInfoImpl.h"

Collaboration diagram for llvm::BlockFrequencyInfoImplBase::Distribution:
Collaboration graph

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...

Detailed Description

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 375 of file BlockFrequencyInfoImpl.h.

Member Typedef Documentation

◆ WeightList

Definition at line 376 of file BlockFrequencyInfoImpl.h.

Constructor & Destructor Documentation

◆ Distribution()

llvm::BlockFrequencyInfoImplBase::Distribution::Distribution ( )

Member Function Documentation

◆ addBackedge()

void llvm::BlockFrequencyInfoImplBase::Distribution::addBackedge ( const BlockNode Node,
uint64_t  Amount 

Definition at line 392 of file BlockFrequencyInfoImpl.h.

References llvm::ARM_AM::add.

◆ addExit()

void llvm::BlockFrequencyInfoImplBase::Distribution::addExit ( const BlockNode Node,
uint64_t  Amount 

Definition at line 388 of file BlockFrequencyInfoImpl.h.

References llvm::ARM_AM::add.

◆ addLocal()

void llvm::BlockFrequencyInfoImplBase::Distribution::addLocal ( const BlockNode Node,
uint64_t  Amount 

◆ normalize()

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 214 of file BlockFrequencyInfoImpl.cpp.

References assert(), combineWeights(), llvm::countLeadingZeros(), llvm::max(), shiftRightAndRound(), and llvm::RISCVFenceField::W.

Member Data Documentation

◆ DidOverflow

bool llvm::BlockFrequencyInfoImplBase::Distribution::DidOverflow = false

Whether Total did overflow.

Definition at line 380 of file BlockFrequencyInfoImpl.h.

◆ Total

uint64_t llvm::BlockFrequencyInfoImplBase::Distribution::Total = 0

Sum of all weights.

Definition at line 379 of file BlockFrequencyInfoImpl.h.

◆ Weights

WeightList llvm::BlockFrequencyInfoImplBase::Distribution::Weights

The documentation for this struct was generated from the following files: