LLVM API Documentation
#include <LiveVariables.h>
Classes | |
struct | VarInfo |
Public Member Functions | |
LiveVariables () | |
virtual bool | runOnMachineFunction (MachineFunction &MF) |
bool | RegisterDefIsDead (MachineInstr *MI, unsigned Reg) const |
void | replaceKillInstruction (unsigned Reg, MachineInstr *OldMI, MachineInstr *NewMI) |
void | addVirtualRegisterKilled (unsigned IncomingReg, MachineInstr *MI, bool AddIfNotFound=false) |
bool | removeVirtualRegisterKilled (unsigned reg, MachineInstr *MI) |
void | removeVirtualRegistersKilled (MachineInstr *MI) |
void | addVirtualRegisterDead (unsigned IncomingReg, MachineInstr *MI, bool AddIfNotFound=false) |
bool | removeVirtualRegisterDead (unsigned reg, MachineInstr *MI) |
void | getAnalysisUsage (AnalysisUsage &AU) const |
virtual void | releaseMemory () |
VarInfo & | getVarInfo (unsigned RegIdx) |
getVarInfo - Get (possibly creating) a VarInfo object for the given vreg. More... | |
void | MarkVirtRegAliveInBlock (VarInfo &VRInfo, MachineBasicBlock *DefBlock, MachineBasicBlock *BB) |
void | MarkVirtRegAliveInBlock (VarInfo &VRInfo, MachineBasicBlock *DefBlock, MachineBasicBlock *BB, std::vector< MachineBasicBlock * > &WorkList) |
void | HandleVirtRegDef (unsigned reg, MachineInstr *MI) |
void | HandleVirtRegUse (unsigned reg, MachineBasicBlock *MBB, MachineInstr *MI) |
bool | isLiveIn (unsigned Reg, const MachineBasicBlock &MBB) |
bool | isLiveOut (unsigned Reg, const MachineBasicBlock &MBB) |
void | addNewBlock (MachineBasicBlock *BB, MachineBasicBlock *DomBB, MachineBasicBlock *SuccBB) |
bool | isPHIJoin (unsigned Reg) |
isPHIJoin - Return true if Reg is a phi join register. More... | |
void | setPHIJoin (unsigned Reg) |
setPHIJoin - Mark Reg as a phi join register. More... | |
![]() | |
FunctionPass (char &pid) | |
Pass * | createPrinterPass (raw_ostream &O, const std::string &Banner) const |
createPrinterPass - Get a function printer pass. More... | |
virtual void | assignPassManager (PMStack &PMS, PassManagerType T) |
virtual PassManagerType | getPotentialPassManagerType () const |
Return what kind of Pass Manager can manage this pass. More... | |
![]() | |
Pass (PassKind K, char &pid) | |
virtual | ~Pass () |
PassKind | getPassKind () const |
virtual const char * | getPassName () const |
AnalysisID | getPassID () const |
getPassID - Return the PassID number that corresponds to this pass. More... | |
virtual bool | doInitialization (Module &) |
virtual bool | doFinalization (Module &) |
virtual void | print (raw_ostream &O, const Module *M) const |
void | dump () const |
virtual void | preparePassManager (PMStack &) |
Check if available pass managers are suitable for this pass or not. More... | |
void | setResolver (AnalysisResolver *AR) |
AnalysisResolver * | getResolver () const |
virtual void * | getAdjustedAnalysisPointer (AnalysisID ID) |
virtual ImmutablePass * | getAsImmutablePass () |
virtual PMDataManager * | getAsPMDataManager () |
virtual void | verifyAnalysis () const |
virtual void | dumpPassStructure (unsigned Offset=0) |
template<typename AnalysisType > | |
AnalysisType * | getAnalysisIfAvailable () const |
bool | mustPreserveAnalysisID (char &AID) const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis () const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis (Function &F) |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI) const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI, Function &F) |
Static Public Attributes | |
static char | ID = 0 |
Additional Inherited Members | |
![]() | |
static const PassInfo * | lookupPassInfo (const void *TI) |
static const PassInfo * | lookupPassInfo (StringRef Arg) |
static Pass * | createPass (AnalysisID ID) |
![]() | |
MachineFunctionPass (char &ID) | |
Definition at line 46 of file LiveVariables.h.
|
inline |
Definition at line 49 of file LiveVariables.h.
References llvm::PassRegistry::getPassRegistry(), and llvm::initializeLiveVariablesPass().
void LiveVariables::addNewBlock | ( | MachineBasicBlock * | BB, |
MachineBasicBlock * | DomBB, | ||
MachineBasicBlock * | SuccBB | ||
) |
addNewBlock - Add a new basic block BB between DomBB and SuccBB. All variables that are live out of DomBB and live into SuccBB will be marked as passing live through BB. This method assumes that the machine code is still in SSA form.
addNewBlock - Add a new basic block BB as an empty succcessor to DomBB. All variables that are live out of DomBB will be marked as passing live through BB.
Definition at line 780 of file LiveVariables.cpp.
References llvm::LiveVariables::VarInfo::AliveBlocks, llvm::MachineBasicBlock::begin(), llvm::SmallSet< T, N, C >::count(), llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::getNumber(), llvm::MachineRegisterInfo::getNumVirtRegs(), getVarInfo(), I, llvm::TargetRegisterInfo::index2VirtReg(), llvm::SmallSet< T, N, C >::insert(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::SparseBitVector< ElementSize >::set(), and llvm::SparseBitVector< ElementSize >::test().
Referenced by llvm::MachineBasicBlock::SplitCriticalEdge().
|
inline |
addVirtualRegisterDead - Add information about the fact that the specified register is dead after being used by the specified instruction. If AddIfNotFound is true, add a implicit operand if it's not found.
Definition at line 234 of file LiveVariables.h.
References llvm::MachineInstr::addRegisterDead(), getVarInfo(), and llvm::LiveVariables::VarInfo::Kills.
Referenced by llvm::ARMBaseInstrInfo::convertToThreeAddress().
|
inline |
addVirtualRegisterKilled - Add information about the fact that the specified register is killed after being used by the specified instruction. If AddIfNotFound is true, add a implicit operand if it's not found.
Definition at line 198 of file LiveVariables.h.
References llvm::MachineInstr::addRegisterKilled(), getVarInfo(), and llvm::LiveVariables::VarInfo::Kills.
Referenced by llvm::ARMBaseInstrInfo::convertToThreeAddress().
|
virtual |
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
For MachineFunctionPasses, calling AU.preservesCFG() indicates that the pass does not modify the MachineBasicBlock CFG.
Reimplemented from llvm::MachineFunctionPass.
Definition at line 53 of file LiveVariables.cpp.
References llvm::MachineFunctionPass::getAnalysisUsage(), and llvm::UnreachableMachineBlockElimID.
LiveVariables::VarInfo & LiveVariables::getVarInfo | ( | unsigned | RegIdx | ) |
getVarInfo - Get (possibly creating) a VarInfo object for the given vreg.
getVarInfo - Return the VarInfo structure for the specified VIRTUAL register.
Definition at line 85 of file LiveVariables.cpp.
References llvm::TargetRegisterInfo::isVirtualRegister().
Referenced by addNewBlock(), addVirtualRegisterDead(), addVirtualRegisterKilled(), llvm::ARMBaseInstrInfo::convertToThreeAddress(), HandleVirtRegDef(), HandleVirtRegUse(), isLiveIn(), isLiveOut(), removeVirtualRegisterDead(), removeVirtualRegisterKilled(), removeVirtualRegistersKilled(), replaceKillInstruction(), runOnMachineFunction(), and llvm::MachineBasicBlock::SplitCriticalEdge().
void LiveVariables::HandleVirtRegDef | ( | unsigned | reg, |
MachineInstr * | MI | ||
) |
Definition at line 182 of file LiveVariables.cpp.
References llvm::LiveVariables::VarInfo::AliveBlocks, llvm::SparseBitVector< ElementSize >::empty(), getVarInfo(), and llvm::LiveVariables::VarInfo::Kills.
Referenced by runOnMachineFunction().
void LiveVariables::HandleVirtRegUse | ( | unsigned | reg, |
MachineBasicBlock * | MBB, | ||
MachineInstr * | MI | ||
) |
Definition at line 131 of file LiveVariables.cpp.
References llvm::LiveVariables::VarInfo::AliveBlocks, llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getParent(), getVarInfo(), llvm::MachineRegisterInfo::getVRegDef(), llvm::LiveVariables::VarInfo::Kills, MarkVirtRegAliveInBlock(), llvm::A64CC::MI, llvm::MachineBasicBlock::pred_begin(), llvm::MachineBasicBlock::pred_end(), and llvm::SparseBitVector< ElementSize >::test().
Referenced by runOnMachineFunction().
|
inline |
Definition at line 281 of file LiveVariables.h.
References getVarInfo(), and llvm::LiveVariables::VarInfo::isLiveIn().
bool LiveVariables::isLiveOut | ( | unsigned | Reg, |
const MachineBasicBlock & | MBB | ||
) |
isLiveOut - Determine if Reg is live out from MBB, when not considering PHI nodes. This means that Reg is either killed by a successor block or passed through one.
Definition at line 732 of file LiveVariables.cpp.
References llvm::LiveVariables::VarInfo::AliveBlocks, llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::MachineBasicBlock::getNumber(), getVarInfo(), llvm::LiveVariables::VarInfo::Kills, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::MachineBasicBlock::succ_begin(), llvm::MachineBasicBlock::succ_end(), and llvm::SparseBitVector< ElementSize >::test().
isPHIJoin - Return true if Reg is a phi join register.
Definition at line 299 of file LiveVariables.h.
References llvm::SparseBitVector< ElementSize >::test().
void LiveVariables::MarkVirtRegAliveInBlock | ( | VarInfo & | VRInfo, |
MachineBasicBlock * | DefBlock, | ||
MachineBasicBlock * | BB | ||
) |
Definition at line 118 of file LiveVariables.cpp.
References llvm::MachineBasicBlock::back().
Referenced by HandleVirtRegUse(), and runOnMachineFunction().
void LiveVariables::MarkVirtRegAliveInBlock | ( | VarInfo & | VRInfo, |
MachineBasicBlock * | DefBlock, | ||
MachineBasicBlock * | BB, | ||
std::vector< MachineBasicBlock * > & | WorkList | ||
) |
Definition at line 92 of file LiveVariables.cpp.
References llvm::LiveVariables::VarInfo::AliveBlocks, llvm::MachineFunction::front(), llvm::MachineBasicBlock::getNumber(), llvm::LiveVariables::VarInfo::Kills, llvm::MachineBasicBlock::pred_rbegin(), llvm::MachineBasicBlock::pred_rend(), llvm::SparseBitVector< ElementSize >::set(), and llvm::SparseBitVector< ElementSize >::test().
bool llvm::LiveVariables::RegisterDefIsDead | ( | MachineInstr * | MI, |
unsigned | Reg | ||
) | const |
RegisterDefIsDead - Return true if the specified instruction defines the specified register, but that definition is dead.
|
inlinevirtual |
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.
Reimplemented from llvm::Pass.
Definition at line 264 of file LiveVariables.h.
|
inline |
removeVirtualRegisterDead - Remove the specified kill of the virtual register from the live variable information. Returns true if the variable was marked dead at the specified instruction, false otherwise.
Definition at line 244 of file LiveVariables.h.
References llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), getVarInfo(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), and llvm::MachineOperand::setIsDead().
|
inline |
removeVirtualRegisterKilled - Remove the specified kill of the virtual register from the live variable information. Returns true if the variable was marked as killed by the specified instruction, false otherwise.
Definition at line 208 of file LiveVariables.h.
References llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), getVarInfo(), llvm::MachineOperand::isKill(), llvm::MachineOperand::isReg(), and llvm::MachineOperand::setIsKill().
void LiveVariables::removeVirtualRegistersKilled | ( | MachineInstr * | MI | ) |
removeVirtualRegistersKilled - Remove all killed info for the specified instruction.
Definition at line 684 of file LiveVariables.cpp.
References llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), getVarInfo(), llvm::MachineOperand::isKill(), llvm::MachineOperand::isReg(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::LiveVariables::VarInfo::removeKill(), and llvm::MachineOperand::setIsKill().
void LiveVariables::replaceKillInstruction | ( | unsigned | Reg, |
MachineInstr * | OldMI, | ||
MachineInstr * | NewMI | ||
) |
replaceKillInstruction - Update register kill info by replacing a kill instruction with a new one.
Definition at line 676 of file LiveVariables.cpp.
References getVarInfo(), and llvm::LiveVariables::VarInfo::Kills.
Referenced by llvm::X86InstrInfo::convertToThreeAddress(), and finishConvertToThreeAddress().
|
virtual |
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.
Implements llvm::MachineFunctionPass.
Definition at line 500 of file LiveVariables.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::MachineBasicBlock::begin(), llvm::MachineFunction::begin(), llvm::SparseBitVector< ElementSize >::clear(), llvm::SmallSet< T, N, C >::count(), llvm::SmallPtrSet< PtrType, SmallSize >::count(), llvm::df_ext_begin(), llvm::df_ext_end(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::MachineBasicBlock::end(), llvm::MachineFunction::end(), llvm::MachineBasicBlock::getNumber(), llvm::MachineFunction::getNumBlockIDs(), llvm::MachineInstr::getNumOperands(), llvm::MCRegisterInfo::getNumRegs(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::TargetMachine::getRegisterInfo(), llvm::MachineFunction::getTarget(), getVarInfo(), llvm::MachineRegisterInfo::getVRegDef(), HandleVirtRegDef(), HandleVirtRegUse(), I, llvm::TargetRegisterInfo::index2VirtReg(), llvm::SmallSet< T, N, C >::insert(), llvm::MachineInstr::isDebugValue(), llvm::TargetRegisterInfo::isInAllocatableClass(), llvm::MachineBasicBlock::isLandingPad(), llvm::MachineInstr::isPHI(), llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::MachineOperand::isReg(), llvm::MachineOperand::isRegMask(), llvm::MachineRegisterInfo::isReserved(), llvm::MachineRegisterInfo::isSSA(), llvm::MachineOperand::isUse(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::A64CC::LE, LI, llvm::MachineBasicBlock::livein_begin(), llvm::MachineBasicBlock::livein_end(), MarkVirtRegAliveInBlock(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::MachineOperand::readsReg(), llvm::report_fatal_error(), llvm::MachineOperand::setIsDead(), llvm::MachineOperand::setIsKill(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::MachineBasicBlock::succ_begin(), and llvm::MachineBasicBlock::succ_end().
|
inline |
setPHIJoin - Mark Reg as a phi join register.
Definition at line 302 of file LiveVariables.h.
References llvm::SparseBitVector< ElementSize >::set().
|
static |
Definition at line 48 of file LiveVariables.h.