18 #ifndef LLVM_CODEGEN_REGISTERSCAVENGING_H
19 #define LLVM_CODEGEN_REGISTERSCAVENGING_H
31 class TargetInstrInfo;
32 class TargetRegisterClass;
33 class TargetRegisterInfo;
41 unsigned NumRegUnits = 0;
44 bool Tracking =
false;
47 struct ScavengedInfo {
123 bool isRegUsed(
unsigned Reg,
bool includeReserved =
true)
const;
141 if (
I->FrameIndex == FI)
151 if (
I->FrameIndex >= 0)
175 bool RestoreAfter,
int SPAdj);
182 bool isReserved(
unsigned Reg)
const {
return MRI->
isReserved(Reg); }
186 void setUsed(
const BitVector &RegUnits) {
189 void setUnused(
const BitVector &RegUnits) {
195 void determineKillsAndDefs();
198 void addRegUnits(BitVector &BV,
unsigned Reg);
201 void removeRegUnits(BitVector &BV,
unsigned Reg);
208 BitVector &Candidates,
213 void init(MachineBasicBlock &MBB);
216 void setLiveInsUsed(
const MachineBasicBlock &MBB);
220 ScavengedInfo &spill(
unsigned Reg,
const TargetRegisterClass &RC,
int SPAdj,
231 #endif // LLVM_CODEGEN_REGISTERSCAVENGING_H
void push_back(const T &Elt)
A common definition of LaneBitmask for use in TableGen and CodeGen.
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.
static LaneBitmask getAll()
void removeUnits(const BitVector &RegUnits)
Removes all register units marked in the bitvector RegUnits.
unsigned scavengeRegisterBackwards(const TargetRegisterClass &RC, MachineBasicBlock::iterator To, bool RestoreAfter, int SPAdj)
Make a register of the specific register class available from the current position backwards to the p...
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.
void backward()
Update internal register state and move MBB iterator backwards.
void scavengeFrameVirtualRegs(MachineFunction &MF, RegScavenger &RS)
Replaces all frame index virtual registers with physical registers.
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.
TargetInstrInfo - Interface to description of machine instruction set.
MachineInstrBundleIterator< MachineInstr > iterator
MachineInstrBuilder & UseMI
bool isReserved(unsigned PhysReg) const
isReserved - Returns true when PhysReg is a reserved register.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
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 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 enterBasicBlockEnd(MachineBasicBlock &MBB)
Start tracking liveness from the end of basic block MBB.
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.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
unsigned FindUnusedReg(const TargetRegisterClass *RegClass) const
Find an unused register of the specified register class.
void enterBasicBlock(MachineBasicBlock &MBB)
Start tracking liveness from the begin of basic block MBB.
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 setRegUsed(unsigned Reg, LaneBitmask LaneMask=LaneBitmask::getAll())
Tell the scavenger a register is used.
unsigned scavengeRegister(const TargetRegisterClass *RegClass, int SPAdj)
unsigned scavengeRegister(const TargetRegisterClass *RegClass, MachineBasicBlock::iterator I, int SPAdj)
Make a register of the specific register class available and do the appropriate bookkeeping.