14#define DEBUG_TYPE "riscv-prera-sched-strategy"
17RISCVPreRAMachineSchedStrategy::getVSETVLIInfo(
const MachineInstr *
MI)
const {
18 unsigned TSFlags =
MI->getDesc().TSFlags;
24bool RISCVPreRAMachineSchedStrategy::tryVSETVLIInfo(
26 SchedCandidate &TryCand, SchedCandidate &Cand, CandReason Reason)
const {
29 if (Cand.AtTop != TryCand.AtTop)
32 auto IsCompatible = [&](
const RISCV::VSETVLIInfo &FirstInfo,
33 const RISCV::VSETVLIInfo &SecondInfo) {
34 return FirstInfo.
isValid() && SecondInfo.isValid() &&
42 if (Cand.AtTop && IsCompatible(CandInfo, TopInfo))
45 if (!Cand.AtTop && IsCompatible(CandInfo, BottomInfo))
49 if (TryCand.AtTop && IsCompatible(TryInfo, TopInfo)) {
50 TryCand.Reason = Reason;
54 if (!TryCand.AtTop && IsCompatible(TryInfo, BottomInfo)) {
55 TryCand.Reason = Reason;
81 if (
DAG->isTrackingPressure() &&
87 if (
DAG->isTrackingPressure() &&
97 bool SameBoundary = Zone !=
nullptr;
120 bool CandIsClusterSucc =
122 bool TryCandIsClusterSucc =
125 if (
tryGreater(TryCandIsClusterSucc, CandIsClusterSucc, TryCand, Cand,
137 if (
DAG->isTrackingPressure() &&
156 !
Rem.IsAcyclicLatencyLimited &&
tryLatency(TryCand, Cand, *Zone))
176 if (ST->enableVsetvliSchedHeuristic() &&
177 tryVSETVLIInfo(getVSETVLIInfo(TryCand.
SU->
getInstr()),
178 getVSETVLIInfo(Cand.
SU->
getInstr()), TryCand, Cand,
197 if (ST->enableVsetvliSchedHeuristic()) {
200 if (Info.isValid()) {
206 dbgs() <<
"Previous scheduled Unit: \n";
207 dbgs() <<
" IsTop: " << IsTopNode <<
"\n";
MachineSchedPolicy RegionPolicy
const TargetSchedModel * SchedModel
const MachineSchedContext * Context
const TargetRegisterInfo * TRI
void schedNode(SUnit *SU, bool IsTopNode) override
Update the scheduler's state after scheduling a node.
Representation of each machine instruction.
void schedNode(SUnit *SU, bool IsTopNode) override
Update the scheduler's state after scheduling a node.
void leaveMBB() override
Tell the strategy that current MBB is done.
bool tryCandidate(SchedCandidate &Cand, SchedCandidate &TryCand, SchedBoundary *Zone) const override
Apply a set of heuristics to a new candidate.
void enterMBB(MachineBasicBlock *MBB) override
Tell the strategy that MBB is about to be processed.
VSETVLIInfo computeInfoForInstr(const MachineInstr &MI) const
Defines the abstract state with which the forward dataflow models the values of the VL and VTYPE regi...
bool isCompatible(const DemandedFields &Used, const VSETVLIInfo &Require, const LiveIntervals *LIS) const
Scheduling unit. This is a node in the scheduling DAG.
unsigned NodeNum
Entry # of node in the node vector.
unsigned ParentClusterIdx
The parent cluster id.
MachineInstr * getInstr() const
Returns the representative MachineInstr for this SUnit.
Each Scheduling boundary is associated with ready queues.
LLVM_ABI unsigned getLatencyStallCycles(SUnit *SU)
Get the difference between the given SUnit's ready time and the current cycle.
unsigned getCurrMOps() const
Micro-ops issued in the current cycle.
static bool hasSEWOp(uint64_t TSFlags)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI unsigned getWeakLeft(const SUnit *SU, bool isTop)
LLVM_ABI bool tryPressure(const PressureChange &TryP, const PressureChange &CandP, GenericSchedulerBase::SchedCandidate &TryCand, GenericSchedulerBase::SchedCandidate &Cand, GenericSchedulerBase::CandReason Reason, const TargetRegisterInfo *TRI, const MachineFunction &MF)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI bool tryLatency(GenericSchedulerBase::SchedCandidate &TryCand, GenericSchedulerBase::SchedCandidate &Cand, SchedBoundary &Zone)
bool isTheSameCluster(unsigned A, unsigned B)
Return whether the input cluster ID's are the same and valid.
LLVM_ABI bool tryGreater(int TryVal, int CandVal, GenericSchedulerBase::SchedCandidate &TryCand, GenericSchedulerBase::SchedCandidate &Cand, GenericSchedulerBase::CandReason Reason)
LLVM_ABI bool tryLess(int TryVal, int CandVal, GenericSchedulerBase::SchedCandidate &TryCand, GenericSchedulerBase::SchedCandidate &Cand, GenericSchedulerBase::CandReason Reason)
Return true if this heuristic determines order.
LLVM_ABI int biasPhysReg(const SUnit *SU, bool isTop)
Minimize physical register live ranges.
Store the state used by GenericScheduler heuristics, required for the lifetime of one invocation of p...
LLVM_ABI void initResourceDelta(const ScheduleDAGMI *DAG, const TargetSchedModel *SchedModel)
SchedResourceDelta ResDelta
unsigned DemandedResources
static DemandedFields all()
PressureChange CriticalMax
PressureChange CurrentMax