LLVM API Documentation
A set of live physical registers with functions to track liveness when walking backward/forward through a basic block. More...
#include <LivePhysRegs.h>
Public Types | |
typedef SparseSet< unsigned > ::const_iterator | const_iterator |
Public Member Functions | |
LivePhysRegs () | |
Constructs a new empty LivePhysRegs set. | |
LivePhysRegs (const TargetRegisterInfo *TRI) | |
Constructs and initialize an empty LivePhysRegs set. | |
void | init (const TargetRegisterInfo *_TRI) |
Clear and initialize the LivePhysRegs set. | |
void | clear () |
Clears the LivePhysRegs set. | |
bool | empty () const |
Returns true if the set is empty. | |
void | addReg (unsigned Reg) |
Adds a physical register and all its sub-registers to the set. | |
void | removeReg (unsigned Reg) |
Removes a physical register, all its sub-registers, and all its super-registers from the set. | |
void | removeRegsInMask (const MachineOperand &MO) |
Removes physical registers clobbered by the regmask operand MO . | |
bool | contains (unsigned Reg) const |
Returns true if register Reg is contained in the set. This also works if only the super register of Reg has been defined, because we always add also all sub-registers to the set. | |
void | stepBackward (const MachineInstr &MI) |
Simulates liveness when stepping backwards over an instruction(bundle): Remove Defs, add uses. This is the recommended way of calculating liveness. | |
void | stepForward (const MachineInstr &MI) |
Simulates liveness when stepping forward over an instruction(bundle): Remove killed-uses, add defs. This is the not recommended way, because it depends on accurate kill flags. If possible use stepBackwards() instead of this function. | |
void | addLiveIns (const MachineBasicBlock *MBB) |
Adds all live-in registers of basic block MBB . | |
void | addLiveOuts (const MachineBasicBlock *MBB) |
Adds all live-out registers of basic block MBB . | |
const_iterator | begin () const |
const_iterator | end () const |
void | print (raw_ostream &OS) const |
Prints the currently live registers to OS . | |
void | dump () const |
Dumps the currently live registers to the debug output. |
A set of live physical registers with functions to track liveness when walking backward/forward through a basic block.
Definition at line 43 of file LivePhysRegs.h.
Definition at line 128 of file LivePhysRegs.h.
llvm::LivePhysRegs::LivePhysRegs | ( | ) | [inline] |
Constructs a new empty LivePhysRegs set.
Definition at line 51 of file LivePhysRegs.h.
llvm::LivePhysRegs::LivePhysRegs | ( | const TargetRegisterInfo * | TRI | ) | [inline] |
Constructs and initialize an empty LivePhysRegs set.
Definition at line 54 of file LivePhysRegs.h.
References llvm::MCRegisterInfo::getNumRegs(), and llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::setUniverse().
void llvm::LivePhysRegs::addLiveIns | ( | const MachineBasicBlock * | MBB | ) | [inline] |
Adds all live-in registers of basic block MBB
.
Definition at line 115 of file LivePhysRegs.h.
References addReg(), llvm::AArch64CC::LE, LI, llvm::MachineBasicBlock::livein_begin(), and llvm::MachineBasicBlock::livein_end().
Referenced by addLiveOuts().
void llvm::LivePhysRegs::addLiveOuts | ( | const MachineBasicBlock * | MBB | ) | [inline] |
Adds all live-out registers of basic block MBB
.
Definition at line 122 of file LivePhysRegs.h.
References addLiveIns(), llvm::MachineBasicBlock::succ_begin(), and llvm::MachineBasicBlock::succ_end().
void llvm::LivePhysRegs::addReg | ( | unsigned | Reg | ) | [inline] |
Adds a physical register and all its sub-registers to the set.
Definition at line 74 of file LivePhysRegs.h.
References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::insert(), and llvm::MCRegisterInfo::DiffListIterator::isValid().
Referenced by addLiveIns(), stepBackward(), stepForward(), and UpdatePredRedefs().
const_iterator llvm::LivePhysRegs::begin | ( | ) | const [inline] |
Definition at line 129 of file LivePhysRegs.h.
References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::begin().
Referenced by print().
void llvm::LivePhysRegs::clear | ( | ) | [inline] |
Clears the LivePhysRegs set.
Definition at line 68 of file LivePhysRegs.h.
References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::clear().
bool llvm::LivePhysRegs::contains | ( | unsigned | Reg | ) | const [inline] |
Returns true if register Reg
is contained in the set. This also works if only the super register of Reg
has been defined, because we always add also all sub-registers to the set.
Definition at line 101 of file LivePhysRegs.h.
References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::count().
Referenced by RemoveKills(), and UpdatePredRedefs().
void LivePhysRegs::dump | ( | ) | const |
Dumps the currently live registers to the debug output.
Definition at line 110 of file LivePhysRegs.cpp.
References llvm::dbgs().
bool llvm::LivePhysRegs::empty | ( | ) | const [inline] |
Returns true if the set is empty.
Definition at line 71 of file LivePhysRegs.h.
References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::empty().
Referenced by print().
const_iterator llvm::LivePhysRegs::end | ( | ) | const [inline] |
Definition at line 130 of file LivePhysRegs.h.
References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::end().
Referenced by print().
void llvm::LivePhysRegs::init | ( | const TargetRegisterInfo * | _TRI | ) | [inline] |
Clear and initialize the LivePhysRegs set.
Definition at line 60 of file LivePhysRegs.h.
References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::clear(), llvm::MCRegisterInfo::getNumRegs(), and llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::setUniverse().
void LivePhysRegs::print | ( | raw_ostream & | OS | ) | const |
Prints the currently live registers to OS
.
Prin the currently live registers to OS.
Definition at line 92 of file LivePhysRegs.cpp.
References begin(), empty(), end(), and I.
Referenced by llvm::operator<<().
void llvm::LivePhysRegs::removeReg | ( | unsigned | Reg | ) | [inline] |
Removes a physical register, all its sub-registers, and all its super-registers from the set.
Definition at line 84 of file LivePhysRegs.h.
References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::erase(), and llvm::MCRegisterInfo::DiffListIterator::isValid().
Referenced by stepBackward(), stepForward(), and UpdatePredRedefs().
void LivePhysRegs::removeRegsInMask | ( | const MachineOperand & | MO | ) |
Removes physical registers clobbered by the regmask operand MO
.
Remove all registers from the set that get clobbered by the register mask.
Definition at line 24 of file LivePhysRegs.cpp.
References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::begin(), llvm::MachineOperand::clobbersPhysReg(), llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::end(), and llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::erase().
Referenced by stepBackward(), and stepForward().
void LivePhysRegs::stepBackward | ( | const MachineInstr & | MI | ) |
Simulates liveness when stepping backwards over an instruction(bundle): Remove Defs, add uses. This is the recommended way of calculating liveness.
Definition at line 36 of file LivePhysRegs.cpp.
References addReg(), llvm::MachineOperandIteratorBase::isValid(), removeReg(), and removeRegsInMask().
void LivePhysRegs::stepForward | ( | const MachineInstr & | MI | ) |
Simulates liveness when stepping forward over an instruction(bundle): Remove killed-uses, add defs. This is the not recommended way, because it depends on accurate kill flags. If possible use stepBackwards() instead of this function.
Definition at line 65 of file LivePhysRegs.cpp.
References addReg(), llvm::MachineOperandIteratorBase::isValid(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), removeReg(), removeRegsInMask(), and llvm::SmallVectorTemplateCommon< T, typename >::size().