Go to the documentation of this file.
17 #ifndef LLVM_CODEGEN_LIVERANGEEDIT_H
18 #define LLVM_CODEGEN_LIVERANGEEDIT_H
39 class TargetInstrInfo;
40 class TargetRegisterInfo;
48 virtual void anchor();
75 Delegate *
const TheDelegate;
78 const unsigned FirstNew;
81 bool ScannedRemattable =
false;
111 void MRI_NoteNewVirtualRegister(
Register VReg)
override;
136 : Parent(parent), NewRegs(newRegs),
MRI(MF.getRegInfo()), LIS(lis),
137 VRM(vrm),
TII(*MF.getSubtarget().getInstrInfo()), TheDelegate(delegate),
138 FirstNew(newRegs.
size()), DeadRemats(deadRemats) {
139 MRI.setDelegate(
this);
145 assert(Parent &&
"No parent LiveInterval");
155 unsigned size()
const {
return NewRegs.size() - FirstNew; }
157 Register get(
unsigned idx)
const {
return NewRegs[idx + FirstNew]; }
179 return createEmptyIntervalFrom(
getReg(),
true);
226 Rematted.
insert(ParentVNI);
231 return Rematted.
count(ParentVNI);
255 #endif // LLVM_CODEGEN_LIVERANGEEDIT_H
Remat(const VNInfo *ParentVNI)
Remat - Information needed to rematerialize at a specific location.
bool checkRematerializable(VNInfo *VNI, const MachineInstr *DefMI, AAResults *)
checkRematerializable - Manually add VNI to the list of rematerializable values if DefMI may be remat...
SmallVectorImpl< Register >::const_iterator iterator
Iterator for accessing the new registers added by this edit.
This is an optimization pass for GlobalISel generic memory operations.
void calculateRegClassAndHint(MachineFunction &, VirtRegAuxInfo &)
calculateRegClassAndHint - Recompute register class and hint for each new register.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
virtual bool LRE_CanEraseVirtReg(Register)
Called when a virtual register is no longer used.
Register createFrom(Register OldReg)
createFrom - Create a new virtual register based on OldReg.
Calculate auxiliary information for a virtual register such as its spill weight and allocation hint.
Reg
All possible values of the reg field in the ModR/M byte.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
void eliminateDeadDefs(SmallVectorImpl< MachineInstr * > &Dead, ArrayRef< Register > RegsBeingSpilled=None, AAResults *AA=nullptr)
eliminateDeadDefs - Try to delete machine instructions that are now dead (allDefsAreDead returns true...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
virtual void LRE_WillEraseInstruction(MachineInstr *MI)
Called immediately before erasing a dead machine instruction.
bool didRematerialize(const VNInfo *ParentVNI) const
didRematerialize - Return true if ParentVNI was rematerialized anywhere.
LiveRangeEdit(const LiveInterval *parent, SmallVectorImpl< Register > &newRegs, MachineFunction &MF, LiveIntervals &lis, VirtRegMap *vrm, Delegate *delegate=nullptr, SmallPtrSet< MachineInstr *, 32 > *deadRemats=nullptr)
Create a LiveRangeEdit for breaking down parent into smaller pieces.
ArrayRef< Register > regs() const
TargetInstrInfo - Interface to description of machine instruction set.
Register get(unsigned idx) const
bool anyRematerializable(AAResults *)
anyRematerializable - Return true if any parent values may be rematerializable.
const HexagonInstrInfo * TII
MachineOperand class - Representation of each machine instruction operand.
void eraseVirtReg(Register Reg)
eraseVirtReg - Notify the delegate that Reg is no longer in use, and try to erase it from LIS.
~LiveRangeEdit() override
LiveInterval - This class represents the liveness of a register, or stack slot.
SlotIndex - An opaque wrapper around machine indexes.
Representation of each machine instruction.
LiveInterval & createEmptyInterval()
create - Create a new register with the same class and original slot as parent.
void pop_back()
pop_back - It allows LiveRangeEdit users to drop new registers.
virtual ~Delegate()=default
typename SuperClass::const_iterator const_iterator
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const VNInfo *const ParentVNI
bool canRematerializeAt(Remat &RM, VNInfo *OrigVNI, SlotIndex UseIdx, bool cheapAsAMove)
canRematerializeAt - Determine if ParentVNI can be rematerialized at UseIdx.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
void markRematerialized(const VNInfo *ParentVNI)
markRematerialized - explicitly mark a value as rematerialized after doing it manually.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
SlotIndex rematerializeAt(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, const Remat &RM, const TargetRegisterInfo &, bool Late=false)
rematerializeAt - Rematerialize RM.ParentVNI into DestReg by inserting an instruction into MBB before...
unsigned const MachineRegisterInfo * MRI
Wrapper class representing virtual and physical registers.
bool allUsesAvailableAt(const MachineInstr *OrigMI, SlotIndex OrigIdx, SlotIndex UseIdx) const
allUsesAvailableAt - Return true if all registers used by OrigMI at OrigIdx are also available with t...
const LiveInterval & getParent() const
virtual void LRE_DidCloneVirtReg(Register New, Register Old)
Called after cloning a virtual register.
VNInfo - Value Number Information.
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
MachineInstrBuilder MachineInstrBuilder & DefMI
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Callback methods for LiveRangeEdit owners.
virtual void LRE_WillShrinkVirtReg(Register)
Called before shrinking the live range of a virtual register.
A vector that has set insertion semantics.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.