18 #ifndef LLVM_CODEGEN_REGISTERSCAVENGING_H
19 #define LLVM_CODEGEN_REGISTERSCAVENGING_H
27 class MachineRegisterInfo;
28 class TargetRegisterInfo;
29 class TargetInstrInfo;
30 class TargetRegisterClass;
44 struct ScavengedInfo {
45 ScavengedInfo(
int FI = -1) :
FrameIndex(FI),
Reg(0), Restore(
nullptr) {}
73 : MBB(nullptr), NumRegUnits(0), Tracking(
false) {}
124 bool isRegUsed(
unsigned Reg,
bool includeReserved =
true)
const;
142 if (
I->FrameIndex == FI)
152 if (
I->FrameIndex >= 0)
170 bool isReserved(
unsigned Reg)
const {
return MRI->
isReserved(Reg); }
174 void setUsed(BitVector &RegUnits) {
175 RegUnitsAvailable.
reset(RegUnits);
177 void setUnused(BitVector &RegUnits) {
178 RegUnitsAvailable |= RegUnits;
183 void determineKillsAndDefs();
186 void addRegUnits(BitVector &BV,
unsigned Reg);
189 void removeRegUnits(BitVector &BV,
unsigned Reg);
196 BitVector &Candidates,
201 void init(MachineBasicBlock &MBB);
204 void setLiveInsUsed(
const MachineBasicBlock &MBB);
void push_back(const T &Elt)
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()
MachineInstrBundleIterator< MachineInstr > iterator
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.
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.
Function Alias Analysis false
void unprocess(MachineBasicBlock::iterator I)
Unprocess instructions until you reach the provided iterator.
TargetInstrInfo - Interface to description of machine instruction set.
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...
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.
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)
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
unsigned scavengeRegister(const TargetRegisterClass *RegClass, MachineBasicBlock::iterator I, int SPAdj)
Make a register of the specific register class available and do the appropriate bookkeeping.