LLVM API Documentation
#include <LiveVariables.h>
Definition at line 46 of file LiveVariables.h.
llvm::LiveVariables::LiveVariables | ( | ) | [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 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.
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::IndexedMap< T, ToIndexT >::grow(), and llvm::TargetRegisterInfo::isVirtualRegister().
Referenced by addNewBlock(), addVirtualRegisterDead(), addVirtualRegisterKilled(), llvm::ARMBaseInstrInfo::convertToThreeAddress(), HandleVirtRegDef(), HandleVirtRegUse(), isLiveIn(), isLiveOut(), removeVirtualRegisterDead(), removeVirtualRegisterKilled(), removeVirtualRegistersKilled(), replaceKillInstruction(), 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.
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::AArch64CC::MI, llvm::MachineBasicBlock::pred_begin(), llvm::MachineBasicBlock::pred_end(), and llvm::SparseBitVector< ElementSize >::test().
bool llvm::LiveVariables::isLiveIn | ( | unsigned | Reg, |
const MachineBasicBlock & | MBB | ||
) | [inline] |
Definition at line 285 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 738 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().
bool llvm::LiveVariables::isPHIJoin | ( | unsigned | Reg | ) | [inline] |
isPHIJoin - Return true if Reg is a phi join register.
Definition at line 303 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().
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.
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().
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 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().
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 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().
void LiveVariables::removeVirtualRegistersKilled | ( | MachineInstr * | MI | ) |
removeVirtualRegistersKilled - Remove all killed info for the specified instruction.
Definition at line 689 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 681 of file LiveVariables.cpp.
References getVarInfo(), and llvm::LiveVariables::VarInfo::Kills.
Referenced by finishConvertToThreeAddress().
bool LiveVariables::runOnMachineFunction | ( | MachineFunction & | MF | ) | [override, virtual] |
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.
Implements llvm::MachineFunctionPass.
Definition at line 620 of file LiveVariables.cpp.
References llvm::MachineFunction::begin(), llvm::SparseBitVector< ElementSize >::clear(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::depth_first_ext(), llvm::MachineFunction::end(), llvm::MachineFunction::getNumBlockIDs(), llvm::MCRegisterInfo::getNumRegs(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineRegisterInfo::getVRegDef(), llvm::TargetRegisterInfo::index2VirtReg(), llvm::MachineRegisterInfo::isSSA(), llvm::report_fatal_error(), and llvm::IndexedMap< T, ToIndexT >::size().
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().
char LiveVariables::ID = 0 [static] |
Definition at line 48 of file LiveVariables.h.