14#ifndef LLVM_CODEGEN_SCHEDULEDAGINSTRS_H
15#define LLVM_CODEGEN_SCHEDULEDAGINSTRS_H
41 class MachineFrameInfo;
42 class MachineFunction;
44 class MachineLoopInfo;
46 struct MCSchedClassDesc;
48 class PseudoSourceValue;
49 class RegPressureTracker;
129 bool ScheduleSingleMIRegions =
false;
136 bool CanHandleTerminators =
false;
139 bool TrackLaneMasks =
false;
154 unsigned NumRegionInstrs = 0;
213 if (AAForDep.has_value())
214 return &AAForDep.value();
222 void reduceHugeMemNodeMaps(Value2SUsMap &
stores,
223 Value2SUsMap &
loads,
unsigned N);
227 void addChainDependency(
SUnit *SUa,
SUnit *SUb,
232 for (
SUnit *Entry : SUs)
233 addChainDependency(SU, Entry,
Latency);
237 void addChainDependencies(
SUnit *SU, Value2SUsMap &Val2SUsMap);
240 void addChainDependencies(
SUnit *SU, Value2SUsMap &Val2SUsMap,
248 void addBarrierChain(Value2SUsMap &map);
254 void insertBarrierChain(Value2SUsMap &map);
265 std::vector<std::pair<MachineInstr *, MachineInstr *>>;
278 bool RemoveKillFlags =
false);
299 return ScheduleSingleMIRegions;
323 virtual void finishBlock();
332 unsigned regioninstrs);
335 virtual void exitRegion();
345 bool TrackLaneMasks =
false);
354 void addSchedBarrierDeps();
366 void dumpNode(
const SUnit &SU)
const override;
367 void dump()
const override;
370 std::string getGraphNodeLabel(
const SUnit *SU)
const override;
373 std::string getDAGName()
const override;
380 bool canAddEdge(
SUnit *SuccSU,
SUnit *PredSU);
399 void addPhysRegDataDeps(
SUnit *SU,
unsigned OperIdx);
400 void addPhysRegDeps(
SUnit *SU,
unsigned OperIdx);
401 void addVRegDefDeps(
SUnit *SU,
unsigned OperIdx);
402 void addVRegUseDeps(
SUnit *SU,
unsigned OperIdx);
419 "SUnits std::vector reallocated on the fly!");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
hexagon widen Hexagon Store false hexagon widen loads
A common definition of LaneBitmask for use in TableGen and CodeGen.
static void addEdge(SmallVectorImpl< LazyCallGraph::Edge > &Edges, DenseMap< LazyCallGraph::Node *, int > &EdgeIndexMap, LazyCallGraph::Node &N, LazyCallGraph::Edge::Kind EK)
This file defines the PointerIntPair class.
This file defines the SmallVector class.
This file defines the SparseMultiSet class, which adds multiset behavior to the SparseSet.
A private abstract base class describing the concept of an individual alias analysis implementation.
This class is a wrapper over an AAResults, and it is intended to be used only when there are no IR ch...
A set of register units used to track register liveness.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
PointerIntPair - This class implements a pair of a pointer and small integer.
ValueType getPointer() const
Track the current register pressure at some position in the instruction stream, and remember the high...
Wrapper class representing virtual and physical registers.
unsigned virtRegIndex() const
Convert a virtual register number to a 0-based index.
Scheduling unit. This is a node in the scheduling DAG.
const MCSchedClassDesc * SchedClass
nullptr or resolved SchedClass.
MachineInstr * getInstr() const
Returns the representative MachineInstr for this SUnit.
A ScheduleDAG for scheduling lists of MachineInstr.
LiveRegUnits LiveRegs
Set of live physical registers for updating kill flags.
DenseMap< MachineInstr *, SUnit * > MISUnitMap
After calling BuildSchedGraph, each machine instruction in the current scheduling region is mapped to...
SmallVector< ClusterInfo > & getClusters()
Returns the array of the clusters.
MachineBasicBlock::iterator end() const
Returns an iterator to the bottom of the current scheduling region.
const TargetSchedModel * getSchedModel() const
Gets the machine model for instruction scheduling.
MachineBasicBlock::iterator RegionEnd
The end of the range to be scheduled.
VReg2SUnitOperIdxMultiMap CurrentVRegUses
Tracks the last instructions in this region using each virtual register.
void addChainDependencies(SUnit *SU, SUList &SUs, unsigned Latency)
Adds dependencies as needed from all SUs in list to SU.
const MCSchedClassDesc * getSchedClass(SUnit *SU) const
Resolves and cache a resolved scheduling class for an SUnit.
~ScheduleDAGInstrs() override=default
bool shouldScheduleSingleMIRegions() const
Whether regions with a single MI should be scheduled.
std::vector< std::pair< MachineInstr *, MachineInstr * > > DbgValueVector
DbgValueVector DbgValues
Remember instruction that precedes DBG_VALUE.
SUnit * newSUnit(MachineInstr *MI)
Creates a new SUnit and return a ptr to it.
virtual void finalizeSchedule()
Allow targets to perform final scheduling actions at the level of the whole MachineFunction.
ScheduleDAGTopologicalSort Topo
Topo - A topological ordering for SUnits which permits fast IsReachable and similar queries.
DumpDirection
The direction that should be used to dump the scheduled Sequence.
std::list< SUnit * > SUList
A list of SUnits, used in Value2SUsMap, during DAG construction.
BatchAAResults * getAAForDep() const
Returns a (possibly null) pointer to the current BatchAAResults.
ClusterInfo * getCluster(unsigned Idx)
Get the specific cluster, return nullptr for InvalidClusterId.
bool IsReachable(SUnit *SU, SUnit *TargetSU)
IsReachable - Checks if SU is reachable from TargetSU.
RegUnit2SUnitsMap Defs
Defs, Uses - Remember where defs and uses of each register are as we iterate upward through the instr...
UndefValue * UnknownValue
For an unanalyzable memory access, this Value is used in maps.
VReg2SUnitMultiMap CurrentVRegDefs
Tracks the last instruction(s) in this region defining each virtual register.
MachineBasicBlock::iterator begin() const
Returns an iterator to the top of the current scheduling region.
SUnit * getSUnit(MachineInstr *MI) const
Returns an existing SUnit for this MI, or nullptr.
TargetSchedModel SchedModel
TargetSchedModel provides an interface to the machine model.
virtual void schedule()=0
Orders nodes according to selected style.
bool RemoveKillFlags
True if the DAG builder should remove kill flags (in preparation for rescheduling).
std::optional< BatchAAResults > AAForDep
MachineBasicBlock::iterator RegionBegin
The beginning of the range to be scheduled.
const MachineFrameInfo & MFI
SmallVector< ClusterInfo > Clusters
virtual bool doMBBSchedRegionsTopDown() const
If this method returns true, handling of the scheduling regions themselves (in case of a scheduling b...
void setDumpDirection(DumpDirection D)
This class can compute a topological ordering for SUnits and provides methods for dynamically updatin...
LLVM_ABI bool IsReachable(const SUnit *SU, const SUnit *TargetSU)
Checks if SU is reachable from TargetSU.
std::vector< SUnit > SUnits
The scheduling units.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Provide an instruction scheduling machine model to CodeGen passes.
LLVM_ABI bool hasInstrSchedModel() const
Return true if this machine model includes an instruction-level scheduling model.
LLVM_ABI const MCSchedClassDesc * resolveSchedClass(const MachineInstr *MI) const
Return the MCSchedClassDesc for this instruction.
'undef' values are things that do not have specified contents.
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
constexpr unsigned InvalidClusterId
Summarize the scheduling resources required for an instruction of a particular scheduling class.
Record a physical register access.
unsigned getSparseSetIndex() const
PhysRegSUOper(SUnit *su, int op, unsigned R)
UnderlyingObject(ValueType V, bool MayAlias)
ValueType getValue() const
Mapping from virtual register to SUnit including an operand index.
VReg2SUnitOperIdx(Register VReg, LaneBitmask LaneMask, unsigned OperandIndex, SUnit *SU)
An individual mapping from virtual register number to SUnit.
VReg2SUnit(Register VReg, LaneBitmask LaneMask, SUnit *SU)
unsigned getSparseSetIndex() const