LLVM 20.0.0git
Public Types | Public Member Functions | Protected Attributes | List of all members
llvm::ScheduleHazardRecognizer Class Reference

HazardRecognizer - This determines whether or not an instruction can be issued this cycle, and whether or not a noop needs to be inserted to handle the hazard. More...

#include "llvm/CodeGen/ScheduleHazardRecognizer.h"

Inheritance diagram for llvm::ScheduleHazardRecognizer:
Inheritance graph
[legend]

Public Types

enum  HazardType { NoHazard , Hazard , NoopHazard }
 

Public Member Functions

 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.
 

Protected Attributes

unsigned MaxLookAhead = 0
 MaxLookAhead - Indicate the number of cycles in the scoreboard state.
 

Detailed Description

HazardRecognizer - This determines whether or not an instruction can be issued this cycle, and whether or not a noop needs to be inserted to handle the hazard.

Definition at line 25 of file ScheduleHazardRecognizer.h.

Member Enumeration Documentation

◆ HazardType

Enumerator
NoHazard 
Hazard 
NoopHazard 

Definition at line 37 of file ScheduleHazardRecognizer.h.

Constructor & Destructor Documentation

◆ ScheduleHazardRecognizer()

llvm::ScheduleHazardRecognizer::ScheduleHazardRecognizer ( )
default

◆ ~ScheduleHazardRecognizer()

ScheduleHazardRecognizer::~ScheduleHazardRecognizer ( )
virtualdefault

Member Function Documentation

◆ AdvanceCycle()

virtual void llvm::ScheduleHazardRecognizer::AdvanceCycle ( )
inlinevirtual

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.

This should increment the internal state of the hazard recognizer so that previously "Hazard" instructions will now not be hazards.

Reimplemented in llvm::MultiHazardRecognizer, llvm::ScoreboardHazardRecognizer, llvm::GCNHazardRecognizer, llvm::ARMHazardRecognizerFPMLx, llvm::ARMBankConflictHazardRecognizer, llvm::HexagonHazardRecognizer, llvm::PPCDispatchGroupSBHazardRecognizer, and llvm::PPCHazardRecognizer970.

Definition at line 104 of file ScheduleHazardRecognizer.h.

Referenced by llvm::SchedBoundary::bumpCycle(), and EmitNoop().

◆ atIssueLimit()

virtual bool llvm::ScheduleHazardRecognizer::atIssueLimit ( ) const
inlinevirtual

atIssueLimit - Return true if no more instructions may be issued in this cycle.

FIXME: remove this once MachineScheduler is the only client.

Reimplemented in llvm::MultiHazardRecognizer, llvm::ScoreboardHazardRecognizer, and llvm::GCNHazardRecognizer.

Definition at line 51 of file ScheduleHazardRecognizer.h.

Referenced by llvm::MultiHazardRecognizer::atIssueLimit().

◆ EmitInstruction() [1/2]

virtual void llvm::ScheduleHazardRecognizer::EmitInstruction ( MachineInstr )
inlinevirtual

This overload will be used when the hazard recognizer is being used by a non-scheduling pass, which does not use SUnits.

Reimplemented in llvm::MultiHazardRecognizer, and llvm::GCNHazardRecognizer.

Definition at line 75 of file ScheduleHazardRecognizer.h.

◆ EmitInstruction() [2/2]

virtual void llvm::ScheduleHazardRecognizer::EmitInstruction ( SUnit )
inlinevirtual

◆ EmitNoop()

virtual void llvm::ScheduleHazardRecognizer::EmitNoop ( )
inlinevirtual

EmitNoop - This callback is invoked when a noop was added to the instruction stream.

Reimplemented in llvm::MultiHazardRecognizer, llvm::GCNHazardRecognizer, and llvm::PPCDispatchGroupSBHazardRecognizer.

Definition at line 113 of file ScheduleHazardRecognizer.h.

References AdvanceCycle().

Referenced by EmitNoops().

◆ EmitNoops()

virtual void llvm::ScheduleHazardRecognizer::EmitNoops ( unsigned  Quantity)
inlinevirtual

EmitNoops - This callback is invoked when noops were added to the instruction stream.

Definition at line 120 of file ScheduleHazardRecognizer.h.

References EmitNoop().

◆ getHazardType()

virtual HazardType llvm::ScheduleHazardRecognizer::getHazardType ( SUnit ,
int  Stalls = 0 
)
inlinevirtual

getHazardType - Return the hazard type of emitting this node.

There are three possible results. Either:

  • NoHazard: it is legal to issue this instruction on this cycle.
  • Hazard: issuing this instruction would stall the machine. If some other instruction is available, issue it first.
  • NoopHazard: issuing this instruction would break the program. If some other instruction can be issued, do so, otherwise issue a noop.

