17 #ifndef LLVM_CODEGEN_REGISTERSCAVENGING_H
18 #define LLVM_CODEGEN_REGISTERSCAVENGING_H
26 class MachineRegisterInfo;
27 class TargetRegisterInfo;
28 class TargetInstrInfo;
29 class TargetRegisterClass;
43 struct ScavengedInfo {
44 ScavengedInfo(
int FI = -1) :
FrameIndex(FI),
Reg(0), Restore(
nullptr) {}
72 : MBB(nullptr), NumRegUnits(0), Tracking(
false) {}
112 bool isRegUsed(
unsigned Reg,
bool includeReserved =
true)
const;
130 if (
I->FrameIndex == FI)
140 if (
I->FrameIndex >= 0)
158 bool isReserved(
unsigned Reg)
const {
return MRI->
isReserved(Reg); }
162 void setUsed(BitVector &RegUnits) {
163 RegUnitsAvailable.
reset(RegUnits);
165 void setUnused(BitVector &RegUnits) {
166 RegUnitsAvailable |= RegUnits;
171 void determineKillsAndDefs();
174 void addRegUnits(BitVector &BV,
unsigned Reg);
181 BitVector &Candidates,
void push_back(const T &Elt)
void skipTo(MachineBasicBlock::iterator I)
Move the internal MBB iterator but do not update register states.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Reg
All possible values of the reg field in the ModR/M byte.
MachineBasicBlock::iterator getCurrentPosition() const
void forward()
Move the internal MBB iterator and update register states.
BitVector getRegsAvailable(const TargetRegisterClass *RC)
Return all available registers in the register class in Mask.
void unprocess(MachineBasicBlock::iterator I)
Unprocess instructions until you reach the provided iterator.
void enterBasicBlock(MachineBasicBlock *mbb)
Start tracking liveness from the begin of the specific basic block.
TargetInstrInfo - Interface to description of machine instruction set.
bundle_iterator< MachineInstr, instr_iterator > iterator
bool isReserved(unsigned PhysReg) const
isReserved - Returns true when PhysReg is a reserved register.
bundle_iterator - MachineBasicBlock iterator that automatically skips over MIs that are inside bundle...
void unprocess()
Invert the behavior of forward() on the current instruction (undo the changes to the available regist...
void forward(MachineBasicBlock::iterator I)
Move the internal MBB iterator and update register states until it has processed the specific iterato...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
void getScavengingFrameIndices(SmallVectorImpl< int > &A) const
Get an array of scavenging frame indices.
bool isScavengingFrameIndex(int FI) const
Query whether a frame index is a scavenging frame index.
void addScavengingFrameIndex(int FI)
Add a scavenging frame index.
bool isRegUsed(unsigned Reg, bool includeReserved=true) const
Return if a specific register is currently used.
void setRegUsed(unsigned Reg)
Tell the scavenger a register is used.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
unsigned FindUnusedReg(const TargetRegisterClass *RegClass) const
Find an unused register of the specified register class.
unsigned scavengeRegister(const TargetRegisterClass *RegClass, int SPAdj)
void initRegState()
Allow resetting register state info for multiple passes over/within the same function.
unsigned scavengeRegister(const TargetRegisterClass *RegClass, MachineBasicBlock::iterator I, int SPAdj)
Make a register of the specific register class available and do the appropriate bookkeeping.