LLVM 20.0.0git
|
#include "llvm/CodeGen/SpillPlacement.h"
Classes | |
struct | BlockConstraint |
BlockConstraint - Entry and exit constraints for a basic block. More... | |
struct | Node |
Node - Each edge bundle corresponds to a Hopfield node. More... | |
Public Types | |
enum | BorderConstraint { DontCare , PrefReg , PrefSpill , PrefBoth , MustSpill } |
BorderConstraint - A basic block has separate constraints for entry and exit. More... | |
Public Member Functions | |
void | prepare (BitVector &RegBundles) |
prepare - Reset state and prepare for a new spill placement computation. | |
void | addConstraints (ArrayRef< BlockConstraint > LiveBlocks) |
addConstraints - Add constraints and biases. | |
void | addPrefSpill (ArrayRef< unsigned > Blocks, bool Strong) |
addPrefSpill - Add PrefSpill constraints to all blocks listed. | |
void | addLinks (ArrayRef< unsigned > Links) |
addLinks - Add transparent blocks with the given numbers. | |
bool | scanActiveBundles () |
scanActiveBundles - Perform an initial scan of all bundles activated by addConstraints and addLinks, updating their state. | |
void | iterate () |
iterate - Update the network iteratively until convergence, or new bundles are found. | |
ArrayRef< unsigned > | getRecentPositive () |
getRecentPositive - Return an array of bundles that became positive during the previous call to scanActiveBundles or iterate. | |
bool | finish () |
finish - Compute the optimal spill code placement given the constraints. | |
BlockFrequency | getBlockFrequency (unsigned Number) const |
getBlockFrequency - Return the estimated block execution frequency per function invocation. | |
bool | invalidate (MachineFunction &MF, const PreservedAnalyses &PA, MachineFunctionAnalysisManager::Invalidator &Inv) |
SpillPlacement (SpillPlacement &&) | |
~SpillPlacement () | |
Friends | |
class | SpillPlacementWrapperLegacy |
class | SpillPlacementAnalysis |
Definition at line 45 of file SpillPlacement.h.
BorderConstraint - A basic block has separate constraints for entry and exit.
Definition at line 81 of file SpillPlacement.h.
|
default |
|
default |
void SpillPlacement::addConstraints | ( | ArrayRef< BlockConstraint > | LiveBlocks | ) |
addConstraints - Add constraints and biases.
addConstraints - Compute node biases and weights from a set of constraints.
This method may be called more than once to accumulate constraints.
LiveBlocks | Constraints for blocks that have the variable live in or live out. |
Set a bit in NodeMask for each active node.
Definition at line 292 of file SpillPlacement.cpp.
References DontCare, and llvm::EdgeBundles::getBundle().
addLinks - Add transparent blocks with the given numbers.
Definition at line 327 of file SpillPlacement.cpp.
References llvm::EdgeBundles::getBundle(), and llvm::Number.
addPrefSpill - Add PrefSpill constraints to all blocks listed.
addPrefSpill - Same as addConstraints(PrefSpill)
This is equivalent to calling addConstraint with identical BlockConstraints with Entry = Exit = PrefSpill, and ChangesValue = false.
Blocks | Array of block numbers that prefer to spill in and out. |
Strong | When true, double the negative bias for these blocks. |
Definition at line 313 of file SpillPlacement.cpp.
References B, Blocks, llvm::EdgeBundles::getBundle(), and PrefSpill.
bool SpillPlacement::finish | ( | ) |
finish - Compute the optimal spill code placement given the constraints.
No MustSpill constraints will be violated, and the smallest possible number of PrefX constraints will be violated, weighted by expected execution frequencies. The selected bundles are returned in the bitvector passed to prepare().
Definition at line 395 of file SpillPlacement.cpp.
References assert(), llvm::BitVector::reset(), and llvm::BitVector::set_bits().
|
inline |
getBlockFrequency - Return the estimated block execution frequency per function invocation.
Definition at line 156 of file SpillPlacement.h.
References llvm::Number.
getRecentPositive - Return an array of bundles that became positive during the previous call to scanActiveBundles or iterate.
Definition at line 143 of file SpillPlacement.h.
bool SpillPlacementAnalysis::Result::invalidate | ( | MachineFunction & | MF, |
const PreservedAnalyses & | PA, | ||
MachineFunctionAnalysisManager::Invalidator & | Inv | ||
) |
Definition at line 212 of file SpillPlacement.cpp.
References llvm::PreservedAnalyses::getChecker(), and llvm::AnalysisManager< IRUnitT, ExtraArgTs >::Invalidator::invalidate().
void SpillPlacement::iterate | ( | ) |
iterate - Update the network iteratively until convergence, or new bundles are found.
iterate - Repeatedly update the Hopfield nodes until stability or the maximum number of iterations is reached.
Definition at line 366 of file SpillPlacement.cpp.
References llvm::SmallVectorImpl< T >::clear(), llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::empty(), llvm::EdgeBundles::getNumBundles(), llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::pop_back_val(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
void SpillPlacement::prepare | ( | BitVector & | RegBundles | ) |
prepare - Reset state and prepare for a new spill placement computation.
RegBundles | Bit vector to receive the edge bundles where the variable should be kept in a register. Each bit corresponds to an edge bundle, a set bit means the variable should be kept in a register through the bundle. A clear bit means the variable should be spilled. This vector is retained. |
Definition at line 385 of file SpillPlacement.cpp.
References llvm::BitVector::clear(), llvm::SmallVectorImpl< T >::clear(), llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::clear(), llvm::EdgeBundles::getNumBundles(), and llvm::BitVector::resize().
bool SpillPlacement::scanActiveBundles | ( | ) |
scanActiveBundles - Perform an initial scan of all bundles activated by addConstraints and addLinks, updating their state.
Add all the bundles that now prefer a register to RecentPositive. Prepare internal data structures for iterate. Return true is there are any positive nodes.
Definition at line 343 of file SpillPlacement.cpp.
References llvm::SmallVectorImpl< T >::clear(), llvm::SmallVectorBase< Size_T >::empty(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::BitVector::set_bits().
|
friend |
Definition at line 47 of file SpillPlacement.h.
|
friend |
Definition at line 46 of file SpillPlacement.h.