LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Friends | List of all members
llvm::MachineSSAUpdater Class Reference

#include <MachineSSAUpdater.h>

Public Member Functions

 MachineSSAUpdater (MachineFunction &MF, SmallVectorImpl< MachineInstr * > *InsertedPHIs=0)
 
 ~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 = 0 
)
explicit

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

Definition at line 37 of file MachineSSAUpdater.cpp.

References llvm::TargetMachine::getInstrInfo(), llvm::MachineFunction::getRegInfo(), and llvm::MachineFunction::getTarget().

MachineSSAUpdater::~MachineSSAUpdater ( )

Definition at line 44 of file MachineSSAUpdater.cpp.

Member Function Documentation

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

References getAvailableVals().

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 74 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 140 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(), and llvm::SmallVectorTemplateCommon< T >::size().

Referenced by RewriteUse().

bool MachineSSAUpdater::HasValueForBlock ( MachineBasicBlock BB) const

HasValueForBlock - Return true if the MachineSSAUpdater already has a value for the specified block.

Definition at line 62 of file MachineSSAUpdater.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::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.

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

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

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.

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

Definition at line 220 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: