class LiveVariables
Declaration
class LiveVariables : public MachineFunctionPass { /* full declaration omitted */ };
Description
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of passes that operate on the MachineFunction representation. Instead of overriding runOnFunction, subclasses override runOnMachineFunction.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:47
Inherits from: MachineFunctionPass
Member Variables
- private IndexedMap<llvm::LiveVariables::VarInfo, llvm::VirtReg2IndexFunctor> VirtRegInfo
- VirtRegInfo - This list is a mapping from virtual register number to variable information.
- private SparseBitVector<> PHIJoins
- PHIJoins - list of virtual registers that are PHI joins. These registers may have multiple definitions, and they require special handling when building live intervals.
- private llvm::MachineFunction* MF
- private llvm::MachineRegisterInfo* MRI
- private const llvm::TargetRegisterInfo* TRI
- private std::vector<MachineInstr*> PhysRegDef
- private std::vector<MachineInstr*> PhysRegUse
- private std::vector<SmallVector<unsigned int, 4>> PHIVarInfo
- private DenseMap<llvm::MachineInstr*, unsigned int> DistanceMap
- public static char ID
Method Overview
- private llvm::MachineInstr * FindLastPartialDef(llvm::Register Reg, SmallSet<unsigned int, 4> & PartDefRegs)
- private llvm::MachineInstr * FindLastRefOrPartRef(llvm::Register Reg)
- private void HandlePhysRegDef(llvm::Register Reg, llvm::MachineInstr * MI, SmallVectorImpl<unsigned int> & Defs)
- private bool HandlePhysRegKill(llvm::Register Reg, llvm::MachineInstr * MI)
- private void HandlePhysRegUse(llvm::Register Reg, llvm::MachineInstr & MI)
- private void HandleRegMask(const llvm::MachineOperand &)
- public void HandleVirtRegDef(llvm::Register reg, llvm::MachineInstr & MI)
- public void HandleVirtRegUse(llvm::Register reg, llvm::MachineBasicBlock * MBB, llvm::MachineInstr & MI)
- public LiveVariables()
- public void MarkVirtRegAliveInBlock(llvm::LiveVariables::VarInfo & VRInfo, llvm::MachineBasicBlock * DefBlock, llvm::MachineBasicBlock * BB, SmallVectorImpl<llvm::MachineBasicBlock *> & WorkList)
- public void MarkVirtRegAliveInBlock(llvm::LiveVariables::VarInfo & VRInfo, llvm::MachineBasicBlock * DefBlock, llvm::MachineBasicBlock * BB)
- public bool RegisterDefIsDead(llvm::MachineInstr & MI, llvm::Register Reg) const
- private void UpdatePhysRegDefs(llvm::MachineInstr & MI, SmallVectorImpl<unsigned int> & Defs)
- public void addNewBlock(llvm::MachineBasicBlock * BB, llvm::MachineBasicBlock * DomBB, llvm::MachineBasicBlock * SuccBB, std::vector<SparseBitVector<>> & LiveInSets)
- public void addNewBlock(llvm::MachineBasicBlock * BB, llvm::MachineBasicBlock * DomBB, llvm::MachineBasicBlock * SuccBB)
- public void addVirtualRegisterDead(llvm::Register IncomingReg, llvm::MachineInstr & MI, bool AddIfNotFound = false)
- public void addVirtualRegisterKilled(llvm::Register IncomingReg, llvm::MachineInstr & MI, bool AddIfNotFound = false)
- private void analyzePHINodes(const llvm::MachineFunction & Fn)
- public void getAnalysisUsage(llvm::AnalysisUsage & AU) const
- public llvm::LiveVariables::VarInfo & getVarInfo(llvm::Register Reg)
- public bool isLiveIn(llvm::Register Reg, const llvm::MachineBasicBlock & MBB)
- public bool isLiveOut(llvm::Register Reg, const llvm::MachineBasicBlock & MBB)
- public bool isPHIJoin(llvm::Register Reg)
- public void recomputeForSingleDefVirtReg(llvm::Register Reg)
- public void releaseMemory()
- public bool removeVirtualRegisterDead(llvm::Register Reg, llvm::MachineInstr & MI)
- public bool removeVirtualRegisterKilled(llvm::Register Reg, llvm::MachineInstr & MI)
- public void removeVirtualRegistersKilled(llvm::MachineInstr & MI)
- public void replaceKillInstruction(llvm::Register Reg, llvm::MachineInstr & OldMI, llvm::MachineInstr & NewMI)
- private void runOnBlock(llvm::MachineBasicBlock * MBB, unsigned int NumRegs)
- private void runOnInstr(llvm::MachineInstr & MI, SmallVectorImpl<unsigned int> & Defs)
- public bool runOnMachineFunction(llvm::MachineFunction & MF)
- public void setPHIJoin(llvm::Register Reg)
Inherited from MachineFunctionPass:
- public doInitialization
- protected getAnalysisUsage
- protected getClearedProperties
- protected getRequiredProperties
- protected getSetProperties
- protected runOnMachineFunction
Inherited from FunctionPass:
- public assignPassManager
- public createPrinterPass
- public getPotentialPassManagerType
- public runOnFunction
- protected skipFunction
Inherited from Pass:
- public assignPassManager
- public createPass
- public createPrinterPass
- public doFinalization
- public doInitialization
- public dump
- public dumpPassStructure
- public getAdjustedAnalysisPointer
- public getAnalysis
- public getAnalysis
- public getAnalysisID
- public getAnalysisID
- public getAnalysisIfAvailable
- public getAnalysisUsage
- public getAsImmutablePass
- public getAsPMDataManager
- public getPassID
- public getPassKind
- public getPassName
- public getPotentialPassManagerType
- public getResolver
- public lookupPassInfo
- public lookupPassInfo
- public mustPreserveAnalysisID
- public preparePassManager
- public print
- public releaseMemory
- public setResolver
- public verifyAnalysis
Methods
¶llvm::MachineInstr* FindLastPartialDef(
llvm::Register Reg,
SmallSet<unsigned int, 4>& PartDefRegs)
llvm::MachineInstr* FindLastPartialDef(
llvm::Register Reg,
SmallSet<unsigned int, 4>& PartDefRegs)
Description
FindLastPartialDef - Return the last partial def of the specified register. Also returns the sub-registers that're defined by the instruction.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:169
Parameters
- llvm::Register Reg
- SmallSet<unsigned int, 4>& PartDefRegs
¶llvm::MachineInstr* FindLastRefOrPartRef(
llvm::Register Reg)
llvm::MachineInstr* FindLastRefOrPartRef(
llvm::Register Reg)
Description
FindLastRefOrPartRef - Return the last reference or partial reference of the specified register.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:164
Parameters
- llvm::Register Reg
¶void HandlePhysRegDef(
llvm::Register Reg,
llvm::MachineInstr* MI,
SmallVectorImpl<unsigned int>& Defs)
void HandlePhysRegDef(
llvm::Register Reg,
llvm::MachineInstr* MI,
SmallVectorImpl<unsigned int>& Defs)
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:158
Parameters
- llvm::Register Reg
- llvm::MachineInstr* MI
- SmallVectorImpl<unsigned int>& Defs
¶bool HandlePhysRegKill(llvm::Register Reg,
llvm::MachineInstr* MI)
bool HandlePhysRegKill(llvm::Register Reg,
llvm::MachineInstr* MI)
Description
HandlePhysRegKill - Add kills of Reg and its sub-registers to the uses. Pay special attention to the sub-register uses which may come below the last use of the whole register.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:152
Parameters
- llvm::Register Reg
- llvm::MachineInstr* MI
¶void HandlePhysRegUse(llvm::Register Reg,
llvm::MachineInstr& MI)
void HandlePhysRegUse(llvm::Register Reg,
llvm::MachineInstr& MI)
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:157
Parameters
- llvm::Register Reg
- llvm::MachineInstr& MI
¶void HandleRegMask(const llvm::MachineOperand&)
void HandleRegMask(const llvm::MachineOperand&)
Description
HandleRegMask - Call HandlePhysRegKill for all registers clobbered by Mask.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:155
Parameters
- const llvm::MachineOperand&
¶void HandleVirtRegDef(llvm::Register reg,
llvm::MachineInstr& MI)
void HandleVirtRegDef(llvm::Register reg,
llvm::MachineInstr& MI)
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:285
Parameters
- llvm::Register reg
- llvm::MachineInstr& MI
¶void HandleVirtRegUse(
llvm::Register reg,
llvm::MachineBasicBlock* MBB,
llvm::MachineInstr& MI)
void HandleVirtRegUse(
llvm::Register reg,
llvm::MachineBasicBlock* MBB,
llvm::MachineInstr& MI)
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:286
Parameters
¶LiveVariables()
LiveVariables()
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:50
¶void MarkVirtRegAliveInBlock(
llvm::LiveVariables::VarInfo& VRInfo,
llvm::MachineBasicBlock* DefBlock,
llvm::MachineBasicBlock* BB,
SmallVectorImpl<llvm::MachineBasicBlock*>&
WorkList)
void MarkVirtRegAliveInBlock(
llvm::LiveVariables::VarInfo& VRInfo,
llvm::MachineBasicBlock* DefBlock,
llvm::MachineBasicBlock* BB,
SmallVectorImpl<llvm::MachineBasicBlock*>&
WorkList)
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:281
Parameters
- llvm::LiveVariables::VarInfo& VRInfo
- llvm::MachineBasicBlock* DefBlock
- llvm::MachineBasicBlock* BB
- SmallVectorImpl<llvm::MachineBasicBlock*>& WorkList
¶void MarkVirtRegAliveInBlock(
llvm::LiveVariables::VarInfo& VRInfo,
llvm::MachineBasicBlock* DefBlock,
llvm::MachineBasicBlock* BB)
void MarkVirtRegAliveInBlock(
llvm::LiveVariables::VarInfo& VRInfo,
llvm::MachineBasicBlock* DefBlock,
llvm::MachineBasicBlock* BB)
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:279
Parameters
- llvm::LiveVariables::VarInfo& VRInfo
- llvm::MachineBasicBlock* DefBlock
- llvm::MachineBasicBlock* BB
¶bool RegisterDefIsDead(llvm::MachineInstr& MI,
llvm::Register Reg) const
bool RegisterDefIsDead(llvm::MachineInstr& MI,
llvm::Register Reg) const
Description
RegisterDefIsDead - Return true if the specified instruction defines the specified register, but that definition is dead.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:187
Parameters
- llvm::MachineInstr& MI
- llvm::Register Reg
¶void UpdatePhysRegDefs(
llvm::MachineInstr& MI,
SmallVectorImpl<unsigned int>& Defs)
void UpdatePhysRegDefs(
llvm::MachineInstr& MI,
SmallVectorImpl<unsigned int>& Defs)
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:160
Parameters
- llvm::MachineInstr& MI
- SmallVectorImpl<unsigned int>& Defs
¶void addNewBlock(
llvm::MachineBasicBlock* BB,
llvm::MachineBasicBlock* DomBB,
llvm::MachineBasicBlock* SuccBB,
std::vector<SparseBitVector<>>& LiveInSets)
void addNewBlock(
llvm::MachineBasicBlock* BB,
llvm::MachineBasicBlock* DomBB,
llvm::MachineBasicBlock* SuccBB,
std::vector<SparseBitVector<>>& LiveInSets)
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:305
Parameters
- llvm::MachineBasicBlock* BB
- llvm::MachineBasicBlock* DomBB
- llvm::MachineBasicBlock* SuccBB
- std::vector<SparseBitVector<>>& LiveInSets
¶void addNewBlock(llvm::MachineBasicBlock* BB,
llvm::MachineBasicBlock* DomBB,
llvm::MachineBasicBlock* SuccBB)
void addNewBlock(llvm::MachineBasicBlock* BB,
llvm::MachineBasicBlock* DomBB,
llvm::MachineBasicBlock* SuccBB)
Description
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.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:301
Parameters
- llvm::MachineBasicBlock* BB
- llvm::MachineBasicBlock* DomBB
- llvm::MachineBasicBlock* SuccBB
¶void addVirtualRegisterDead(
llvm::Register IncomingReg,
llvm::MachineInstr& MI,
bool AddIfNotFound = false)
void addVirtualRegisterDead(
llvm::Register IncomingReg,
llvm::MachineInstr& MI,
bool AddIfNotFound = false)
Description
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.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:242
Parameters
- llvm::Register IncomingReg
- llvm::MachineInstr& MI
- bool AddIfNotFound = false
¶void addVirtualRegisterKilled(
llvm::Register IncomingReg,
llvm::MachineInstr& MI,
bool AddIfNotFound = false)
void addVirtualRegisterKilled(
llvm::Register IncomingReg,
llvm::MachineInstr& MI,
bool AddIfNotFound = false)
Description
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.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:207
Parameters
- llvm::Register IncomingReg
- llvm::MachineInstr& MI
- bool AddIfNotFound = false
¶void analyzePHINodes(
const llvm::MachineFunction& Fn)
void analyzePHINodes(
const llvm::MachineFunction& Fn)
Description
analyzePHINodes - Gather information about the PHI nodes in here. In particular, we want to map the variable information of a virtual register which is used in a PHI node. We map that to the BB the vreg is coming from.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:176
Parameters
- const llvm::MachineFunction& Fn
¶void getAnalysisUsage(
llvm::AnalysisUsage& AU) const
void getAnalysisUsage(
llvm::AnalysisUsage& AU) const
Description
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this. For MachineFunctionPasses, calling AU.preservesCFG() indicates that the pass does not modify the MachineBasicBlock CFG.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:269
Parameters
¶llvm::LiveVariables::VarInfo& getVarInfo(
llvm::Register Reg)
llvm::LiveVariables::VarInfo& getVarInfo(
llvm::Register Reg)
Description
getVarInfo - Return the VarInfo structure for the specified VIRTUAL register.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:277
Parameters
- llvm::Register Reg
¶bool isLiveIn(llvm::Register Reg,
const llvm::MachineBasicBlock& MBB)
bool isLiveIn(llvm::Register Reg,
const llvm::MachineBasicBlock& MBB)
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:288
Parameters
- llvm::Register Reg
- const llvm::MachineBasicBlock& MBB
¶bool isLiveOut(llvm::Register Reg,
const llvm::MachineBasicBlock& MBB)
bool isLiveOut(llvm::Register Reg,
const llvm::MachineBasicBlock& MBB)
Description
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.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:295
Parameters
- llvm::Register Reg
- const llvm::MachineBasicBlock& MBB
¶bool isPHIJoin(llvm::Register Reg)
bool isPHIJoin(llvm::Register Reg)
Description
isPHIJoin - Return true if Reg is a phi join register.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:311
Parameters
- llvm::Register Reg
¶void recomputeForSingleDefVirtReg(
llvm::Register Reg)
void recomputeForSingleDefVirtReg(
llvm::Register Reg)
Description
Recompute liveness from scratch for a virtual register \p Reg that is known to have a single def that dominates all uses. This can be useful after removing some uses of \p Reg. It is not necessary for the whole machine function to be in SSA form.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:196
Parameters
- llvm::Register Reg
¶void releaseMemory()
void releaseMemory()
Description
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.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:271
¶bool removeVirtualRegisterDead(
llvm::Register Reg,
llvm::MachineInstr& MI)
bool removeVirtualRegisterDead(
llvm::Register Reg,
llvm::MachineInstr& MI)
Description
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.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:252
Parameters
- llvm::Register Reg
- llvm::MachineInstr& MI
¶bool removeVirtualRegisterKilled(
llvm::Register Reg,
llvm::MachineInstr& MI)
bool removeVirtualRegisterKilled(
llvm::Register Reg,
llvm::MachineInstr& MI)
Description
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.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:217
Parameters
- llvm::Register Reg
- llvm::MachineInstr& MI
¶void removeVirtualRegistersKilled(
llvm::MachineInstr& MI)
void removeVirtualRegistersKilled(
llvm::MachineInstr& MI)
Description
removeVirtualRegistersKilled - Remove all killed info for the specified instruction.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:237
Parameters
¶void replaceKillInstruction(
llvm::Register Reg,
llvm::MachineInstr& OldMI,
llvm::MachineInstr& NewMI)
void replaceKillInstruction(
llvm::Register Reg,
llvm::MachineInstr& OldMI,
llvm::MachineInstr& NewMI)
Description
replaceKillInstruction - Update register kill info by replacing a kill instruction with a new one.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:200
Parameters
- llvm::Register Reg
- llvm::MachineInstr& OldMI
- llvm::MachineInstr& NewMI
¶void runOnBlock(llvm::MachineBasicBlock* MBB,
unsigned int NumRegs)
void runOnBlock(llvm::MachineBasicBlock* MBB,
unsigned int NumRegs)
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:180
Parameters
- llvm::MachineBasicBlock* MBB
- unsigned int NumRegs
¶void runOnInstr(
llvm::MachineInstr& MI,
SmallVectorImpl<unsigned int>& Defs)
void runOnInstr(
llvm::MachineInstr& MI,
SmallVectorImpl<unsigned int>& Defs)
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:178
Parameters
- llvm::MachineInstr& MI
- SmallVectorImpl<unsigned int>& Defs
¶bool runOnMachineFunction(
llvm::MachineFunction& MF)
bool runOnMachineFunction(
llvm::MachineFunction& MF)
Description
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:183
Parameters
¶void setPHIJoin(llvm::Register Reg)
void setPHIJoin(llvm::Register Reg)
Description
setPHIJoin - Mark Reg as a phi join register.
Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:314
Parameters
- llvm::Register Reg