LLVM API Documentation

Public Member Functions | Friends
llvm::MachineSSAUpdater Class Reference

#include <MachineSSAUpdater.h>

List of all members.

Public Member Functions

 MachineSSAUpdater (MachineFunction &MF, SmallVectorImpl< MachineInstr * > *InsertedPHIs=nullptr)
 ~MachineSSAUpdater ()
void Initialize (unsigned V)
void AddAvailableValue (MachineBasicBlock *BB, unsigned V)
bool HasValueForBlock (MachineBasicBlock *BB) const
unsigned GetValueAtEndOfBlock (MachineBasicBlock *BB)
unsigned GetValueInMiddleOfBlock (MachineBasicBlock *BB)
void RewriteUse (MachineOperand &U)

Friends

class SSAUpdaterTraits< MachineSSAUpdater >

Detailed Description

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.


Constructor & Destructor Documentation

MachineSSAUpdater::MachineSSAUpdater ( MachineFunction MF,
SmallVectorImpl< MachineInstr * > *  InsertedPHIs = nullptr 
) [explicit]

MachineSSAUpdater constructor. If InsertedPHIs is specified, it will be filled in with all PHI Nodes created by rewriting.

Definition at line 40 of file MachineSSAUpdater.cpp.

References llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getRegInfo(), and llvm::MachineFunction::getSubtarget().

Definition at line 47 of file MachineSSAUpdater.cpp.


Member Function Documentation

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().

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.

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 143 of file MachineSSAUpdater.cpp.

References llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::begin(), llvm::dbgs(), DEBUG, llvm::MachineBasicBlock::empty(), llvm::MachineBasicBlock::end(), llvm::MachineInstr::eraseFromParent(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), HasValueForBlock(), llvm::TargetOpcode::IMPLICIT_DEF, InsertNewDef(), llvm::MachineInstr::isConstantValuePHI(), LookForIdenticalPHI(), llvm::TargetOpcode::PHI, llvm::MachineBasicBlock::pred_begin(), llvm::MachineBasicBlock::pred_empty(), llvm::MachineBasicBlock::pred_end(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and llvm::SmallVectorTemplateCommon< T >::size().

Referenced by RewriteUse().

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 >::count(), and getAvailableVals().

Referenced by GetValueInMiddleOfBlock().

Initialize - Reset this object to get ready for a new set of SSA updates.

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 53 of file MachineSSAUpdater.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::clear(), getAvailableVals(), and llvm::MachineRegisterInfo::getRegClass().

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.

RewriteUse - Rewrite a use of the symbolic value. This handles PHI nodes, which use their value in the corresponding predecessor.

Definition at line 223 of file MachineSSAUpdater.cpp.

References findCorrespondingPred(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getParent(), GetValueInMiddleOfBlock(), llvm::MachineInstr::isPHI(), and llvm::MachineOperand::setReg().


Friends And Related Function Documentation

friend class SSAUpdaterTraits< MachineSSAUpdater > [friend]

Definition at line 36 of file MachineSSAUpdater.h.


The documentation for this class was generated from the following files: