LLVM
8.0.1
|
VarInfo - This represents the regions where a virtual register is live in the program. More...
#include "llvm/CodeGen/LiveVariables.h"
Public Member Functions | |
bool | removeKill (MachineInstr &MI) |
removeKill - Delete a kill corresponding to the specified machine instruction. More... | |
MachineInstr * | findKill (const MachineBasicBlock *MBB) const |
findKill - Find a kill instruction in MBB. Return NULL if none is found. More... | |
bool | isLiveIn (const MachineBasicBlock &MBB, unsigned Reg, MachineRegisterInfo &MRI) |
isLiveIn - Is Reg live in to MBB? This means that Reg is live through MBB, or it is killed in MBB. More... | |
void | dump () const |
Public Attributes | |
SparseBitVector | AliveBlocks |
AliveBlocks - Set of blocks in which this value is alive completely through. More... | |
std::vector< MachineInstr * > | Kills |
Kills - List of MachineInstruction's which are the last use of this virtual register (kill it) in their basic block. More... | |
VarInfo - This represents the regions where a virtual register is live in the program.
We represent this with three different pieces of information: the set of blocks in which the instruction is live throughout, the set of blocks in which the instruction is actually used, and the set of non-phi instructions that are the last users of the value.
In the common case where a value is defined and killed in the same block, There is one killing instruction, and AliveBlocks is empty.
Otherwise, the value is live out of the block. If the value is live throughout any blocks, these blocks are listed in AliveBlocks. Blocks where the liveness range ends are not included in AliveBlocks, instead being captured by the Kills set. In these blocks, the value is live into the block (unless the value is defined and killed in the same block) and lives until the specified instruction. Note that there cannot ever be a value whose Kills set contains two instructions from the same basic block.
PHI nodes complicate things a bit. If a PHI node is the last user of a value in one of its predecessor blocks, it is not listed in the kills set, but does include the predecessor block in the AliveBlocks set (unless that block also defines the value). This leads to the (perfectly sensical) situation where a value is defined in a block, and the last use is a phi node in the successor. In this case, AliveBlocks is empty (the value is not live across any blocks) and Kills is empty (phi nodes are not included). This is sensical because the value must be live to the end of the block, but is not live in any successor blocks.
Definition at line 79 of file LiveVariables.h.
LLVM_DUMP_METHOD void LiveVariables::VarInfo::dump | ( | ) | const |
Definition at line 68 of file LiveVariables.cpp.
References AliveBlocks, llvm::SparseBitVector< ElementSize >::begin(), llvm::dbgs(), E, llvm::SparseBitVector< ElementSize >::end(), I, and Kills.
Referenced by removeKill().
MachineInstr * LiveVariables::VarInfo::findKill | ( | const MachineBasicBlock * | MBB | ) | const |
findKill - Find a kill instruction in MBB. Return NULL if none is found.
Definition at line 60 of file LiveVariables.cpp.
References getParent(), and Kills.
Referenced by allPhiOperandsUndefined(), isLiveIn(), regOverlapsSet(), and removeKill().
bool LiveVariables::VarInfo::isLiveIn | ( | const MachineBasicBlock & | MBB, |
unsigned | Reg, | ||
MachineRegisterInfo & | MRI | ||
) |
isLiveIn - Is Reg live in to MBB? This means that Reg is live through MBB, or it is killed in MBB.
If Reg is only used by PHI instructions in MBB, it is not considered live in.
Definition at line 722 of file LiveVariables.cpp.
References AliveBlocks, llvm::tgtok::Def, findKill(), llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getParent(), llvm::MachineRegisterInfo::getVRegDef(), and llvm::SparseBitVector< ElementSize >::test().
Referenced by llvm::LiveVariables::isLiveIn(), and removeKill().
|
inline |
removeKill - Delete a kill corresponding to the specified machine instruction.
Returns true if there was a kill corresponding to this instruction, false otherwise.
Definition at line 94 of file LiveVariables.h.
References dump(), llvm::find(), findKill(), I, isLiveIn(), MI, MRI, Reg, llvm::LiveVariables::RegisterDefIsDead(), llvm::LiveVariables::replaceKillInstruction(), llvm::LiveVariables::runOnMachineFunction(), and TRI.
Referenced by llvm::ARMBaseInstrInfo::convertToThreeAddress(), llvm::LiveVariables::removeVirtualRegisterDead(), llvm::LiveVariables::removeVirtualRegisterKilled(), llvm::LiveVariables::removeVirtualRegistersKilled(), and llvm::MachineBasicBlock::SplitCriticalEdge().
SparseBitVector llvm::LiveVariables::VarInfo::AliveBlocks |
AliveBlocks - Set of blocks in which this value is alive completely through.
This is a bit set which uses the basic block number as an index.
Definition at line 84 of file LiveVariables.h.
Referenced by llvm::LiveVariables::addNewBlock(), dump(), llvm::LiveVariables::HandleVirtRegDef(), llvm::LiveVariables::HandleVirtRegUse(), isLiveIn(), llvm::LiveVariables::isLiveOut(), llvm::LiveVariables::MarkVirtRegAliveInBlock(), and matchPair().
std::vector<MachineInstr*> llvm::LiveVariables::VarInfo::Kills |
Kills - List of MachineInstruction's which are the last use of this virtual register (kill it) in their basic block.
Definition at line 89 of file LiveVariables.h.
Referenced by llvm::LiveVariables::addNewBlock(), llvm::LiveVariables::addVirtualRegisterDead(), llvm::LiveVariables::addVirtualRegisterKilled(), llvm::X86InstrInfo::classifyLEAReg(), llvm::ARMBaseInstrInfo::convertToThreeAddress(), dump(), findKill(), llvm::LiveVariables::HandleVirtRegDef(), llvm::LiveVariables::HandleVirtRegUse(), llvm::LiveVariables::isLiveOut(), llvm::LiveVariables::MarkVirtRegAliveInBlock(), matchPair(), llvm::LiveVariables::replaceKillInstruction(), llvm::LiveVariables::runOnMachineFunction(), and llvm::MachineBasicBlock::SplitCriticalEdge().