26#define DEBUG_TYPE "regalloc"
46 assert(
MRI && Indexes &&
"call reset() first");
54 if (!MO.isDef() && !MO.readsReg())
57 unsigned SubReg = MO.getSubReg();
60 :
MRI->getMaxLaneMaskForVReg(Reg);
94 SubLIC.
reset(MF, Indexes, DomTree, Alloc);
95 SubLIC.extendToUses(S, Reg, S.LaneMask, &LI);
109 "Expect empty main liverange");
113 for (
const VNInfo *VNI : SR.valnos) {
126 assert(
MRI && Indexes &&
"call reset() first");
143 bool IsSubRange = !Mask.all();
154 if (!MO.readsReg() || (IsSubRange && MO.isDef()))
157 unsigned SubReg = MO.getSubReg();
163 if ((SLM & Mask).
none())
169 unsigned OpNo = (&MO - &
MI->getOperand(0));
172 assert(!MO.isDef() &&
"Cannot handle PHI def of partial register.");
175 UseIdx = Indexes->
getMBBEndIdx(
MI->getOperand(OpNo + 1).getMBB());
178 bool isEarlyClobber =
false;
181 isEarlyClobber = MO.isEarlyClobber();
182 else if (
MI->isRegTiedToDefOperand(OpNo, &DefIdx)) {
185 isEarlyClobber =
MI->getOperand(DefIdx).isEarlyClobber();
192 extend(LR, UseIdx, Reg, Undefs);
unsigned const MachineRegisterInfo * MRI
A common definition of LaneBitmask for use in TableGen and CodeGen.
static VNInfo UndefVNI(0xbad, SlotIndex())
static void createDeadDef(SlotIndexes &Indexes, VNInfo::Allocator &Alloc, LiveRange &LR, const MachineOperand &MO)
unsigned const TargetRegisterInfo * TRI
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
Allocate memory in an ever growing pool, as if by bump-pointer.
void createDeadDefs(LiveRange &LR, Register Reg)
createDeadDefs - Create a dead def in LI for every def operand of Reg.
void calculate(LiveInterval &LI, bool TrackSubRegs)
Calculates liveness for the register specified in live interval LI.
void constructMainRangeFromSubranges(LiveInterval &LI)
For live interval LI with correct SubRanges construct matching information for the main live range.
A live range for subregisters.
LiveInterval - This class represents the liveness of a register, or stack slot.
void removeEmptySubRanges()
Removes all subranges without any segments (subranges without segments are not considered valid and s...
bool hasSubRanges() const
Returns true if subregister liveness information is available.
SubRange * createSubRangeFrom(BumpPtrAllocator &Allocator, LaneBitmask LaneMask, const LiveRange &CopyFrom)
Like createSubRange() but the new range is filled with a copy of the liveness information in CopyFrom...
iterator_range< subrange_iterator > subranges()
void refineSubRanges(BumpPtrAllocator &Allocator, LaneBitmask LaneMask, std::function< void(LiveInterval::SubRange &)> Apply, const SlotIndexes &Indexes, const TargetRegisterInfo &TRI, unsigned ComposeSubRegIdx=0)
Refines the subranges to support LaneMask.
void computeSubRangeUndefs(SmallVectorImpl< SlotIndex > &Undefs, LaneBitmask LaneMask, const MachineRegisterInfo &MRI, const SlotIndexes &Indexes) const
For a given lane mask LaneMask, compute indexes at which the lane is marked undefined by subregister ...
SlotIndexes * getIndexes()
MachineDominatorTree * getDomTree()
void resetLiveOutMap()
Reset Map and Seen fields.
VNInfo::Allocator * getVNAlloc()
void reset(const MachineFunction *mf, SlotIndexes *SI, MachineDominatorTree *MDT, VNInfo::Allocator *VNIA)
reset - Prepare caches for a new set of non-overlapping live ranges.
const MachineFunction * getMachineFunction()
Some getters to expose in a read-only way some private fields to subclasses.
const MachineRegisterInfo * getRegInfo() const
void extend(LiveRange &LR, SlotIndex Use, unsigned PhysReg, ArrayRef< SlotIndex > Undefs)
Extend the live range of LR to reach Use.
This class represents the liveness of a register, stack slot, etc.
VNInfo * createDeadDef(SlotIndex Def, VNInfo::Allocator &VNIAlloc)
createDeadDef - Make sure the range has a value defined at Def.
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
bool isEarlyClobber() const
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
SlotIndex - An opaque wrapper around machine indexes.
SlotIndex getRegSlot(bool EC=false) const
Returns the register use/def slot in the current instruction for a normal or early-clobber def.
SlotIndex getMBBEndIdx(unsigned Num) const
Returns the last index in the given basic block number.
SlotIndex getInstructionIndex(const MachineInstr &MI, bool IgnoreBundle=false) const
Returns the base index for the given instruction.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
VNInfo - Value Number Information.
bool isUnused() const
Returns true if this value is unused.
SlotIndex def
The index of the defining instruction.
bool isPHIDef() const
Returns true if this value is defined by a PHI instruction (or was, PHI instructions may have been el...
This is an optimization pass for GlobalISel generic memory operations.
static constexpr LaneBitmask getAll()