LLVM
8.0.1
|
MachineSSAUpdater - This class updates SSA form for a set of virtual registers defined in multiple blocks. More...
#include "llvm/CodeGen/MachineSSAUpdater.h"
Public Member Functions | |
MachineSSAUpdater (MachineFunction &MF, SmallVectorImpl< MachineInstr *> *NewPHI=nullptr) | |
MachineSSAUpdater constructor. More... | |
MachineSSAUpdater (const MachineSSAUpdater &)=delete | |
MachineSSAUpdater & | operator= (const MachineSSAUpdater &)=delete |
~MachineSSAUpdater () | |
void | Initialize (unsigned V) |
Initialize - Reset this object to get ready for a new set of SSA updates. More... | |
void | AddAvailableValue (MachineBasicBlock *BB, unsigned V) |
AddAvailableValue - Indicate that a rewritten value is available at the end of the specified block with the specified value. More... | |
bool | HasValueForBlock (MachineBasicBlock *BB) const |
HasValueForBlock - Return true if the MachineSSAUpdater already has a value for the specified block. More... | |
unsigned | GetValueAtEndOfBlock (MachineBasicBlock *BB) |
GetValueAtEndOfBlock - Construct SSA form, materializing a value that is live at the end of the specified block. More... | |
unsigned | GetValueInMiddleOfBlock (MachineBasicBlock *BB) |
GetValueInMiddleOfBlock - Construct SSA form, materializing a value that is live in the middle of the specified block. More... | |
void | RewriteUse (MachineOperand &U) |
RewriteUse - Rewrite a use of the symbolic value. More... | |
Friends | |
class | SSAUpdaterTraits< MachineSSAUpdater > |
MachineSSAUpdater - This class updates SSA form for a set of virtual registers defined in multiple blocks.
This is used when code duplication or another unstructured transformation wants to rewrite a set of uses of one vreg with uses of a set of vregs.
Definition at line 33 of file MachineSSAUpdater.h.
|
explicit |
MachineSSAUpdater constructor.
If InsertedPHIs is specified, it will be filled in with all PHI Nodes created by rewriting.
Definition at line 44 of file MachineSSAUpdater.cpp.
|
delete |
MachineSSAUpdater::~MachineSSAUpdater | ( | ) |
Definition at line 49 of file MachineSSAUpdater.cpp.
void MachineSSAUpdater::AddAvailableValue | ( | MachineBasicBlock * | BB, |
unsigned | V | ||
) |
AddAvailableValue - Indicate that a rewritten value is available at the end of the specified block with the specified value.
AddAvailableValue - Indicate that a rewritten value is available in the specified block with the specified value.
Definition at line 73 of file MachineSSAUpdater.cpp.
References getAvailableVals().
Referenced by getRegClassForUnfoldedLoad(), insertUndefLaneMask(), and llvm::TailDuplicator::tailDuplicateAndUpdate().
unsigned MachineSSAUpdater::GetValueAtEndOfBlock | ( | MachineBasicBlock * | BB | ) |
GetValueAtEndOfBlock - Construct SSA form, materializing a value that is live at the end of the specified block.
Definition at line 79 of file MachineSSAUpdater.cpp.
unsigned MachineSSAUpdater::GetValueInMiddleOfBlock | ( | MachineBasicBlock * | BB | ) |
GetValueInMiddleOfBlock - Construct SSA form, materializing a value that is live in the middle of the specified block.
GetValueInMiddleOfBlock is the same as GetValueAtEndOfBlock except in one important case: if there is a definition of the rewritten value after the 'use' in BB. Consider code like this:
X1 = ...
SomeBB: use(X) X2 = ... br Cond, SomeBB, OutBB
In this case, there are two values (X1 and X2) added to the AvailableVals set by the client of the rewriter, and those values are both live out of their respective blocks. However, the use of X happens in the middle of a block. Because of this, we need to insert a new PHI node in SomeBB to merge the appropriate values, and this value isn't live out of the block.
Definition at line 144 of file MachineSSAUpdater.cpp.
References llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::begin(), llvm::dbgs(), E, llvm::MachineBasicBlock::empty(), llvm::MachineBasicBlock::end(), llvm::MachineInstr::eraseFromParent(), first, llvm::MachineBasicBlock::getFirstTerminator(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), HasValueForBlock(), InsertNewDef(), llvm::MachineInstr::isConstantValuePHI(), LLVM_DEBUG, LookForIdenticalPHI(), llvm::MachineBasicBlock::pred_begin(), llvm::MachineBasicBlock::pred_empty(), llvm::MachineBasicBlock::pred_end(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateBase< T >::push_back(), and llvm::SmallVectorBase::size().
Referenced by getRegClassForUnfoldedLoad(), insertUndefLaneMask(), and RewriteUse().
bool MachineSSAUpdater::HasValueForBlock | ( | MachineBasicBlock * | BB | ) | const |
HasValueForBlock - Return true if the MachineSSAUpdater already has a value for the specified block.
Definition at line 67 of file MachineSSAUpdater.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), and getAvailableVals().
Referenced by GetValueInMiddleOfBlock().
void MachineSSAUpdater::Initialize | ( | unsigned | V | ) |
Initialize - Reset this object to get ready for a new set of SSA updates.
ProtoValue is the value used to name PHI nodes.
Definition at line 55 of file MachineSSAUpdater.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear(), getAvailableVals(), and llvm::MachineRegisterInfo::getRegClass().
Referenced by getRegClassForUnfoldedLoad(), insertUndefLaneMask(), and llvm::TailDuplicator::tailDuplicateAndUpdate().
|
delete |
void MachineSSAUpdater::RewriteUse | ( | MachineOperand & | U | ) |
RewriteUse - Rewrite a use of the symbolic value.
This handles PHI nodes, which use their value in the corresponding predecessor. Note that this will not work if the use is supposed to be rewritten to a value defined in the same block as the use, but above it. Any 'AddAvailableValue's added for the use's block will be considered to be below it.
This handles PHI nodes, which use their value in the corresponding predecessor.
Definition at line 224 of file MachineSSAUpdater.cpp.
References findCorrespondingPred(), llvm::MachineOperand::getParent(), llvm::MachineInstr::getParent(), GetValueInMiddleOfBlock(), llvm::MachineInstr::isPHI(), llvm::MachineOperand::setReg(), and UseMI.
Referenced by llvm::TailDuplicator::tailDuplicateAndUpdate().
|
friend |
Definition at line 34 of file MachineSSAUpdater.h.