|
LLVM
4.0.0
|
#include <RegisterScavenging.h>
Public Member Functions | |
| RegScavenger () | |
| void | enterBasicBlock (MachineBasicBlock &MBB) |
Start tracking liveness from the begin of basic block MBB. More... | |
| void | enterBasicBlockEnd (MachineBasicBlock &MBB) |
Start tracking liveness from the end of basic block MBB. More... | |
| void | forward () |
| Move the internal MBB iterator and update register states. More... | |
| void | forward (MachineBasicBlock::iterator I) |
| Move the internal MBB iterator and update register states until it has processed the specific iterator. More... | |
| void | unprocess () |
| Invert the behavior of forward() on the current instruction (undo the changes to the available registers made by forward()). More... | |
| void | unprocess (MachineBasicBlock::iterator I) |
| Unprocess instructions until you reach the provided iterator. More... | |
| void | backward () |
| Update internal register state and move MBB iterator backwards. More... | |
| void | backward (MachineBasicBlock::iterator I) |
Call backward() as long as the internal iterator does not point to I. More... | |
| void | skipTo (MachineBasicBlock::iterator I) |
| Move the internal MBB iterator but do not update register states. More... | |
| MachineBasicBlock::iterator | getCurrentPosition () const |
| bool | isRegUsed (unsigned Reg, bool includeReserved=true) const |
| Return if a specific register is currently used. More... | |
| BitVector | getRegsAvailable (const TargetRegisterClass *RC) |
| Return all available registers in the register class in Mask. More... | |
| unsigned | FindUnusedReg (const TargetRegisterClass *RegClass) const |
| Find an unused register of the specified register class. More... | |
| void | addScavengingFrameIndex (int FI) |
| Add a scavenging frame index. More... | |
| bool | isScavengingFrameIndex (int FI) const |
| Query whether a frame index is a scavenging frame index. More... | |
| void | getScavengingFrameIndices (SmallVectorImpl< int > &A) const |
| Get an array of scavenging frame indices. More... | |
| unsigned | scavengeRegister (const TargetRegisterClass *RegClass, MachineBasicBlock::iterator I, int SPAdj) |
| Make a register of the specific register class available and do the appropriate bookkeeping. More... | |
| unsigned | scavengeRegister (const TargetRegisterClass *RegClass, int SPAdj) |
| void | setRegUsed (unsigned Reg, LaneBitmask LaneMask=LaneBitmask::getAll()) |
| Tell the scavenger a register is used. More... | |
Definition at line 32 of file RegisterScavenging.h.
|
inline |
Definition at line 72 of file RegisterScavenging.h.
|
inline |
Add a scavenging frame index.
Definition at line 134 of file RegisterScavenging.h.
References llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
Referenced by llvm::PPCFrameLowering::addScavengingSpillSlot(), llvm::MipsSEFrameLowering::determineCalleeSaves(), llvm::ARMFrameLowering::determineCalleeSaves(), llvm::HexagonFrameLowering::determineCalleeSaves(), llvm::AArch64FrameLowering::determineCalleeSaves(), llvm::SIFrameLowering::processFunctionBeforeFrameFinalized(), llvm::SystemZFrameLowering::processFunctionBeforeFrameFinalized(), and llvm::XCoreFrameLowering::processFunctionBeforeFrameFinalized().
| void RegScavenger::backward | ( | ) |
Update internal register state and move MBB iterator backwards.
Contrary to unprocess() this method gives precise results even in the absence of kill flags.
Definition at line 262 of file RegisterScavenging.cpp.
References assert(), llvm::MachineBasicBlock::begin(), llvm::MCRegisterInfo::getNumRegUnits(), llvm::MCRegUnitRootIterator::isValid(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::MachineInstr::operands(), llvm::BitVector::set(), and llvm::MachineInstr::uses().
Referenced by backward().
|
inline |
Call backward() as long as the internal iterator does not point to I.
Definition at line 109 of file RegisterScavenging.h.
References backward().
| void RegScavenger::enterBasicBlock | ( | MachineBasicBlock & | MBB | ) |
Start tracking liveness from the begin of basic block MBB.
Definition at line 83 of file RegisterScavenging.cpp.
Referenced by llvm::SIInstrInfo::calculateLDSSpillAddress(), doScavengeFrameVirtualRegs(), and llvm::Mips16InstrInfo::loadImmediate().
| void RegScavenger::enterBasicBlockEnd | ( | MachineBasicBlock & | MBB | ) |
Start tracking liveness from the end of basic block MBB.
Use backward() to move towards the beginning of the block. This is preferred to enterBasicBlock() and forward() because it does not depend on the presence of kill flags.
Definition at line 88 of file RegisterScavenging.cpp.
References llvm::MachineBasicBlock::begin(), llvm::MachineBasicBlock::end(), and llvm::MachineBasicBlock::successors().
Referenced by llvm::SIInstrInfo::insertIndirectBranch().
| unsigned RegScavenger::FindUnusedReg | ( | const TargetRegisterClass * | RegClass | ) | const |
Find an unused register of the specified register class.
Return 0 if none is found.
Definition at line 313 of file RegisterScavenging.cpp.
References llvm::dbgs(), DEBUG, llvm::MCRegisterInfo::getName(), and isRegUsed().
Referenced by llvm::LanaiRegisterInfo::eliminateFrameIndex().
| void RegScavenger::forward | ( | ) |
Move the internal MBB iterator and update register states.
Definition at line 177 of file RegisterScavenging.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::MachineBasicBlock::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::getParent(), I, llvm::ARM_PROC::IE, llvm::TargetRegisterInfo::isPhysicalRegister(), isRegUsed(), llvm::MCRegisterInfo::DiffListIterator::isValid(), llvm_unreachable, and llvm::MachineFunction::verify().
Referenced by doScavengeFrameVirtualRegs(), forward(), and llvm::Mips16InstrInfo::loadImmediate().
|
inline |
Move the internal MBB iterator and update register states until it has processed the specific iterator.
Definition at line 89 of file RegisterScavenging.h.
References llvm::MachineBasicBlock::begin(), forward(), and I.
|
inline |
Definition at line 121 of file RegisterScavenging.h.
Referenced by doScavengeFrameVirtualRegs().
| BitVector RegScavenger::getRegsAvailable | ( | const TargetRegisterClass * | RC | ) |
Return all available registers in the register class in Mask.
Definition at line 324 of file RegisterScavenging.cpp.
References llvm::MCRegisterInfo::getNumRegs(), isRegUsed(), and llvm::BitmaskEnumDetail::Mask().
Referenced by llvm::Mips16InstrInfo::loadImmediate(), and scavengeRegister().
|
inline |
Get an array of scavenging frame indices.
Definition at line 149 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().
Return if a specific register is currently used.
Definition at line 304 of file RegisterScavenging.cpp.
References llvm::MCRegisterInfo::DiffListIterator::isValid(), and llvm::BitVector::test().
Referenced by FindUnusedReg(), forward(), getRegsAvailable(), llvm::SIRegisterInfo::restoreSGPR(), scavengeRegister(), and llvm::SIRegisterInfo::spillSGPR().
|
inline |
Query whether a frame index is a scavenging frame index.
Definition at line 139 of file RegisterScavenging.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), I, and llvm::ARM_PROC::IE.
Referenced by llvm::ThumbRegisterInfo::eliminateFrameIndex(), llvm::AArch64RegisterInfo::eliminateFrameIndex(), and llvm::ARMBaseRegisterInfo::eliminateFrameIndex().
| unsigned RegScavenger::scavengeRegister | ( | const TargetRegisterClass * | RegClass, |
| MachineBasicBlock::iterator | I, | ||
| int | SPAdj | ||
| ) |
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 405 of file RegisterScavenging.cpp.
References A, llvm::BitVector::any(), D, llvm::dbgs(), DEBUG, llvm::TargetRegisterInfo::eliminateFrameIndex(), llvm::ISD::FrameIndex, llvm::TargetRegisterClass::getAlignment(), llvm::TargetRegisterInfo::getAllocatableSet(), getFrameIndexOperandNum(), llvm::MachineFunction::getFrameInfo(), llvm::MCRegisterInfo::getName(), llvm::MachineFrameInfo::getObjectAlignment(), llvm::MachineFrameInfo::getObjectIndexBegin(), llvm::MachineFrameInfo::getObjectIndexEnd(), llvm::MachineFrameInfo::getObjectSize(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::getParent(), llvm::TargetRegisterInfo::getRegClassName(), getRegsAvailable(), llvm::TargetRegisterClass::getSize(), I, isRegUsed(), llvm::MCRegAliasIterator::isValid(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::TargetInstrInfo::loadRegFromStackSlot(), llvm::MachineInstr::operands(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::report_fatal_error(), llvm::BitVector::reset(), llvm::TargetRegisterInfo::saveScavengerRegister(), SI, llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::TargetInstrInfo::storeRegToStackSlot(), and UseMI.
Referenced by llvm::SIInstrInfo::calculateLDSSpillAddress(), doScavengeFrameVirtualRegs(), llvm::LanaiRegisterInfo::eliminateFrameIndex(), InsertFPConstInst(), llvm::SIInstrInfo::insertIndirectBranch(), InsertSPConstInst(), and scavengeRegister().
|
inline |
Definition at line 162 of file RegisterScavenging.h.
References scavengeRegister().
| void RegScavenger::setRegUsed | ( | unsigned | Reg, |
| LaneBitmask | LaneMask = LaneBitmask::getAll() |
||
| ) |
Tell the scavenger a register is used.
Definition at line 34 of file RegisterScavenging.cpp.
References llvm::MCRegUnitMaskIterator::isValid(), llvm::LaneBitmask::none(), and llvm::BitVector::reset().
Referenced by doScavengeFrameVirtualRegs(), InsertFPConstInst(), llvm::SIInstrInfo::insertIndirectBranch(), and InsertSPConstInst().
|
inline |
Move the internal MBB iterator but do not update register states.
Definition at line 115 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 158 of file RegisterScavenging.cpp.
References assert(), llvm::MachineBasicBlock::begin(), and llvm::MachineInstr::isDebugValue().
Referenced by doScavengeFrameVirtualRegs(), and unprocess().
|
inline |
Unprocess instructions until you reach the provided iterator.
Definition at line 99 of file RegisterScavenging.h.
References unprocess().
1.8.6