Reimplemented in llvm::MultiHazardRecognizer, llvm::ScoreboardHazardRecognizer, llvm::GCNHazardRecognizer, llvm::ARMHazardRecognizerFPMLx, llvm::ARMBankConflictHazardRecognizer, llvm::HexagonHazardRecognizer, llvm::PPCDispatchGroupSBHazardRecognizer, llvm::PPCHazardRecognizer970, and llvm::SystemZHazardRecognizer.

Definition at line 60 of file ScheduleHazardRecognizer.h.

References NoHazard.

Referenced by llvm::SchedBoundary::checkHazard().

◆ getMaxLookAhead()

unsigned llvm::ScheduleHazardRecognizer::getMaxLookAhead ( ) const
inline

Definition at line 43 of file ScheduleHazardRecognizer.h.

References MaxLookAhead.

Referenced by llvm::GCNHazardRecognizer::AdvanceCycle().

◆ isEnabled()

bool llvm::ScheduleHazardRecognizer::isEnabled ( ) const
inline

◆ PreEmitNoops() [1/2]

virtual unsigned llvm::ScheduleHazardRecognizer::PreEmitNoops ( MachineInstr )
inlinevirtual

This overload will be used when the hazard recognizer is being used by a non-scheduling pass, which does not use SUnits.

Reimplemented in llvm::MultiHazardRecognizer, and llvm::GCNHazardRecognizer.

Definition at line 88 of file ScheduleHazardRecognizer.h.

◆ PreEmitNoops() [2/2]

virtual unsigned llvm::ScheduleHazardRecognizer::PreEmitNoops ( SUnit )
inlinevirtual

PreEmitNoops - This callback is invoked prior to emitting an instruction.

It should return the number of noops to emit prior to the provided instruction. Note: This is only used during PostRA scheduling. EmitNoop is not called for these noops.

Reimplemented in llvm::MultiHazardRecognizer, and llvm::PPCDispatchGroupSBHazardRecognizer.

Definition at line 82 of file ScheduleHazardRecognizer.h.

Referenced by llvm::PPCDispatchGroupSBHazardRecognizer::PreEmitNoops().

◆ RecedeCycle()

virtual void llvm::ScheduleHazardRecognizer::RecedeCycle ( )
inlinevirtual

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.

Reimplemented in llvm::MultiHazardRecognizer, llvm::ScoreboardHazardRecognizer, llvm::GCNHazardRecognizer, llvm::ARMHazardRecognizerFPMLx, llvm::ARMBankConflictHazardRecognizer, and llvm::PPCDispatchGroupSBHazardRecognizer.

Definition at line 109 of file ScheduleHazardRecognizer.h.

Referenced by llvm::SchedBoundary::bumpCycle().

◆ Reset()

virtual void llvm::ScheduleHazardRecognizer::Reset ( )
inlinevirtual

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 in llvm::MultiHazardRecognizer, llvm::ScoreboardHazardRecognizer, llvm::GCNHazardRecognizer, llvm::ARMHazardRecognizerFPMLx, llvm::ARMBankConflictHazardRecognizer, llvm::HexagonHazardRecognizer, llvm::PPCDispatchGroupSBHazardRecognizer, llvm::PPCHazardRecognizer970, and llvm::SystemZHazardRecognizer.

Definition at line 67 of file ScheduleHazardRecognizer.h.

Referenced by llvm::SchedBoundary::bumpNode().

◆ ShouldPreferAnother()

virtual bool llvm::ScheduleHazardRecognizer::ShouldPreferAnother ( SUnit )
inlinevirtual

ShouldPreferAnother - This callback may be invoked if getHazardType returns NoHazard.

If, even though there is no hazard, it would be better to schedule another available instruction, this callback should return true.

Reimplemented in llvm::MultiHazardRecognizer, llvm::HexagonHazardRecognizer, llvm::GCNHazardRecognizer, and llvm::PPCDispatchGroupSBHazardRecognizer.

Definition at line 95 of file ScheduleHazardRecognizer.h.

Referenced by llvm::PPCDispatchGroupSBHazardRecognizer::ShouldPreferAnother().

Member Data Documentation

◆ MaxLookAhead

unsigned llvm::ScheduleHazardRecognizer::MaxLookAhead = 0
protected

MaxLookAhead - Indicate the number of cycles in the scoreboard state.

Important to restore the state after backtracking. Additionally, MaxLookAhead=0 identifies a fake recognizer, allowing the client to bypass virtual calls. Currently the PostRA scheduler ignores it.

Definition at line 31 of file ScheduleHazardRecognizer.h.

Referenced by llvm::MultiHazardRecognizer::AddHazardRecognizer(), llvm::ARMBankConflictHazardRecognizer::ARMBankConflictHazardRecognizer(), llvm::ARMHazardRecognizerFPMLx::ARMHazardRecognizerFPMLx(), llvm::GCNHazardRecognizer::GCNHazardRecognizer(), getMaxLookAhead(), isEnabled(), and llvm::ScoreboardHazardRecognizer::ScoreboardHazardRecognizer().


The documentation for this class was generated from the following files: