diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/MachineScheduler.cpp | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MachineScheduler.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MachineScheduler.cpp index e5cd46268600..5ab5a40e7574 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/MachineScheduler.cpp @@ -95,9 +95,15 @@ cl::opt<bool> ViewMISchedDAGs( cl::desc("Pop up a window to show MISched dags after they are processed")); cl::opt<bool> PrintDAGs("misched-print-dags", cl::Hidden, cl::desc("Print schedule DAGs")); +cl::opt<bool> MISchedDumpReservedCycles( + "misched-dump-reserved-cycles", cl::Hidden, cl::init(false), + cl::desc("Dump resource usage at schedule boundary.")); #else const bool ViewMISchedDAGs = false; const bool PrintDAGs = false; +#ifdef LLVM_ENABLE_DUMP +const bool MISchedDumpReservedCycles = false; +#endif // LLVM_ENABLE_DUMP #endif // NDEBUG } // end namespace llvm @@ -955,7 +961,7 @@ void ScheduleDAGMILive::collectVRegUses(SUnit &SU) { continue; Register Reg = MO.getReg(); - if (!Register::isVirtualRegister(Reg)) + if (!Reg.isVirtual()) continue; // Ignore re-defs. @@ -1116,7 +1122,7 @@ void ScheduleDAGMILive::updatePressureDiffs( for (const RegisterMaskPair &P : LiveUses) { Register Reg = P.RegUnit; /// FIXME: Currently assuming single-use physregs. - if (!Register::isVirtualRegister(Reg)) + if (!Reg.isVirtual()) continue; if (ShouldTrackLaneMasks) { @@ -1340,7 +1346,7 @@ unsigned ScheduleDAGMILive::computeCyclicCriticalPath() { // Visit each live out vreg def to find def/use pairs that cross iterations. for (const RegisterMaskPair &P : RPTracker.getPressure().LiveOutRegs) { Register Reg = P.RegUnit; - if (!Register::isVirtualRegister(Reg)) + if (!Reg.isVirtual()) continue; const LiveInterval &LI = LIS->getInterval(Reg); const VNInfo *DefVNI = LI.getVNInfoBefore(LIS->getMBBEndIdx(BB)); @@ -1823,12 +1829,12 @@ void CopyConstrain::constrainLocalCopy(SUnit *CopySU, ScheduleDAGMILive *DAG) { // Check for pure vreg copies. const MachineOperand &SrcOp = Copy->getOperand(1); Register SrcReg = SrcOp.getReg(); - if (!Register::isVirtualRegister(SrcReg) || !SrcOp.readsReg()) + if (!SrcReg.isVirtual() || !SrcOp.readsReg()) return; const MachineOperand &DstOp = Copy->getOperand(0); Register DstReg = DstOp.getReg(); - if (!Register::isVirtualRegister(DstReg) || DstOp.isDead()) + if (!DstReg.isVirtual() || DstOp.isDead()) return; // Check if either the dest or source is local. If it's live across a back @@ -2589,6 +2595,28 @@ SUnit *SchedBoundary::pickOnlyChoice() { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + +/// Dump the content of the \ref ReservedCycles vector for the +/// resources that are used in the basic block. +/// +LLVM_DUMP_METHOD void SchedBoundary::dumpReservedCycles() const { + if (!SchedModel->hasInstrSchedModel()) + return; + + unsigned ResourceCount = SchedModel->getNumProcResourceKinds(); + unsigned StartIdx = 0; + + for (unsigned ResIdx = 0; ResIdx < ResourceCount; ++ResIdx) { + const unsigned NumUnits = SchedModel->getProcResource(ResIdx)->NumUnits; + std::string ResName = SchedModel->getResourceName(ResIdx); + for (unsigned UnitIdx = 0; UnitIdx < NumUnits; ++UnitIdx) { + dbgs() << ResName << "(" << UnitIdx + << ") = " << ReservedCycles[StartIdx + UnitIdx] << "\n"; + } + StartIdx += NumUnits; + } +} + // This is useful information to dump after bumpNode. // Note that the Queue contents are more useful before pickNodeFromQueue. LLVM_DUMP_METHOD void SchedBoundary::dumpScheduledState() const { @@ -2611,6 +2639,8 @@ LLVM_DUMP_METHOD void SchedBoundary::dumpScheduledState() const { << "\n ExpectedLatency: " << ExpectedLatency << "c\n" << (IsResourceLimited ? " - Resource" : " - Latency") << " limited.\n"; + if (MISchedDumpReservedCycles) + dumpReservedCycles(); } #endif @@ -3102,12 +3132,12 @@ int biasPhysReg(const SUnit *SU, bool isTop) { unsigned UnscheduledOper = isTop ? 0 : 1; // If we have already scheduled the physreg produce/consumer, immediately // schedule the copy. - if (Register::isPhysicalRegister(MI->getOperand(ScheduledOper).getReg())) + if (MI->getOperand(ScheduledOper).getReg().isPhysical()) return 1; // If the physreg is at the boundary, defer it. Otherwise schedule it // immediately to free the dependent. We can hoist the copy later. bool AtBoundary = isTop ? !SU->NumSuccsLeft : !SU->NumPredsLeft; - if (Register::isPhysicalRegister(MI->getOperand(UnscheduledOper).getReg())) + if (MI->getOperand(UnscheduledOper).getReg().isPhysical()) return AtBoundary ? -1 : 1; } @@ -3117,7 +3147,7 @@ int biasPhysReg(const SUnit *SU, bool isTop) { // physical registers. bool DoBias = true; for (const MachineOperand &Op : MI->defs()) { - if (Op.isReg() && !Register::isPhysicalRegister(Op.getReg())) { + if (Op.isReg() && !Op.getReg().isPhysical()) { DoBias = false; break; } |