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);
231 #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 isRegUsed(unsigned Reg, bool includeReserved=true) const
Return if a specific register is currently used.
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.
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...
static constexpr LaneBitmask getAll()
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.
void forward()
Move the internal MBB iterator and update register states.
unsigned FindUnusedReg(const TargetRegisterClass *RC) const
Find an unused register of the specified register class.
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
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 addScavengingFrameIndex(int FI)
Add a scavenging frame index.
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()
void enterBasicBlock(MachineBasicBlock &MBB)
Start tracking liveness from the begin of basic block MBB.
unsigned scavengeRegister(const TargetRegisterClass *RC, MachineBasicBlock::iterator I, int SPAdj)
Make a register of the specific register class available and do the appropriate bookkeeping.
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)
void getScavengingFrameIndices(SmallVectorImpl< int > &A) const
Get an array of scavenging frame indices.
bool isReserved(unsigned PhysReg) const
isReserved - Returns true when PhysReg is a reserved register.