LLVM 20.0.0git
|
A set of register units used to track register liveness. More...
#include "llvm/CodeGen/LiveRegUnits.h"
Public Member Functions | |
LiveRegUnits ()=default | |
Constructs a new empty LiveRegUnits set. | |
LiveRegUnits (const TargetRegisterInfo &TRI) | |
Constructs and initialize an empty LiveRegUnits set. | |
void | init (const TargetRegisterInfo &TRI) |
Initialize and clear the set. | |
void | clear () |
Clears the set. | |
bool | empty () const |
Returns true if the set is empty. | |
void | addReg (MCPhysReg Reg) |
Adds register units covered by physical register Reg . | |
void | addRegMasked (MCPhysReg Reg, LaneBitmask Mask) |
Adds register units covered by physical register Reg that are part of the lanemask Mask . | |
void | removeReg (MCPhysReg Reg) |
Removes all register units covered by physical register Reg . | |
void | removeRegsNotPreserved (const uint32_t *RegMask) |
Removes register units not preserved by the regmask RegMask . | |
void | addRegsInMask (const uint32_t *RegMask) |
Adds register units not preserved by the regmask RegMask . | |
bool | available (MCPhysReg Reg) const |
Returns true if no part of physical register Reg is live. | |
void | stepBackward (const MachineInstr &MI) |
Updates liveness when stepping backwards over the instruction MI . | |
void | accumulate (const MachineInstr &MI) |
Adds all register units used, defined or clobbered in MI . | |
void | addLiveOuts (const MachineBasicBlock &MBB) |
Adds registers living out of block MBB . | |
void | addLiveIns (const MachineBasicBlock &MBB) |
Adds registers living into block MBB . | |
void | addUnits (const BitVector &RegUnits) |
Adds all register units marked in the bitvector RegUnits . | |
void | removeUnits (const BitVector &RegUnits) |
Removes all register units marked in the bitvector RegUnits . | |
const BitVector & | getBitVector () const |
Return the internal bitvector representation of the set. | |
Static Public Member Functions | |
static void | accumulateUsedDefed (const MachineInstr &MI, LiveRegUnits &ModifiedRegUnits, LiveRegUnits &UsedRegUnits, const TargetRegisterInfo *TRI) |
For a machine instruction MI , adds all register units used in UsedRegUnits and defined or clobbered in ModifiedRegUnits . | |
A set of register units used to track register liveness.
Definition at line 30 of file LiveRegUnits.h.
|
default |
Constructs a new empty LiveRegUnits set.
|
inline |
Constructs and initialize an empty LiveRegUnits set.
Definition at line 39 of file LiveRegUnits.h.
void LiveRegUnits::accumulate | ( | const MachineInstr & | MI | ) |
Adds all register units used, defined or clobbered in MI
.
This is useful when walking over a range of instruction to find registers unused over the whole range.
Definition at line 69 of file LiveRegUnits.cpp.
References addReg(), addRegsInMask(), and MI.
Referenced by canRenameUntilSecondLoad(), canRenameUpToDef(), and llvm::ARMBaseInstrInfo::isMBBSafeToOutlineFrom().
|
inlinestatic |
For a machine instruction MI
, adds all register units used in UsedRegUnits
and defined or clobbered in ModifiedRegUnits
.
This is useful when walking over a range of instructions to track registers used or defined separately.
Definition at line 47 of file LiveRegUnits.h.
References addReg(), addRegsInMask(), assert(), MI, Reg, and TRI.
Referenced by llvm::HexagonRegisterInfo::eliminateFrameIndex(), and INITIALIZE_PASS().
void LiveRegUnits::addLiveIns | ( | const MachineBasicBlock & | MBB | ) |
Adds registers living into block MBB
.
Definition at line 155 of file LiveRegUnits.cpp.
References addBlockLiveIns(), llvm::MachineBasicBlock::getParent(), and MBB.
Referenced by llvm::SIFrameLowering::emitPrologue(), llvm::RegScavenger::enterBasicBlock(), and initLiveUnits().
void LiveRegUnits::addLiveOuts | ( | const MachineBasicBlock & | MBB | ) |
Adds registers living out of block MBB
.
Live out registers are the union of the live-in registers of the successor blocks and pristine registers. Live out registers of the end block are the callee saved registers.
Definition at line 138 of file LiveRegUnits.cpp.
References addBlockLiveIns(), addCalleeSavedRegs(), llvm::MachineFunction::getFrameInfo(), llvm::MachineBasicBlock::getParent(), llvm::MachineFrameInfo::isCalleeSavedInfoValid(), llvm::MachineBasicBlock::isReturnBlock(), MBB, and llvm::MachineBasicBlock::successors().
Referenced by llvm::Thumb1InstrInfo::copyPhysReg(), llvm::RegScavenger::enterBasicBlockEnd(), llvm::ScheduleDAGInstrs::fixupKills(), llvm::ReachingDefAnalysis::getLiveOuts(), llvm::ReachingDefAnalysis::getLocalLiveOutMIDef(), llvm::AArch64InstrInfo::getOutlinableRanges(), initLiveUnits(), llvm::ARMBaseInstrInfo::isMBBSafeToOutlineFrom(), llvm::ReachingDefAnalysis::isReachingDefLiveOut(), llvm::ReachingDefAnalysis::isRegUsedAfter(), and llvm::SystemZInstrInfo::prepareCompareSwapOperands().
|
inline |
Adds register units covered by physical register Reg
.
Definition at line 86 of file LiveRegUnits.h.
References Reg, llvm::BitVector::set(), and TRI.
Referenced by accumulate(), accumulateUsedDefed(), addCalleeSavedRegs(), buildPrologSpill(), buildScratchExecCopy(), llvm::SIFrameLowering::determinePrologEpilogSGPRSaves(), llvm::SIFrameLowering::emitCSRSpillStores(), llvm::SIFrameLowering::emitEpilogue(), llvm::SIFrameLowering::emitPrologue(), findScratchNonCalleeSaveRegister(), getVGPRSpillLaneOrTempRegister(), stepBackward(), toggleKills(), tryToFindRegisterToRename(), and updateDefinedRegisters().
|
inline |
Adds register units covered by physical register Reg
that are part of the lanemask Mask
.
Definition at line 93 of file LiveRegUnits.h.
References Reg, llvm::BitVector::set(), and TRI.
Referenced by addBlockLiveIns(), and llvm::RegScavenger::setRegUsed().
Adds register units not preserved by the regmask RegMask
.
The regmask has the same format as the one in the RegMask machine operand.
Definition at line 33 of file LiveRegUnits.cpp.
References llvm::MachineOperand::clobbersPhysReg(), llvm::MCRegisterInfo::getNumRegUnits(), llvm::MCRegUnitRootIterator::isValid(), and llvm::BitVector::set().
Referenced by accumulate(), and accumulateUsedDefed().
Adds all register units marked in the bitvector RegUnits
.
Definition at line 144 of file LiveRegUnits.h.
Returns true if no part of physical register Reg
is live.
Definition at line 116 of file LiveRegUnits.h.
References Reg, llvm::BitVector::test(), and TRI.
Referenced by llvm::SIRegisterInfo::buildSpillLoadStore(), clearKillFlags(), llvm::Thumb1InstrInfo::copyPhysReg(), findScratchNonCalleeSaveRegister(), findSurvivorBackwards(), findTemporariesForLR(), findUnusedRegister(), llvm::ReachingDefAnalysis::getLiveOuts(), llvm::ReachingDefAnalysis::getLocalLiveOutMIDef(), llvm::AArch64InstrInfo::getOutlinableRanges(), hasRegisterDependency(), INITIALIZE_PASS(), llvm::outliner::Candidate::isAnyUnavailableAcrossOrOutOfSeq(), llvm::outliner::Candidate::isAvailableAcrossAndOutOfSeq(), llvm::outliner::Candidate::isAvailableInsideSeq(), llvm::ARMBaseInstrInfo::isMBBSafeToOutlineFrom(), llvm::ReachingDefAnalysis::isReachingDefLiveOut(), llvm::RegScavenger::isRegUsed(), llvm::ReachingDefAnalysis::isRegUsedAfter(), llvm::SystemZInstrInfo::prepareCompareSwapOperands(), toggleKills(), and tryToFindRegisterToRename().
|
inline |
Clears the set.
Definition at line 80 of file LiveRegUnits.h.
References llvm::BitVector::reset().
Referenced by INITIALIZE_PASS().
|
inline |
Returns true if the set is empty.
Definition at line 83 of file LiveRegUnits.h.
References llvm::BitVector::none().
Referenced by llvm::SIFrameLowering::emitCSRSpillStores(), llvm::SIFrameLowering::emitPrologue(), and initLiveUnits().
Return the internal bitvector representation of the set.
Definition at line 152 of file LiveRegUnits.h.
|
inline |
Initialize and clear the set.
Definition at line 73 of file LiveRegUnits.h.
References llvm::BitVector::reset(), llvm::BitVector::resize(), and TRI.
Referenced by llvm::SIFrameLowering::determinePrologEpilogSGPRSaves(), llvm::SIFrameLowering::emitPrologue(), llvm::ScheduleDAGInstrs::fixupKills(), initLiveUnits(), and LiveRegUnits().
|
inline |
Removes all register units covered by physical register Reg
.
Definition at line 102 of file LiveRegUnits.h.
References Reg, llvm::BitVector::reset(), and TRI.
Referenced by buildPrologSpill(), llvm::SIFrameLowering::emitPrologue(), llvm::ScheduleDAGInstrs::fixupKills(), llvm::RegScavenger::scavengeRegisterBackwards(), stepBackward(), and updateDefinedRegisters().
Removes register units not preserved by the regmask RegMask
.
The regmask has the same format as the one in the RegMask machine operand.
Definition at line 22 of file LiveRegUnits.cpp.
References llvm::MachineOperand::clobbersPhysReg(), llvm::MCRegisterInfo::getNumRegUnits(), llvm::MCRegUnitRootIterator::isValid(), and llvm::BitVector::reset().
Referenced by llvm::ScheduleDAGInstrs::fixupKills(), and stepBackward().
Removes all register units marked in the bitvector RegUnits
.
Definition at line 148 of file LiveRegUnits.h.
References llvm::BitVector::reset().
void LiveRegUnits::stepBackward | ( | const MachineInstr & | MI | ) |
Updates liveness when stepping backwards over the instruction MI
.
This removes all register units defined or clobbered in MI
and then adds the units used (as in use operands) in MI
.
Definition at line 44 of file LiveRegUnits.cpp.
References addReg(), MI, removeReg(), and removeRegsNotPreserved().
Referenced by llvm::RegScavenger::backward(), llvm::Thumb1InstrInfo::copyPhysReg(), llvm::AArch64InstrInfo::getOutlinableRanges(), initLiveUnits(), and llvm::ReachingDefAnalysis::isRegUsedAfter().