LLVM 20.0.0git
Public Types | Public Member Functions | Public Attributes | List of all members
llvm::SpillPlacement::Node Struct Reference

Node - Each edge bundle corresponds to a Hopfield node. More...

Public Types

using LinkVector = SmallVector< std::pair< BlockFrequency, unsigned >, 4 >
 

Public Member Functions

bool preferReg () const
 preferReg - Return true when this node prefers to be in a register.
 
bool mustSpill () const
 mustSpill - Return True if this node is so biased that it must spill.
 
void clear (BlockFrequency Threshold)
 clear - Reset per-query data, but preserve frequencies that only depend on the CFG.
 
void addLink (unsigned b, BlockFrequency w)
 addLink - Add a link to bundle b with weight w.
 
void addBias (BlockFrequency freq, BorderConstraint direction)
 addBias - Bias this node.
 
bool update (const Node nodes[], BlockFrequency Threshold)
 update - Recompute Value from Bias and Links.
 
void getDissentingNeighbors (SparseSet< unsigned > &List, const Node nodes[]) const
 

Public Attributes

BlockFrequency BiasN
 BiasN - Sum of blocks that prefer a spill.
 
BlockFrequency BiasP
 BiasP - Sum of blocks that prefer a register.
 
int Value
 Value - Output value of this node computed from the Bias and links.
 
LinkVector Links
 Links - (Weight, BundleNo) for all transparent blocks connecting to other bundles.
 
BlockFrequency SumLinkWeights
 SumLinkWeights - Cached sum of the weights of all links + ThresHold.
 

Detailed Description

Node - Each edge bundle corresponds to a Hopfield node.

The node contains precomputed frequency data that only depends on the CFG, but Bias and Links are computed each time placeSpills is called.

The node Value is positive when the variable should be in a register. The value can change when linked nodes change, but convergence is very fast because all weights are positive.

Definition at line 72 of file SpillPlacement.cpp.

Member Typedef Documentation

◆ LinkVector

Definition at line 84 of file SpillPlacement.cpp.

Member Function Documentation

◆ addBias()

void llvm::SpillPlacement::Node::addBias ( BlockFrequency  freq,
BorderConstraint  direction 
)
inline

◆ addLink()

void llvm::SpillPlacement::Node::addLink ( unsigned  b,
BlockFrequency  w 
)
inline

◆ clear()

void llvm::SpillPlacement::Node::clear ( BlockFrequency  Threshold)
inline

clear - Reset per-query data, but preserve frequencies that only depend on the CFG.

Definition at line 109 of file SpillPlacement.cpp.

References llvm::SpillPlacement::Node::BiasN, llvm::SpillPlacement::Node::BiasP, llvm::SmallVectorImpl< T >::clear(), llvm::SpillPlacement::Node::Links, and llvm::SpillPlacement::Node::SumLinkWeights.

◆ getDissentingNeighbors()

void llvm::SpillPlacement::Node::getDissentingNeighbors ( SparseSet< unsigned > &  List,
const Node  nodes[] 
) const
inline

Definition at line 180 of file SpillPlacement.cpp.

References llvm::SpillPlacement::Node::Links, llvm::List, and nodes.

◆ mustSpill()

bool llvm::SpillPlacement::Node::mustSpill ( ) const
inline

mustSpill - Return True if this node is so biased that it must spill.

Definition at line 100 of file SpillPlacement.cpp.

References llvm::SpillPlacement::Node::BiasN, llvm::SpillPlacement::Node::BiasP, and llvm::SpillPlacement::Node::SumLinkWeights.

◆ preferReg()

bool llvm::SpillPlacement::Node::preferReg ( ) const
inline

preferReg - Return true when this node prefers to be in a register.

Definition at line 94 of file SpillPlacement.cpp.

Referenced by llvm::SpillPlacement::Node::update().

◆ update()

bool llvm::SpillPlacement::Node::update ( const Node  nodes[],
BlockFrequency  Threshold 
)
inline

update - Recompute Value from Bias and Links.

Return true when node preference changes.

Definition at line 151 of file SpillPlacement.cpp.

References Before, llvm::SpillPlacement::Node::BiasN, llvm::SpillPlacement::Node::BiasP, llvm::SpillPlacement::Node::Links, nodes, and llvm::SpillPlacement::Node::preferReg().

Member Data Documentation

◆ BiasN

BlockFrequency llvm::SpillPlacement::Node::BiasN

◆ BiasP

BlockFrequency llvm::SpillPlacement::Node::BiasP

◆ Links

LinkVector llvm::SpillPlacement::Node::Links

Links - (Weight, BundleNo) for all transparent blocks connecting to other bundles.

The weights are all positive block frequencies.

Definition at line 88 of file SpillPlacement.cpp.

Referenced by llvm::SpillPlacement::Node::addLink(), llvm::SpillPlacement::Node::clear(), llvm::SpillPlacement::Node::getDissentingNeighbors(), and llvm::SpillPlacement::Node::update().

◆ SumLinkWeights

BlockFrequency llvm::SpillPlacement::Node::SumLinkWeights

SumLinkWeights - Cached sum of the weights of all links + ThresHold.

Definition at line 91 of file SpillPlacement.cpp.

Referenced by llvm::SpillPlacement::Node::addLink(), llvm::SpillPlacement::Node::clear(), and llvm::SpillPlacement::Node::mustSpill().

◆ Value

int llvm::SpillPlacement::Node::Value

Value - Output value of this node computed from the Bias and links.

This is always on of the values {-1, 0, 1}. A positive number means the variable should go in a register through this bundle.

Definition at line 82 of file SpillPlacement.cpp.


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