LLVM 20.0.0git
|
SystemZHazardRecognizer maintains the state for one MBB during scheduling. More...
#include "Target/SystemZ/SystemZHazardRecognizer.h"
Public Member Functions | |
SystemZHazardRecognizer (const SystemZInstrInfo *tii, const TargetSchedModel *SM) | |
HazardType | getHazardType (SUnit *SU, int Stalls=0) override |
getHazardType - Return the hazard type of emitting this node. | |
void | Reset () override |
Reset - This callback is invoked when a new block of instructions is about to be schedule. | |
void | EmitInstruction (SUnit *SU) override |
EmitInstruction - This callback is invoked when an instruction is emitted, to advance the hazard state. | |
const MCSchedClassDesc * | getSchedClass (SUnit *SU) const |
Resolves and cache a resolved scheduling class for an SUnit. | |
void | emitInstruction (MachineInstr *MI, bool TakenBranch=false) |
Wrap a non-scheduled instruction in an SU and emit it. | |
int | groupingCost (SUnit *SU) const |
Return the cost of decoder grouping for SU. | |
int | resourcesCost (SUnit *SU) |
Return the cost of SU in regards to processor resources usage. | |
void | dumpSU (SUnit *SU, raw_ostream &OS) const |
void | dumpCurrGroup (std::string Msg="") const |
void | dumpProcResourceCounters () const |
void | dumpState () const |
MachineBasicBlock::iterator | getLastEmittedMI () |
void | copyState (SystemZHazardRecognizer *Incoming) |
Copy counters from end of single predecessor. | |
Public Member Functions inherited from llvm::ScheduleHazardRecognizer | |
ScheduleHazardRecognizer ()=default | |
virtual | ~ScheduleHazardRecognizer () |
unsigned | getMaxLookAhead () const |
bool | isEnabled () const |
virtual bool | atIssueLimit () const |
atIssueLimit - Return true if no more instructions may be issued in this cycle. | |
virtual HazardType | getHazardType (SUnit *, int Stalls=0) |
getHazardType - Return the hazard type of emitting this node. | |
virtual void | Reset () |
Reset - This callback is invoked when a new block of instructions is about to be schedule. | |
virtual void | EmitInstruction (SUnit *) |
EmitInstruction - This callback is invoked when an instruction is emitted, to advance the hazard state. | |
virtual void | EmitInstruction (MachineInstr *) |
This overload will be used when the hazard recognizer is being used by a non-scheduling pass, which does not use SUnits. | |
virtual unsigned | PreEmitNoops (SUnit *) |
PreEmitNoops - This callback is invoked prior to emitting an instruction. | |
virtual unsigned | PreEmitNoops (MachineInstr *) |
This overload will be used when the hazard recognizer is being used by a non-scheduling pass, which does not use SUnits. | |
virtual bool | ShouldPreferAnother (SUnit *) |
ShouldPreferAnother - This callback may be invoked if getHazardType returns NoHazard. | |
virtual void | AdvanceCycle () |
AdvanceCycle - This callback is invoked whenever the next top-down instruction to be scheduled cannot issue in the current cycle, either because of latency or resource conflicts. | |
virtual void | RecedeCycle () |
RecedeCycle - This callback is invoked whenever the next bottom-up instruction to be scheduled cannot issue in the current cycle, either because of latency or resource conflicts. | |
virtual void | EmitNoop () |
EmitNoop - This callback is invoked when a noop was added to the instruction stream. | |
virtual void | EmitNoops (unsigned Quantity) |
EmitNoops - This callback is invoked when noops were added to the instruction stream. | |
Public Attributes | |
std::string | CurGroupDbg |
Additional Inherited Members | |
Public Types inherited from llvm::ScheduleHazardRecognizer | |
enum | HazardType { NoHazard , Hazard , NoopHazard } |
Protected Attributes inherited from llvm::ScheduleHazardRecognizer | |
unsigned | MaxLookAhead = 0 |
MaxLookAhead - Indicate the number of cycles in the scoreboard state. | |
SystemZHazardRecognizer maintains the state for one MBB during scheduling.
Definition at line 45 of file SystemZHazardRecognizer.h.
|
inline |
Definition at line 110 of file SystemZHazardRecognizer.h.
void SystemZHazardRecognizer::copyState | ( | SystemZHazardRecognizer * | Incoming | ) |
Copy counters from end of single predecessor.
Definition at line 450 of file SystemZHazardRecognizer.cpp.
References CurGroupDbg, and LLVM_DEBUG.
Referenced by llvm::SystemZPostRASchedStrategy::enterMBB().
void SystemZHazardRecognizer::dumpCurrGroup | ( | std::string | Msg = "" | ) | const |
Definition at line 208 of file SystemZHazardRecognizer.cpp.
References CurGroupDbg, and llvm::dbgs().
Referenced by dumpState(), and EmitInstruction().
void SystemZHazardRecognizer::dumpProcResourceCounters | ( | ) | const |
Definition at line 223 of file SystemZHazardRecognizer.cpp.
References llvm::dbgs(), llvm::TargetSchedModel::getNumProcResourceKinds(), llvm::TargetSchedModel::getProcResource(), and llvm::MCProcResourceDesc::Name.
Referenced by dumpState().
void SystemZHazardRecognizer::dumpState | ( | ) | const |
Definition at line 248 of file SystemZHazardRecognizer.cpp.
References llvm::dbgs(), dumpCurrGroup(), and dumpProcResourceCounters().
Referenced by llvm::SystemZPostRASchedStrategy::enterMBB(), and llvm::SystemZPostRASchedStrategy::initialize().
void SystemZHazardRecognizer::dumpSU | ( | SUnit * | SU, |
raw_ostream & | OS | ||
) | const |
Definition at line 167 of file SystemZHazardRecognizer.cpp.
References llvm::SUnit::getInstr(), llvm::MachineInstr::getOpcode(), llvm::TargetSchedModel::getProcResource(), getSchedClass(), llvm::TargetSchedModel::getWriteProcResBegin(), llvm::TargetSchedModel::getWriteProcResEnd(), llvm::SUnit::isUnbuffered, llvm::MCProcResourceDesc::Name, llvm::SUnit::NodeNum, and OS.
Referenced by EmitInstruction(), and llvm::SystemZPostRASchedStrategy::pickNode().
void SystemZHazardRecognizer::emitInstruction | ( | MachineInstr * | MI, |
bool | TakenBranch = false |
||
) |
Wrap a non-scheduled instruction in an SU and emit it.
Definition at line 410 of file SystemZHazardRecognizer.cpp.
References assert(), llvm::MCProcResourceDesc::BufferSize, EmitInstruction(), llvm::TargetSchedModel::getProcResource(), llvm::TargetSchedModel::getWriteProcResBegin(), llvm::TargetSchedModel::getWriteProcResEnd(), llvm::SUnit::hasReservedResource, isBranchRetTrap(), llvm::SUnit::isCall, llvm::SUnit::isUnbuffered, llvm::make_range(), MI, and llvm::TargetSchedModel::resolveSchedClass().
Referenced by llvm::SystemZPostRASchedStrategy::enterMBB().
|
overridevirtual |
EmitInstruction - This callback is invoked when an instruction is emitted, to advance the hazard state.
Reimplemented from llvm::ScheduleHazardRecognizer.
Definition at line 270 of file SystemZHazardRecognizer.cpp.
References assert(), llvm::MCProcResourceDesc::BufferSize, CurGroupDbg, llvm::dbgs(), dumpCurrGroup(), dumpSU(), llvm::SUnit::getInstr(), llvm::TargetSchedModel::getProcResource(), getSchedClass(), llvm::TargetSchedModel::getWriteProcResBegin(), llvm::TargetSchedModel::getWriteProcResEnd(), llvm::SUnit::isCall, llvm::SUnit::isUnbuffered, LLVM_DEBUG, llvm::MCProcResourceDesc::Name, ProcResCostLim, and Reset().
Referenced by emitInstruction(), and llvm::SystemZPostRASchedStrategy::schedNode().
|
overridevirtual |
getHazardType - Return the hazard type of emitting this node.
There are three possible results. Either:
Reimplemented from llvm::ScheduleHazardRecognizer.
Definition at line 76 of file SystemZHazardRecognizer.cpp.
References llvm::ScheduleHazardRecognizer::Hazard, and llvm::ScheduleHazardRecognizer::NoHazard.
|
inline |
Definition at line 153 of file SystemZHazardRecognizer.h.
|
inline |
Resolves and cache a resolved scheduling class for an SUnit.
Definition at line 121 of file SystemZHazardRecognizer.h.
References llvm::SUnit::getInstr(), llvm::TargetSchedModel::hasInstrSchedModel(), llvm::TargetSchedModel::resolveSchedClass(), and llvm::SUnit::SchedClass.
Referenced by dumpSU(), EmitInstruction(), groupingCost(), llvm::SystemZPostRASchedStrategy::releaseTopNode(), and resourcesCost().
int SystemZHazardRecognizer::groupingCost | ( | SUnit * | SU | ) | const |
Return the cost of decoder grouping for SU.
If SU must start a new decoder group, this is negative if this fits the schedule or positive if it would mean ending a group prematurely. For normal instructions this returns 0.
Definition at line 340 of file SystemZHazardRecognizer.cpp.
References llvm::SUnit::getInstr(), and getSchedClass().
|
overridevirtual |
Reset - This callback is invoked when a new block of instructions is about to be schedule.
The hazard state should be set to an initialized state.
Reimplemented from llvm::ScheduleHazardRecognizer.
Definition at line 81 of file SystemZHazardRecognizer.cpp.
References CurGroupDbg, and LLVM_DEBUG.
Referenced by EmitInstruction(), and SystemZHazardRecognizer().
int SystemZHazardRecognizer::resourcesCost | ( | SUnit * | SU | ) |
Return the cost of SU in regards to processor resources usage.
A positive value means it would be better to wait with SU, while a negative value means it would be good to schedule SU next.
Definition at line 386 of file SystemZHazardRecognizer.cpp.
References getSchedClass(), llvm::TargetSchedModel::getWriteProcResBegin(), llvm::TargetSchedModel::getWriteProcResEnd(), and llvm::SUnit::isUnbuffered.
std::string llvm::SystemZHazardRecognizer::CurGroupDbg |
Definition at line 146 of file SystemZHazardRecognizer.h.
Referenced by copyState(), dumpCurrGroup(), EmitInstruction(), and Reset().