15 #ifndef LLVM_CODEGEN_SCHEDULEDAGINSTRS_H 16 #define LLVM_CODEGEN_SCHEDULEDAGINSTRS_H 39 class MachineFrameInfo;
40 class MachineFunction;
42 class MachineLoopInfo;
44 struct MCSchedClassDesc;
46 class PseudoSourceValue;
47 class RegPressureTracker;
58 : VirtReg(VReg), LaneMask(LaneMask), SU(SU) {}
70 unsigned OperandIndex,
SUnit *
SU)
71 :
VReg2SUnit(VReg, LaneMask, SU), OperandIndex(OperandIndex) {}
136 bool CanHandleTerminators =
false;
139 bool TrackLaneMasks =
false;
206 void addChainDependency(
SUnit *SUa,
SUnit *SUb,
211 for (
SUnit *Entry : SUs)
212 addChainDependency(SU, Entry, Latency);
239 std::vector<std::pair<MachineInstr *, MachineInstr *>>;
252 bool RemoveKillFlags =
false);
287 virtual void finishBlock();
296 unsigned regioninstrs);
299 virtual void exitRegion();
309 bool TrackLaneMasks =
false);
318 void addSchedBarrierDeps();
324 virtual void schedule() = 0;
330 void dumpNode(
const SUnit &SU)
const override;
331 void dump()
const override;
334 std::string getGraphNodeLabel(
const SUnit *SU)
const override;
337 std::string getDAGName()
const override;
344 void addPhysRegDataDeps(
SUnit *SU,
unsigned OperIdx);
345 void addPhysRegDeps(
SUnit *SU,
unsigned OperIdx);
346 void addVRegDefDeps(
SUnit *SU,
unsigned OperIdx);
347 void addVRegUseDeps(
SUnit *SU,
unsigned OperIdx);
367 const SUnit *Addr = SUnits.empty() ? nullptr : &SUnits[0];
369 SUnits.emplace_back(MI, (
unsigned)SUnits.size());
370 assert((Addr ==
nullptr || Addr == &SUnits[0]) &&
371 "SUnits std::vector reallocated on the fly!");
372 return &SUnits.back();
378 if (I == MISUnitMap.end())
385 #endif // LLVM_CODEGEN_SCHEDULEDAGINSTRS_H
const_iterator end(StringRef path)
Get end iterator over path.
A common definition of LaneBitmask for use in TableGen and CodeGen.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
static unsigned virtReg2Index(unsigned Reg)
Convert a virtual register number to a 0-based index.
This class represents lattice values for constants.
Record a physical register access.
LivePhysRegs LiveRegs
Set of live physical registers for updating kill flags.
const MCSchedClassDesc * getSchedClass(SUnit *SU) const
Resolves and cache a resolved scheduling class for an SUnit.
unsigned getSparseSetIndex() const
TargetSchedModel SchedModel
TargetSchedModel provides an interface to the machine model.
unsigned NumRegionInstrs
Instructions in this region (distance(RegionBegin, RegionEnd)).
MachineBasicBlock::iterator RegionEnd
The end of the range to be scheduled.
DenseMap< MachineInstr *, SUnit * > MISUnitMap
After calling BuildSchedGraph, each machine instruction in the current scheduling region is mapped to...
Provide an instruction scheduling machine model to CodeGen passes.
'undef' values are things that do not have specified contents.
An individual mapping from virtual register number to SUnit.
static unsigned getInt(StringRef R)
Get an unsigned integer, including error checks.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
DbgValueVector DbgValues
Remember instruction that precedes DBG_VALUE.
bool hasInstrSchedModel() const
Return true if this machine model includes an instruction-level scheduling model. ...
MachineBasicBlock::iterator RegionBegin
The beginning of the range to be scheduled.
MachineBasicBlock::iterator begin() const
Returns an iterator to the top of the current scheduling region.
ValueType getValue() const
std::list< SUnit * > SUList
A list of SUnits, used in Value2SUsMap, during DAG construction.
SUnit * getSUnit(MachineInstr *MI) const
Returns an existing SUnit for this MI, or nullptr.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
MachineInstr * getInstr() const
Returns the representative MachineInstr for this SUnit.
PointerIntPair - This class implements a pair of a pointer and small integer.
bool RemoveKillFlags
True if the DAG builder should remove kill flags (in preparation for rescheduling).
Summarize the scheduling resources required for an instruction of a particular scheduling class...
virtual bool doMBBSchedRegionsTopDown() const
If this method returns true, handling of the scheduling regions themselves (in case of a scheduling b...
Track the current register pressure at some position in the instruction stream, and remember the high...
const TargetSchedModel * getSchedModel() const
Gets the machine model for instruction scheduling.
const MCSchedClassDesc * SchedClass
nullptr or resolved SchedClass.
const MachineFrameInfo & MFI
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
The two locations may or may not alias. This is the least precise result.
PhysRegSUOper(SUnit *su, int op, unsigned R)
UndefValue * UnknownValue
For an unanalyzable memory access, this Value is used in maps.
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
VReg2SUnitOperIdx(unsigned VReg, LaneBitmask LaneMask, unsigned OperandIndex, SUnit *SU)
Reg2SUnitsMap Defs
Defs, Uses - Remember where defs and uses of each register are as we iterate upward through the instr...
const MachineLoopInfo * MLI
VReg2SUnitOperIdxMultiMap CurrentVRegUses
Tracks the last instructions in this region using each virtual register.
virtual void finalizeSchedule()
Allow targets to perform final scheduling actions at the level of the whole MachineFunction.
VReg2SUnit(unsigned VReg, LaneBitmask LaneMask, SUnit *SU)
const MCSchedClassDesc * resolveSchedClass(const MachineInstr *MI) const
Return the MCSchedClassDesc for this instruction.
A ScheduleDAG for scheduling lists of MachineInstr.
Representation of each machine instruction.
SparseSet - Fast set implmentation for objects that can be identified by small unsigned keys...
A set of physical registers with utility functions to track liveness when walking backward/forward th...
void addChainDependencies(SUnit *SU, SUList &SUs, unsigned Latency)
Adds dependencies as needed from all SUs in list to SU.
Mapping from virtual register to SUnit including an operand index.
std::vector< std::pair< MachineInstr *, MachineInstr * > > DbgValueVector
MachineBasicBlock::iterator end() const
Returns an iterator to the bottom of the current scheduling region.
SUnit * newSUnit(MachineInstr *MI)
Creates a new SUnit and return a ptr to it.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
UnderlyingObject(ValueType V, bool MayAlias)
MachineBasicBlock * BB
The block in which to insert instructions.
VReg2SUnitMultiMap CurrentVRegDefs
Tracks the last instruction(s) in this region defining each virtual register.
unsigned getSparseSetIndex() const
Scheduling unit. This is a node in the scheduling DAG.
A discriminated union of two pointer types, with the discriminator in the low bit of the pointer...