LLVM API Documentation

Classes | Public Member Functions | Static Public Attributes
llvm::LiveVariables Class Reference

#include <LiveVariables.h>

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

List of all members.

Classes

struct  VarInfo

Public Member Functions

 LiveVariables ()
bool runOnMachineFunction (MachineFunction &MF) override
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 override
void releaseMemory () override
VarInfogetVarInfo (unsigned RegIdx)
 getVarInfo - Get (possibly creating) a VarInfo object for the given vreg.
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.
void setPHIJoin (unsigned Reg)
 setPHIJoin - Mark Reg as a phi join register.

Static Public Attributes

static char ID = 0

Detailed Description

Definition at line 46 of file LiveVariables.h.


Constructor & Destructor Documentation


Member Function Documentation

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 786 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 238 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 202 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 [override, 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.

Definition at line 285 of file LiveVariables.h.

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

isPHIJoin - Return true if Reg is a phi join register.

Definition at line 303 of file LiveVariables.h.

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

Definition at line 118 of file LiveVariables.cpp.

References llvm::MachineBasicBlock::back().

Referenced by HandleVirtRegUse().

void LiveVariables::MarkVirtRegAliveInBlock ( VarInfo VRInfo,
MachineBasicBlock DefBlock,
MachineBasicBlock BB,
std::vector< MachineBasicBlock * > &  WorkList 
)

RegisterDefIsDead - Return true if the specified instruction defines the specified register, but that definition is dead.

void llvm::LiveVariables::releaseMemory ( ) [inline, override, virtual]

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 268 of file LiveVariables.h.

References llvm::IndexedMap< T, ToIndexT >::clear().

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

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

replaceKillInstruction - Update register kill info by replacing a kill instruction with a new one.

Definition at line 681 of file LiveVariables.cpp.

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

Referenced by finishConvertToThreeAddress().

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

setPHIJoin - Mark Reg as a phi join register.

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