17#ifndef LLVM_CODEGEN_LIVERANGEEDIT_H
18#define LLVM_CODEGEN_LIVERANGEEDIT_H
38class TargetRegisterInfo;
46 virtual void anchor();
73 Delegate *
const TheDelegate;
76 const unsigned FirstNew;
79 bool ScannedRemattable =
false;
94 void scanRemattable();
107 void MRI_NoteNewVirtualRegister(
Register VReg)
override;
132 : Parent(parent), NewRegs(newRegs),
MRI(MF.getRegInfo()), LIS(lis),
133 VRM(vrm),
TII(*MF.getSubtarget().getInstrInfo()), TheDelegate(delegate),
134 FirstNew(newRegs.
size()), DeadRemats(deadRemats) {
135 MRI.addDelegate(
this);
141 assert(Parent &&
"No parent LiveInterval");
151 unsigned size()
const {
return NewRegs.
size() - FirstNew; }
153 Register get(
unsigned idx)
const {
return NewRegs[idx + FirstNew]; }
173 return createEmptyIntervalFrom(
getReg(),
true);
215 bool Late =
false,
unsigned SubIdx = 0,
221 Rematted.
insert(ParentVNI);
226 return Rematted.
count(ParentVNI);
unsigned const MachineRegisterInfo * MRI
MachineInstrBuilder MachineInstrBuilder & DefMI
const HexagonInstrInfo * TII
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
LiveInterval - This class represents the liveness of a register, or stack slot.
Callback methods for LiveRangeEdit owners.
virtual ~Delegate()=default
virtual bool LRE_CanEraseVirtReg(Register)
Called when a virtual register is no longer used.
virtual void LRE_WillEraseInstruction(MachineInstr *MI)
Called immediately before erasing a dead machine instruction.
virtual void LRE_WillShrinkVirtReg(Register)
Called before shrinking the live range of a virtual register.
virtual void LRE_DidCloneVirtReg(Register New, Register Old)
Called after cloning a virtual register.
void eraseVirtReg(Register Reg)
eraseVirtReg - Notify the delegate that Reg is no longer in use, and try to erase it from LIS.
~LiveRangeEdit() override
Register get(unsigned idx) const
Register createFrom(Register OldReg)
createFrom - Create a new virtual register based on OldReg.
LiveInterval & createEmptyInterval()
create - Create a new register with the same class and original slot as parent.
void calculateRegClassAndHint(MachineFunction &, VirtRegAuxInfo &)
calculateRegClassAndHint - Recompute register class and hint for each new register.
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.
SmallVectorImpl< Register >::const_iterator iterator
Iterator for accessing the new registers added by this edit.
const LiveInterval & getParent() const
ArrayRef< Register > regs() const
SlotIndex rematerializeAt(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, const Remat &RM, const TargetRegisterInfo &, bool Late=false, unsigned SubIdx=0, MachineInstr *ReplaceIndexMI=nullptr)
rematerializeAt - Rematerialize RM.ParentVNI into DestReg by inserting an instruction into MBB before...
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...
void eliminateDeadDefs(SmallVectorImpl< MachineInstr * > &Dead, ArrayRef< Register > RegsBeingSpilled={})
eliminateDeadDefs - Try to delete machine instructions that are now dead (allDefsAreDead returns true...
void pop_back()
pop_back - It allows LiveRangeEdit users to drop new registers.
bool checkRematerializable(VNInfo *VNI, const MachineInstr *DefMI)
checkRematerializable - Manually add VNI to the list of rematerializable values if DefMI may be remat...
void markRematerialized(const VNInfo *ParentVNI)
markRematerialized - explicitly mark a value as rematerialized after doing it manually.
bool canRematerializeAt(Remat &RM, VNInfo *OrigVNI, SlotIndex UseIdx, bool cheapAsAMove)
canRematerializeAt - Determine if ParentVNI can be rematerialized at UseIdx.
bool didRematerialize(const VNInfo *ParentVNI) const
didRematerialize - Return true if ParentVNI was rematerialized anywhere.
bool anyRematerializable()
anyRematerializable - Return true if any parent values may be rematerializable.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
SlotIndex - An opaque wrapper around machine indexes.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
A SetVector that performs no allocations if smaller than a certain size.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
typename SuperClass::const_iterator const_iterator
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
VNInfo - Value Number Information.
This is an optimization pass for GlobalISel generic memory operations.
Remat - Information needed to rematerialize at a specific location.
const VNInfo *const ParentVNI
Remat(const VNInfo *ParentVNI)