LLVM 20.0.0git
|
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. | |
MachineSSAUpdater (const MachineSSAUpdater &)=delete | |
MachineSSAUpdater & | operator= (const MachineSSAUpdater &)=delete |
~MachineSSAUpdater () | |
void | Initialize (Register V) |
Initialize - Reset this object to get ready for a new set of SSA updates. | |
void | AddAvailableValue (MachineBasicBlock *BB, Register V) |
AddAvailableValue - Indicate that a rewritten value is available at the end of the specified block with the specified value. | |
bool | HasValueForBlock (MachineBasicBlock *BB) const |
HasValueForBlock - Return true if the MachineSSAUpdater already has a value for the specified block. | |
Register | GetValueAtEndOfBlock (MachineBasicBlock *BB) |
GetValueAtEndOfBlock - Construct SSA form, materializing a value that is live at the end of the specified block. | |
Register | GetValueInMiddleOfBlock (MachineBasicBlock *BB, bool ExistingValueOnly=false) |
GetValueInMiddleOfBlock - Construct SSA form, materializing a value that is live in the middle of the specified block. | |
void | RewriteUse (MachineOperand &U) |
RewriteUse - Rewrite a use of the symbolic value. | |
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 35 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 43 of file MachineSSAUpdater.cpp.
|
delete |
MachineSSAUpdater::~MachineSSAUpdater | ( | ) |
Definition at line 48 of file MachineSSAUpdater.cpp.
void MachineSSAUpdater::AddAvailableValue | ( | MachineBasicBlock * | BB, |
Register | 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 71 of file MachineSSAUpdater.cpp.
References getAvailableVals().
Referenced by llvm::TailDuplicator::tailDuplicateAndUpdate().
Register MachineSSAUpdater::GetValueAtEndOfBlock | ( | MachineBasicBlock * | BB | ) |
GetValueAtEndOfBlock - Construct SSA form, materializing a value that is live at the end of the specified block.
Definition at line 77 of file MachineSSAUpdater.cpp.
Register MachineSSAUpdater::GetValueInMiddleOfBlock | ( | MachineBasicBlock * | BB, |
bool | ExistingValueOnly = false |
||
) |
GetValueInMiddleOfBlock - Construct SSA form, materializing a value that is live in the middle of the specified block.
If ExistingValueOnly is true then this will only return an existing value or $noreg; otherwise new instructions may be inserted to materialize a value.
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 143 of file MachineSSAUpdater.cpp.
References llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::begin(), llvm::dbgs(), llvm::MachineBasicBlock::empty(), llvm::MachineBasicBlock::end(), llvm::MachineInstr::eraseFromParent(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineInstrBuilder::getReg(), HasValueForBlock(), InsertNewDef(), llvm::MachineInstr::isConstantValuePHI(), LLVM_DEBUG, LookForIdenticalPHI(), llvm::MachineBasicBlock::pred_empty(), llvm::MachineBasicBlock::predecessors(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by RewriteUse(), and llvm::TailDuplicator::tailDuplicateAndUpdate().
bool MachineSSAUpdater::HasValueForBlock | ( | MachineBasicBlock * | BB | ) | const |
HasValueForBlock - Return true if the MachineSSAUpdater already has a value for the specified block.
Definition at line 65 of file MachineSSAUpdater.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), and getAvailableVals().
Referenced by GetValueInMiddleOfBlock().
void MachineSSAUpdater::Initialize | ( | Register | V | ) |
Initialize - Reset this object to get ready for a new set of SSA updates.
Definition at line 54 of file MachineSSAUpdater.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear(), getAvailableVals(), and llvm::MachineRegisterInfo::getVRegAttrs().
Referenced by 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 229 of file MachineSSAUpdater.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::MachineRegisterInfo::constrainRegClass(), llvm::dbgs(), findCorrespondingPred(), llvm::MachineBasicBlock::getFirstNonPHI(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), GetValueInMiddleOfBlock(), InsertNewDef(), llvm::MachineInstr::isPHI(), LLVM_DEBUG, llvm::MachineRegisterInfo::VRegAttrs::RCOrRB, and UseMI.
Referenced by llvm::TailDuplicator::tailDuplicateAndUpdate().
|
friend |
Definition at line 1 of file MachineSSAUpdater.h.