LLVM API Documentation
#include <RegisterScavenging.h>
Classes | |
struct | ScavengedInfo |
Information on scavenged registers (held in a spill slot). | |
Public Member Functions | |
RegScavenger () | |
void | enterBasicBlock (MachineBasicBlock *mbb) |
void | initRegState () |
void | forward () |
forward - Move the internal MBB iterator and update register states. | |
void | forward (MachineBasicBlock::iterator I) |
void | unprocess () |
void | unprocess (MachineBasicBlock::iterator I) |
Unprocess instructions until you reach the provided iterator. | |
void | skipTo (MachineBasicBlock::iterator I) |
skipTo - Move the internal MBB iterator but do not update register states. | |
MachineBasicBlock::iterator | getCurrentPosition () const |
bool | isRegUsed (unsigned Reg, bool includeReserved=true) const |
isRegUsed - return if a specific register is currently used. | |
BitVector | getRegsAvailable (const TargetRegisterClass *RC) |
unsigned | FindUnusedReg (const TargetRegisterClass *RegClass) const |
void | addScavengingFrameIndex (int FI) |
Add a scavenging frame index. | |
bool | isScavengingFrameIndex (int FI) const |
Query whether a frame index is a scavenging frame index. | |
void | getScavengingFrameIndices (SmallVectorImpl< int > &A) const |
Get an array of scavenging frame indices. | |
unsigned | scavengeRegister (const TargetRegisterClass *RegClass, MachineBasicBlock::iterator I, int SPAdj) |
unsigned | scavengeRegister (const TargetRegisterClass *RegClass, int SPAdj) |
void | setRegUsed (unsigned Reg) |
setUsed - Set the register units of this register as used. |
Definition at line 31 of file RegisterScavenging.h.
llvm::RegScavenger::RegScavenger | ( | ) | [inline] |
Definition at line 72 of file RegisterScavenging.h.
void llvm::RegScavenger::addScavengingFrameIndex | ( | int | FI | ) | [inline] |
Add a scavenging frame index.
Definition at line 125 of file RegisterScavenging.h.
References llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
Referenced by llvm::PPCFrameLowering::addScavengingSpillSlot(), llvm::MipsSEFrameLowering::processFunctionBeforeCalleeSavedScan(), llvm::ARMFrameLowering::processFunctionBeforeCalleeSavedScan(), llvm::AArch64FrameLowering::processFunctionBeforeCalleeSavedScan(), llvm::SystemZFrameLowering::processFunctionBeforeFrameFinalized(), and llvm::XCoreFrameLowering::processFunctionBeforeFrameFinalized().
void RegScavenger::enterBasicBlock | ( | MachineBasicBlock * | mbb | ) |
enterBasicBlock - Start tracking liveness from the begin of the specific basic block.
Definition at line 64 of file RegisterScavenging.cpp.
References llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MCRegisterInfo::getNumRegUnits(), llvm::MachineBasicBlock::getParent(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::TargetMachine::getSubtargetImpl(), llvm::MachineFunction::getTarget(), initRegState(), llvm::BitVector::resize(), llvm::SystemZISD::TM, and llvm::MachineRegisterInfo::tracksLiveness().
Referenced by llvm::Mips16InstrInfo::loadImmediate().
unsigned RegScavenger::FindUnusedReg | ( | const TargetRegisterClass * | RegClass | ) | const |
FindUnusedReg - Find a unused register of the specified register class. Return 0 if none is found.
Definition at line 266 of file RegisterScavenging.cpp.
References llvm::TargetRegisterClass::begin(), llvm::dbgs(), DEBUG, llvm::TargetRegisterClass::end(), llvm::MCRegisterInfo::getName(), I, and isRegUsed().
void RegScavenger::forward | ( | ) |
forward - Move the internal MBB iterator and update register states.
Definition at line 171 of file RegisterScavenging.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::MachineBasicBlock::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), I, llvm::ARM_PROC::IE, llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), isRegUsed(), llvm::MachineOperand::isUndef(), llvm::MachineOperand::isUse(), llvm::MCRegisterInfo::DiffListIterator::isValid(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm_unreachable, and llvm::MachineFunction::verify().
Referenced by forward(), and llvm::Mips16InstrInfo::loadImmediate().
void llvm::RegScavenger::forward | ( | MachineBasicBlock::iterator | I | ) | [inline] |
forward - Move the internal MBB iterator and update register states until it has processed the specific iterator.
Definition at line 88 of file RegisterScavenging.h.
References llvm::MachineBasicBlock::begin(), forward(), and I.
MachineBasicBlock::iterator llvm::RegScavenger::getCurrentPosition | ( | ) | const [inline] |
Definition at line 109 of file RegisterScavenging.h.
getRegsAvailable - Return all available registers in the register class in Mask.
Definition at line 279 of file RegisterScavenging.cpp.
References llvm::TargetRegisterClass::begin(), llvm::TargetRegisterClass::end(), llvm::MCRegisterInfo::getNumRegs(), I, isRegUsed(), and llvm::BitVector::set().
Referenced by llvm::Mips16InstrInfo::loadImmediate(), and scavengeRegister().
void llvm::RegScavenger::getScavengingFrameIndices | ( | SmallVectorImpl< int > & | A | ) | const [inline] |
Get an array of scavenging frame indices.
Definition at line 140 of file RegisterScavenging.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), I, llvm::ARM_PROC::IE, and llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
void RegScavenger::initRegState | ( | ) |
initRegState - allow resetting register state info for multiple passes over/within the same function.
Definition at line 40 of file RegisterScavenging.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::BitVector::find_first(), llvm::BitVector::find_next(), llvm::MachineFunction::getFrameInfo(), llvm::MachineBasicBlock::getParent(), llvm::MachineFrameInfo::getPristineRegs(), I, llvm::ARM_PROC::IE, llvm::MachineBasicBlock::livein_begin(), llvm::MachineBasicBlock::livein_end(), llvm::BitVector::set(), and setRegUsed().
Referenced by enterBasicBlock().
bool RegScavenger::isRegUsed | ( | unsigned | Reg, |
bool | includeReserved = true |
||
) | const |
isRegUsed - return if a specific register is currently used.
Definition at line 257 of file RegisterScavenging.cpp.
References llvm::MCRegisterInfo::DiffListIterator::isValid(), and llvm::BitVector::test().
Referenced by FindUnusedReg(), forward(), getRegsAvailable(), and scavengeRegister().
bool llvm::RegScavenger::isScavengingFrameIndex | ( | int | FI | ) | const [inline] |
Query whether a frame index is a scavenging frame index.
Definition at line 130 of file RegisterScavenging.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), I, and llvm::ARM_PROC::IE.
Referenced by llvm::Thumb1RegisterInfo::eliminateFrameIndex(), llvm::AArch64RegisterInfo::eliminateFrameIndex(), and llvm::ARMBaseRegisterInfo::eliminateFrameIndex().
unsigned RegScavenger::scavengeRegister | ( | const TargetRegisterClass * | RegClass, |
MachineBasicBlock::iterator | I, | ||
int | SPAdj | ||
) |
scavengeRegister - Make a register of the specific register class available and do the appropriate bookkeeping. SPAdj is the stack adjustment due to call frame, it's passed along to eliminateFrameIndex(). Returns the scavenged register.
Definition at line 369 of file RegisterScavenging.cpp.
References llvm::BitVector::any(), llvm::dbgs(), DEBUG, llvm::TargetRegisterInfo::eliminateFrameIndex(), llvm::ISD::FrameIndex, llvm::TargetRegisterInfo::getAllocatableSet(), getFrameIndexOperandNum(), llvm::MCRegisterInfo::getName(), llvm::MachineOperand::getReg(), getRegsAvailable(), llvm::MachineOperand::isReg(), isRegUsed(), llvm::MachineOperand::isUndef(), llvm::MachineOperand::isUse(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::TargetInstrInfo::loadRegFromStackSlot(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::BitVector::reset(), llvm::TargetRegisterInfo::saveScavengerRegister(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::TargetInstrInfo::storeRegToStackSlot().
Referenced by llvm::SIRegisterInfo::eliminateFrameIndex(), InsertFPConstInst(), InsertSPConstInst(), and scavengeRegister().
unsigned llvm::RegScavenger::scavengeRegister | ( | const TargetRegisterClass * | RegClass, |
int | SPAdj | ||
) | [inline] |
Definition at line 153 of file RegisterScavenging.h.
References scavengeRegister().
void RegScavenger::setRegUsed | ( | unsigned | Reg | ) |
setUsed - Set the register units of this register as used.
setRegUsed - Tell the scavenger a register is used.
Definition at line 35 of file RegisterScavenging.cpp.
References llvm::MCRegisterInfo::DiffListIterator::isValid(), and llvm::BitVector::reset().
Referenced by initRegState(), InsertFPConstInst(), and InsertSPConstInst().
void llvm::RegScavenger::skipTo | ( | MachineBasicBlock::iterator | I | ) | [inline] |
skipTo - Move the internal MBB iterator but do not update register states.
Definition at line 103 of file RegisterScavenging.h.
References I.
void RegScavenger::unprocess | ( | ) |
Invert the behavior of forward() on the current instruction (undo the changes to the available registers made by forward()).
Definition at line 152 of file RegisterScavenging.cpp.
References llvm::MachineBasicBlock::begin(), and llvm::MachineInstr::isDebugValue().
Referenced by unprocess().
void llvm::RegScavenger::unprocess | ( | MachineBasicBlock::iterator | I | ) | [inline] |
Unprocess instructions until you reach the provided iterator.
Definition at line 98 of file RegisterScavenging.h.
References unprocess().