LLVM
8.0.1
|
#include "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 | |
SpillPlacement () | |
~SpillPlacement () override | |
void | prepare (BitVector &RegBundles) |
prepare - Reset state and prepare for a new spill placement computation. More... | |
void | addConstraints (ArrayRef< BlockConstraint > LiveBlocks) |
addConstraints - Add constraints and biases. More... | |
void | addPrefSpill (ArrayRef< unsigned > Blocks, bool Strong) |
addPrefSpill - Add PrefSpill constraints to all blocks listed. More... | |
void | addLinks (ArrayRef< unsigned > Links) |
addLinks - Add transparent blocks with the given numbers. More... | |
bool | scanActiveBundles () |
scanActiveBundles - Perform an initial scan of all bundles activated by addConstraints and addLinks, updating their state. More... | |
void | iterate () |
iterate - Update the network iteratively until convergence, or new bundles are found. More... | |
ArrayRef< unsigned > | getRecentPositive () |
getRecentPositive - Return an array of bundles that became positive during the previous call to scanActiveBundles or iterate. More... | |
bool | finish () |
finish - Compute the optimal spill code placement given the constraints. More... | |
BlockFrequency | getBlockFrequency (unsigned Number) const |
getBlockFrequency - Return the estimated block execution frequency per function invocation. More... | |
Public Member Functions inherited from llvm::MachineFunctionPass | |
bool | doInitialization (Module &) override |
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before any pass is run. More... | |
Public Member Functions inherited from llvm::FunctionPass | |
FunctionPass (char &pid) | |
Pass * | createPrinterPass (raw_ostream &OS, const std::string &Banner) const override |
createPrinterPass - Get a function printer pass. More... | |
void | assignPassManager (PMStack &PMS, PassManagerType T) override |
Find appropriate Function Pass Manager or Call Graph Pass Manager in the PM Stack and add self into that manager. More... | |
PassManagerType | getPotentialPassManagerType () const override |
Return what kind of Pass Manager can manage this pass. More... | |
Public Member Functions inherited from llvm::Pass | |
Pass (PassKind K, char &pid) | |
Pass (const Pass &)=delete | |
Pass & | operator= (const Pass &)=delete |
virtual | ~Pass () |
PassKind | getPassKind () const |
virtual StringRef | getPassName () const |
getPassName - Return a nice clean name for a pass. More... | |
AnalysisID | getPassID () const |
getPassID - Return the PassID number that corresponds to this pass. More... | |
virtual bool | doFinalization (Module &) |
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes have run. More... | |
virtual void | print (raw_ostream &OS, const Module *M) const |
print - Print out the internal state of the pass. More... | |
void | dump () const |
virtual void | preparePassManager (PMStack &) |
Check if available pass managers are suitable for this pass or not. More... | |
void | setResolver (AnalysisResolver *AR) |
AnalysisResolver * | getResolver () const |
virtual void * | getAdjustedAnalysisPointer (AnalysisID ID) |
getAdjustedAnalysisPointer - This method is used when a pass implements an analysis interface through multiple inheritance. More... | |
virtual ImmutablePass * | getAsImmutablePass () |
virtual PMDataManager * | getAsPMDataManager () |
virtual void | verifyAnalysis () const |
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis information. More... | |
virtual void | dumpPassStructure (unsigned Offset=0) |
template<typename AnalysisType > | |
AnalysisType * | getAnalysisIfAvailable () const |
getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to get analysis information that might be around, for example to update it. More... | |
bool | mustPreserveAnalysisID (char &AID) const |
mustPreserveAnalysisID - This method serves the same function as getAnalysisIfAvailable, but works if you just have an AnalysisID. More... | |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis () const |
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information that they claim to use by overriding the getAnalysisUsage function. More... | |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis (Function &F) |
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information that they claim to use by overriding the getAnalysisUsage function. More... | |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI) const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI, Function &F) |
Static Public Attributes | |
static char | ID = 0 |
Additional Inherited Members | |
Static Public Member Functions inherited from llvm::Pass | |
static const PassInfo * | lookupPassInfo (const void *TI) |
static const PassInfo * | lookupPassInfo (StringRef Arg) |
static Pass * | createPass (AnalysisID ID) |
Protected Member Functions inherited from llvm::MachineFunctionPass | |
MachineFunctionPass (char &ID) | |
virtual MachineFunctionProperties | getRequiredProperties () const |
virtual MachineFunctionProperties | getSetProperties () const |
virtual MachineFunctionProperties | getClearedProperties () const |
Protected Member Functions inherited from llvm::FunctionPass | |
bool | skipFunction (const Function &F) const |
Optional passes call this function to check whether the pass should be skipped. More... | |
Definition at line 44 of file SpillPlacement.h.
BorderConstraint - A basic block has separate constraints for entry and exit.
Definition at line 81 of file SpillPlacement.h.
|
inline |
Definition at line 76 of file SpillPlacement.h.
|
inlineoverride |
Definition at line 77 of file SpillPlacement.h.
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 264 of file SpillPlacement.cpp.
References llvm::ArrayRef< T >::begin(), DontCare, E, llvm::ArrayRef< T >::end(), I, llvm::ARM_AM::ib, and nodes.
addLinks - Add transparent blocks with the given numbers.
Definition at line 301 of file SpillPlacement.cpp.
References llvm::ArrayRef< T >::begin(), E, llvm::ArrayRef< T >::end(), I, llvm::ARM_AM::ib, nodes, 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 286 of file SpillPlacement.cpp.
References llvm::ArrayRef< T >::begin(), E, llvm::ArrayRef< T >::end(), I, llvm::ARM_AM::ib, nodes, 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 371 of file SpillPlacement.cpp.
References assert(), nodes, and llvm::SpillPlacement::Node::preferReg().
Referenced by getRecentPositive().
|
inline |
getBlockFrequency - Return the estimated block execution frequency per function invocation.
Definition at line 153 of file SpillPlacement.h.
References llvm::SpillPlacement::BlockConstraint::Entry, and llvm::SpillPlacement::BlockConstraint::Number.
Referenced by getNumAllocatableRegsForConstraints().
getRecentPositive - Return an array of bundles that became positive during the previous call to scanActiveBundles or iterate.
Definition at line 140 of file SpillPlacement.h.
References finish().
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 342 of file SpillPlacement.cpp.
References nodes, llvm::SpillPlacement::Node::preferReg(), and llvm::SpillPlacement::Node::update().
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 361 of file SpillPlacement.cpp.
References llvm::BitVector::clear().
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 319 of file SpillPlacement.cpp.
References llvm::SpillPlacement::Node::mustSpill(), nodes, llvm::SpillPlacement::Node::preferReg(), and llvm::SpillPlacement::Node::update().
|
static |
Definition at line 74 of file SpillPlacement.h.