class SpillPlacement
Declaration
class SpillPlacement : public MachineFunctionPass { /* full declaration omitted */ };
Description
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of passes that operate on the MachineFunction representation. Instead of overriding runOnFunction, subclasses override runOnMachineFunction.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:43
Inherits from: MachineFunctionPass
Member Variables
- private const llvm::MachineFunction* MF
- private const llvm::EdgeBundles* bundles
- private const llvm::MachineLoopInfo* loops
- private const llvm::MachineBlockFrequencyInfo* MBFI
- private llvm::SpillPlacement::Node* nodes = nullptr
- private llvm::BitVector* ActiveNodes
- private SmallVector<unsigned int, 8> Linked
- private SmallVector<unsigned int, 8> RecentPositive
- private SmallVector<llvm::BlockFrequency, 8> BlockFrequencies
- private llvm::BlockFrequency Threshold
- Decision threshold. A node gets the output value 0 if the weighted sum of its inputs falls in the open interval (-Threshold;Threshold).
- private SparseSet<unsigned int> TodoList
- List of nodes that need to be updated in ::iterate.
- public static char ID
Method Overview
- public SpillPlacement()
- private void activate(unsigned int n)
- public void addConstraints(ArrayRef<llvm::SpillPlacement::BlockConstraint> LiveBlocks)
- public void addLinks(ArrayRef<unsigned int> Links)
- public void addPrefSpill(ArrayRef<unsigned int> Blocks, bool Strong)
- public bool finish()
- private void getAnalysisUsage(llvm::AnalysisUsage & AU) const
- public llvm::BlockFrequency getBlockFrequency(unsigned int Number) const
- public ArrayRef<unsigned int> getRecentPositive()
- public void iterate()
- public void prepare(llvm::BitVector & RegBundles)
- private void releaseMemory()
- private bool runOnMachineFunction(llvm::MachineFunction & mf)
- public bool scanActiveBundles()
- private void setThreshold(const llvm::BlockFrequency & Entry)
- private bool update(unsigned int n)
- public ~SpillPlacement()
Inherited from MachineFunctionPass:
- public doInitialization
- protected getAnalysisUsage
- protected getClearedProperties
- protected getRequiredProperties
- protected getSetProperties
- protected runOnMachineFunction
Inherited from FunctionPass:
- public assignPassManager
- public createPrinterPass
- public getPotentialPassManagerType
- public runOnFunction
- protected skipFunction
Inherited from Pass:
- public assignPassManager
- public createPass
- public createPrinterPass
- public doFinalization
- public doInitialization
- public dump
- public dumpPassStructure
- public getAdjustedAnalysisPointer
- public getAnalysis
- public getAnalysis
- public getAnalysisID
- public getAnalysisID
- public getAnalysisIfAvailable
- public getAnalysisUsage
- public getAsImmutablePass
- public getAsPMDataManager
- public getPassID
- public getPassKind
- public getPassName
- public getPotentialPassManagerType
- public getResolver
- public lookupPassInfo
- public lookupPassInfo
- public mustPreserveAnalysisID
- public preparePassManager
- public print
- public releaseMemory
- public setResolver
- public verifyAnalysis
Methods
¶SpillPlacement()
SpillPlacement()
Declared at: llvm/lib/CodeGen/SpillPlacement.h:75
¶void activate(unsigned int n)
void activate(unsigned int n)
Declared at: llvm/lib/CodeGen/SpillPlacement.h:164
Parameters
- unsigned int n
¶void addConstraints(
ArrayRef<
llvm::SpillPlacement::BlockConstraint>
LiveBlocks)
void addConstraints(
ArrayRef<
llvm::SpillPlacement::BlockConstraint>
LiveBlocks)
Description
addConstraints - Add constraints and biases. This method may be called more than once to accumulate constraints.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:116
Parameters
- ArrayRef<llvm::SpillPlacement::BlockConstraint> LiveBlocks
- Constraints for blocks that have the variable live in or live out.
¶void addLinks(ArrayRef<unsigned int> Links)
void addLinks(ArrayRef<unsigned int> Links)
Description
addLinks - Add transparent blocks with the given numbers.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:127
Parameters
- ArrayRef<unsigned int> Links
¶void addPrefSpill(ArrayRef<unsigned int> Blocks,
bool Strong)
void addPrefSpill(ArrayRef<unsigned int> Blocks,
bool Strong)
Description
addPrefSpill - Add PrefSpill constraints to all blocks listed. This is equivalent to calling addConstraint with identical BlockConstraints with Entry = Exit = PrefSpill, and ChangesValue = false.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:124
Parameters
- ArrayRef<unsigned int> Blocks
- Array of block numbers that prefer to spill in and out.
- bool Strong
- When true, double the negative bias for these blocks.
¶bool finish()
bool finish()
Description
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().
Declared at: llvm/lib/CodeGen/SpillPlacement.h:151
Returns
True if a perfect solution was found, allowing the variable to be in a register through all relevant bundles.
¶void getAnalysisUsage(
llvm::AnalysisUsage& AU) const
void getAnalysisUsage(
llvm::AnalysisUsage& AU) const
Description
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this. For MachineFunctionPasses, calling AU.preservesCFG() indicates that the pass does not modify the MachineBasicBlock CFG.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:161
Parameters
¶llvm::BlockFrequency getBlockFrequency(
unsigned int Number) const
llvm::BlockFrequency getBlockFrequency(
unsigned int Number) const
Description
getBlockFrequency - Return the estimated block execution frequency per function invocation.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:155
Parameters
- unsigned int Number
¶ArrayRef<unsigned int> getRecentPositive()
ArrayRef<unsigned int> getRecentPositive()
Description
getRecentPositive - Return an array of bundles that became positive during the previous call to scanActiveBundles or iterate.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:142
¶void iterate()
void iterate()
Description
iterate - Update the network iteratively until convergence, or new bundles are found.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:138
¶void prepare(llvm::BitVector& RegBundles)
void prepare(llvm::BitVector& RegBundles)
Description
prepare - Reset state and prepare for a new spill placement computation.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:110
Parameters
- llvm::BitVector& 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.
¶void releaseMemory()
void releaseMemory()
Description
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed. The default behavior of passes is to hold onto memory for the entire duration of their lifetime (which is the entire compile time). For pipelined passes, this is not a big deal because that memory gets recycled every time the pass is invoked on another program unit. For IP passes, it is more important to free memory when it is unused. Optionally implement this function to release pass memory when it is no longer used.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:162
¶bool runOnMachineFunction(
llvm::MachineFunction& mf)
bool runOnMachineFunction(
llvm::MachineFunction& mf)
Description
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:160
Parameters
¶bool scanActiveBundles()
bool scanActiveBundles()
Description
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.
Declared at: llvm/lib/CodeGen/SpillPlacement.h:134
¶void setThreshold(
const llvm::BlockFrequency& Entry)
void setThreshold(
const llvm::BlockFrequency& Entry)
Declared at: llvm/lib/CodeGen/SpillPlacement.h:165
Parameters
- const llvm::BlockFrequency& Entry
¶bool update(unsigned int n)
bool update(unsigned int n)
Declared at: llvm/lib/CodeGen/SpillPlacement.h:167
Parameters
- unsigned int n
¶~SpillPlacement()
~SpillPlacement()
Declared at: llvm/lib/CodeGen/SpillPlacement.h:76