14#ifndef LLVM_CODEGEN_SCHEDULEDAGINSTRS_H
15#define LLVM_CODEGEN_SCHEDULEDAGINSTRS_H
222 void reduceHugeMemNodeMaps(Value2SUsMap &
stores,
223 Value2SUsMap &
loads,
unsigned N);
227 void addChainDependency(
SUnit *SUa,
SUnit *SUb,
232 for (
SUnit *Entry : SUs)
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 *>>;
294 return Topo.IsReachable(SU, TargetSU);
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")
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.
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.
MachineInstrBundleIterator< MachineInstr > iterator
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.
constexpr PointerIntPair()=default
ValueType getPointer() const
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Special value supplied for machine level alias analysis.
Track the current register pressure at some position in the instruction stream, and remember the high...
Wrapper class representing virtual and physical registers.
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.
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.
MachineBasicBlock * BB
The block in which to insert instructions.
MachineInstr * FirstDbgValue
bool CanHandleTerminators
The standard DAG builder does not normally include terminators as DAG nodes because it does not creat...
bool ScheduleSingleMIRegions
True if regions with a single MI should be scheduled.
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
ScheduleDAGInstrs(MachineFunction &mf, const MachineLoopInfo *mli, bool RemoveKillFlags=false)
bool shouldScheduleSingleMIRegions() const
Whether regions with a single MI should be scheduled.
DbgValueVector DbgValues
Remember instruction that precedes DBG_VALUE.
std::vector< std::pair< MachineInstr *, MachineInstr * > > DbgValueVector
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.
SUnit * BarrierChain
Remember a generic side-effecting instruction as we proceed.
BatchAAResults * getAAForDep() const
Returns a (possibly null) pointer to the current BatchAAResults.
bool TrackLaneMasks
Whether lane masks should get tracked.
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.
const MachineLoopInfo * MLI
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.
void addChainDependency(SUnit *SUa, SUnit *SUb, unsigned Latency=0)
Adds a chain edge between SUa and SUb, but only if both AAResults and Target fail to deny the depende...
unsigned NumRegionInstrs
Instructions in this region (distance(RegionBegin, RegionEnd)).
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...
std::vector< SUnit > SUnits
The scheduling units.
ScheduleDAG(const ScheduleDAG &)=delete
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Fast multiset implementation for objects that can be identified by small unsigned keys.
Provide an instruction scheduling machine model to CodeGen passes.
'undef' values are things that do not have specified contents.
LLVM Value Representation.
Abstract Attribute helper functions.
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
SparseMultiSet< VReg2SUnit, VirtReg2IndexFunctor > VReg2SUnitMultiMap
Track local uses of virtual registers.
SparseMultiSet< PhysRegSUOper, identity< unsigned >, uint16_t > RegUnit2SUnitsMap
Use a SparseMultiSet to track physical registers.
SparseMultiSet< VReg2SUnitOperIdx, VirtReg2IndexFunctor > VReg2SUnitOperIdxMultiMap
constexpr unsigned InvalidClusterId
SmallVector< UnderlyingObject, 4 > UnderlyingObjectsVector
SmallPtrSet< SUnit *, 8 > ClusterInfo
Keep record of which SUnit are in the same cluster group.
PointerUnion< const Value *, const PseudoSourceValue * > ValueType
Summarize the scheduling resources required for an instruction of a particular scheduling class.
unsigned getSparseSetIndex() const
PhysRegSUOper(SUnit *su, int op, unsigned R)
UnderlyingObject(ValueType V, bool MayAlias)
ValueType getValue() const
VReg2SUnitOperIdx(Register VReg, LaneBitmask LaneMask, unsigned OperandIndex, SUnit *SU)
VReg2SUnit(Register VReg, LaneBitmask LaneMask, SUnit *SU)
unsigned getSparseSetIndex() const