LLVM API Documentation

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

#include <LiveVariables.h>

Inheritance diagram for llvm::LiveVariables:
Inheritance graph
[legend]
Collaboration diagram for llvm::LiveVariables:
Collaboration graph
[legend]

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 ()
 
VarInfogetVarInfo (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...
 
- Public Member Functions inherited from llvm::FunctionPass
 FunctionPass (char &pid)
 
PasscreatePrinterPass (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...
 
- Public Member Functions inherited from llvm::Pass
 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)
 
AnalysisResolvergetResolver () const
 
virtual void * getAdjustedAnalysisPointer (AnalysisID ID)
 
virtual ImmutablePassgetAsImmutablePass ()
 
virtual PMDataManagergetAsPMDataManager ()
 
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 Public Member Functions inherited from llvm::Pass
static const PassInfolookupPassInfo (const void *TI)
 
static const PassInfolookupPassInfo (StringRef Arg)
 
static PasscreatePass (AnalysisID ID)
 
- Protected Member Functions inherited from llvm::MachineFunctionPass
 MachineFunctionPass (char &ID)
 

Detailed Description

Definition at line 46 of file LiveVariables.h.

Constructor & Destructor Documentation

llvm::LiveVariables::LiveVariables ( )
inline

Member Function Documentation

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

void llvm::LiveVariables::addVirtualRegisterDead ( unsigned  IncomingReg,
MachineInstr MI,
bool  AddIfNotFound = false 
)
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().

void llvm::LiveVariables::addVirtualRegisterKilled ( unsigned  IncomingReg,
MachineInstr MI,
bool  AddIfNotFound = false 
)
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().

Live Variable false void LiveVariables::getAnalysisUsage ( AnalysisUsage AU) const
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)
void LiveVariables::HandleVirtRegDef ( unsigned  reg,
MachineInstr MI 
)
void LiveVariables::HandleVirtRegUse ( unsigned  reg,
MachineBasicBlock MBB,
MachineInstr MI 
)
bool llvm::LiveVariables::isLiveIn ( unsigned  Reg,
const MachineBasicBlock MBB 
)
inline

Definition at line 281 of file LiveVariables.h.

References getVarInfo(), and llvm::LiveVariables::VarInfo::isLiveIn().

bool LiveVariables::isLiveOut ( unsigned  Reg,
const MachineBasicBlock MBB 
)
bool llvm::LiveVariables::isPHIJoin ( unsigned  Reg)
inline

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

virtual void llvm::LiveVariables::releaseMemory ( )
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.

bool llvm::LiveVariables::removeVirtualRegisterDead ( unsigned  reg,
MachineInstr MI 
)
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().

bool llvm::LiveVariables::removeVirtualRegisterKilled ( unsigned  reg,
MachineInstr MI 
)
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)
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().

bool LiveVariables::runOnMachineFunction ( MachineFunction MF)
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().

void llvm::LiveVariables::setPHIJoin ( unsigned  Reg)
inline

setPHIJoin - Mark Reg as a phi join register.

Definition at line 302 of file LiveVariables.h.

References llvm::SparseBitVector< ElementSize >::set().

Member Data Documentation

char LiveVariables::ID = 0
static

Definition at line 48 of file LiveVariables.h.


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