17 #ifndef LLVM_CODEGEN_REGISTERSCAVENGING_H 18 #define LLVM_CODEGEN_REGISTERSCAVENGING_H 30 class TargetInstrInfo;
31 class TargetRegisterClass;
32 class TargetRegisterInfo;
40 unsigned NumRegUnits = 0;
43 bool Tracking =
false;
46 struct ScavengedInfo {
140 if (
I->FrameIndex == FI)
150 if (
I->FrameIndex >= 0)
165 bool AllowSpill =
true);
167 bool AllowSpill =
true) {
182 bool RestoreAfter,
int SPAdj,
183 bool AllowSpill =
true);
194 void setUsed(
const BitVector &RegUnits) {
197 void setUnused(
const BitVector &RegUnits) {
203 void determineKillsAndDefs();
239 #endif // LLVM_CODEGEN_REGISTERSCAVENGING_H
A common definition of LaneBitmask for use in TableGen and CodeGen.
bool isScavengingFrameIndex(int FI) const
Query whether a frame index is a scavenging frame index.
void skipTo(MachineBasicBlock::iterator I)
Move the internal MBB iterator but do not update register states.
void backward(MachineBasicBlock::iterator I)
Call backward() as long as the internal iterator does not point to I.
bool isReserved(Register PhysReg) const
isReserved - Returns true when PhysReg is a reserved register.
This class represents lattice values for constants.
void push_back(const T &Elt)
void removeUnits(const BitVector &RegUnits)
Removes all register units marked in the bitvector RegUnits.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
static constexpr LaneBitmask getAll()
void backward()
Update internal register state and move MBB iterator backwards.
Register scavengeRegister(const TargetRegisterClass *RegClass, int SPAdj, bool AllowSpill=true)
void scavengeFrameVirtualRegs(MachineFunction &MF, RegScavenger &RS)
Replaces all frame index virtual registers with physical registers.
void setRegUsed(Register Reg, LaneBitmask LaneMask=LaneBitmask::getAll())
Tell the scavenger a register is used.
void forward()
Move the internal MBB iterator and update register states.
MachineBasicBlock::iterator getCurrentPosition() const
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.
TargetInstrInfo - Interface to description of machine instruction set.
MachineInstrBuilder & UseMI
bool isRegUsed(Register Reg, bool includeReserved=true) const
Return if a specific register is currently used.
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...
void addUnits(const BitVector &RegUnits)
Adds all register units marked in the bitvector RegUnits.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
void addScavengingFrameIndex(int FI)
Add a scavenging frame index.
void enterBasicBlockEnd(MachineBasicBlock &MBB)
Start tracking liveness from the end of basic block MBB.
Register scavengeRegisterBackwards(const TargetRegisterClass &RC, MachineBasicBlock::iterator To, bool RestoreAfter, int SPAdj, bool AllowSpill=true)
Make a register of the specific register class available from the current position backwards to the p...
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.
void enterBasicBlock(MachineBasicBlock &MBB)
Start tracking liveness from the begin of basic block MBB.
Register scavengeRegister(const TargetRegisterClass *RC, MachineBasicBlock::iterator I, int SPAdj, bool AllowSpill=true)
Make a register of the specific register class available and do the appropriate bookkeeping.
Register FindUnusedReg(const TargetRegisterClass *RC) const
Find an unused register of the specified register class.
A set of register units used to track register liveness.
static cl::opt< unsigned > InstrLimit("dfa-instr-limit", cl::Hidden, cl::init(0), cl::desc("If present, stops packetizing after N instructions"))
void getScavengingFrameIndices(SmallVectorImpl< int > &A) const
Get an array of scavenging frame indices.
Wrapper class representing virtual and physical registers.