LLVM  6.0.0svn
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]
Collaboration diagram for llvm::ScheduleHazardRecognizer:
Collaboration 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. More...
 
virtual HazardType getHazardType (SUnit *m, int Stalls=0)
 getHazardType - Return the hazard type of emitting this node. More...
 
virtual void Reset ()
 Reset - This callback is invoked when a new block of instructions is about to be schedule. More...
 
virtual void EmitInstruction (SUnit *)
 EmitInstruction - This callback is invoked when an instruction is emitted, to advance the hazard state. More...
 
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. More...
 
virtual unsigned PreEmitNoops (SUnit *)
 PreEmitNoops - This callback is invoked prior to emitting an instruction. More...
 
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. More...
 
virtual bool ShouldPreferAnother (SUnit *)
 ShouldPreferAnother - This callback may be invoked if getHazardType returns NoHazard. More...
 
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. More...
 
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. More...
 
virtual void EmitNoop ()
 EmitNoop - This callback is invoked when a noop was added to the instruction stream. More...
 

Protected Attributes

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

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 26 of file ScheduleHazardRecognizer.h.

Member Enumeration Documentation

◆ HazardType

Enumerator
NoHazard 
Hazard 
NoopHazard 

Definition at line 38 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::ScoreboardHazardRecognizer, llvm::GCNHazardRecognizer, llvm::PPCHazardRecognizer970, llvm::HexagonHazardRecognizer, llvm::PPCDispatchGroupSBHazardRecognizer, and llvm::ARMHazardRecognizer.

Definition at line 105 of file ScheduleHazardRecognizer.h.

Referenced by 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::ScoreboardHazardRecognizer, and llvm::GCNHazardRecognizer.

Definition at line 52 of file ScheduleHazardRecognizer.h.

Referenced by FindCallSeqStart().

◆ EmitInstruction() [1/2]

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

EmitInstruction - This callback is invoked when an instruction is emitted, to advance the hazard state.

Reimplemented in llvm::ScoreboardHazardRecognizer, llvm::SystemZHazardRecognizer, llvm::PPCHazardRecognizer970, llvm::GCNHazardRecognizer, llvm::HexagonHazardRecognizer, llvm::PPCDispatchGroupSBHazardRecognizer, and llvm::ARMHazardRecognizer.

Definition at line 72 of file ScheduleHazardRecognizer.h.

Referenced by FindCallSeqStart().

◆ EmitInstruction() [2/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::GCNHazardRecognizer.

Definition at line 76 of file ScheduleHazardRecognizer.h.

◆ EmitNoop()

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

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

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

Definition at line 114 of file ScheduleHazardRecognizer.h.

References AdvanceCycle().

◆ getHazardType()

virtual HazardType llvm::ScheduleHazardRecognizer::getHazardType ( SUnit m,
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::ScoreboardHazardRecognizer, llvm::SystemZHazardRecognizer, llvm::GCNHazardRecognizer, llvm::PPCHazardRecognizer970, llvm::HexagonHazardRecognizer, llvm::ARMHazardRecognizer, and llvm::PPCDispatchGroupSBHazardRecognizer.

Definition at line 61 of file ScheduleHazardRecognizer.h.

References NoHazard.

Referenced by FindCallSeqStart().

◆ getMaxLookAhead()

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

Definition at line 44 of file ScheduleHazardRecognizer.h.

References MaxLookAhead.

Referenced by llvm::GCNHazardRecognizer::AdvanceCycle(), and FindCallSeqStart().

◆ isEnabled()

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

◆ PreEmitNoops() [1/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::GCNHazardRecognizer, and llvm::PPCDispatchGroupSBHazardRecognizer.

Definition at line 83 of file ScheduleHazardRecognizer.h.

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

◆ PreEmitNoops() [2/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::GCNHazardRecognizer.

Definition at line 89 of file ScheduleHazardRecognizer.h.

◆ 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::ScoreboardHazardRecognizer, llvm::GCNHazardRecognizer, llvm::PPCDispatchGroupSBHazardRecognizer, and llvm::ARMHazardRecognizer.

Definition at line 110 of file ScheduleHazardRecognizer.h.

Referenced by FindCallSeqStart().

◆ 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::ScoreboardHazardRecognizer, llvm::SystemZHazardRecognizer, llvm::PPCHazardRecognizer970, llvm::HexagonHazardRecognizer, llvm::PPCDispatchGroupSBHazardRecognizer, and llvm::ARMHazardRecognizer.

Definition at line 68 of file ScheduleHazardRecognizer.h.

Referenced by FindCallSeqStart(), and GetCostForDef().

◆ 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::HexagonHazardRecognizer, and llvm::PPCDispatchGroupSBHazardRecognizer.

Definition at line 96 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 32 of file ScheduleHazardRecognizer.h.

Referenced by llvm::GCNHazardRecognizer::GCNHazardRecognizer(), getMaxLookAhead(), and llvm::ScoreboardHazardRecognizer::ScoreboardHazardRecognizer().


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