LLVM 20.0.0git
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
llvm::ScheduleDAGSDNodes Class Referenceabstract

ScheduleDAGSDNodes - A ScheduleDAG for scheduling SDNode-based DAGs. More...

#include "CodeGen/SelectionDAG/ScheduleDAGSDNodes.h"

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

Classes

class  RegDefIter
 RegDefIter - In place iteration over the values defined by an SUnit. More...
 

Public Member Functions

 ScheduleDAGSDNodes (MachineFunction &mf)
 
 ~ScheduleDAGSDNodes () override=default
 
void Run (SelectionDAG *dag, MachineBasicBlock *bb)
 Run - perform scheduling.
 
SUnitnewSUnit (SDNode *N)
 NewSUnit - Creates a new SUnit and return a ptr to it.
 
SUnitClone (SUnit *Old)
 Clone - Creates a clone of the specified SUnit.
 
void BuildSchedGraph (AAResults *AA)
 BuildSchedGraph - Build the SUnit graph from the selection dag that we are input.
 
void InitNumRegDefsLeft (SUnit *SU)
 InitNumRegDefsLeft - Determine the # of regs defined by this node.
 
virtual void computeLatency (SUnit *SU)
 computeLatency - Compute node latency.
 
virtual void computeOperandLatency (SDNode *Def, SDNode *Use, unsigned OpIdx, SDep &dep) const
 
virtual void Schedule ()=0
 Schedule - Order nodes according to selected style, filling in the Sequence member.
 
void VerifyScheduledSequence (bool isBottomUp)
 VerifyScheduledSequence - Verify that all SUnits are scheduled and consistent with the Sequence of scheduled instructions.
 
virtual MachineBasicBlockEmitSchedule (MachineBasicBlock::iterator &InsertPos)
 EmitSchedule - Insert MachineInstrs into the MachineBasicBlock according to the order specified in Sequence.
 
void dumpNode (const SUnit &SU) const override
 
void dump () const override
 
void dumpSchedule () const
 
std::string getGraphNodeLabel (const SUnit *SU) const override
 Returns a label for an SUnit node in a visualization of the ScheduleDAG.
 
std::string getDAGName () const override
 Return the basic block label.
 
virtual void getCustomGraphFeatures (GraphWriter< ScheduleDAG * > &GW) const
 
- Public Member Functions inherited from llvm::ScheduleDAG
 ScheduleDAG (const ScheduleDAG &)=delete
 
ScheduleDAGoperator= (const ScheduleDAG &)=delete
 
 ScheduleDAG (MachineFunction &mf)
 
virtual ~ScheduleDAG ()
 
void clearDAG ()
 Clears the DAG state (between regions).
 
const MCInstrDescgetInstrDesc (const SUnit *SU) const
 Returns the MCInstrDesc of this SUnit.
 
virtual void viewGraph (const Twine &Name, const Twine &Title)
 Pops up a GraphViz/gv window with the ScheduleDAG rendered using 'dot'.
 
virtual void viewGraph ()
 Out-of-line implementation with no arguments is handy for gdb.
 
virtual void dumpNode (const SUnit &SU) const =0
 
virtual void dump () const =0
 
void dumpNodeName (const SUnit &SU) const
 
virtual std::string getGraphNodeLabel (const SUnit *SU) const =0
 Returns a label for an SUnit node in a visualization of the ScheduleDAG.
 
virtual std::string getDAGName () const =0
 Returns a label for the region of code covered by the DAG.
 
virtual void addCustomGraphFeatures (GraphWriter< ScheduleDAG * > &) const
 Adds custom features for a visualization of the ScheduleDAG.
 
unsigned VerifyScheduledDAG (bool isBottomUp)
 Verifies that all SUnits were scheduled and that their state is consistent.
 

Static Public Member Functions

static bool isPassiveNode (SDNode *Node)
 isPassiveNode - Return true if the node is a non-scheduled leaf.
 

Public Attributes

MachineBasicBlockBB = nullptr
 
SelectionDAGDAG = nullptr
 
const InstrItineraryDataInstrItins
 
std::vector< SUnit * > Sequence
 The schedule. Null SUnit*'s represent noop instructions.
 
- Public Attributes inherited from llvm::ScheduleDAG
const TargetMachineTM
 Target processor.
 
const TargetInstrInfoTII
 Target instruction information.
 
const TargetRegisterInfoTRI
 Target processor register info.
 
MachineFunctionMF
 Machine function.
 
MachineRegisterInfoMRI
 Virtual/real register map.
 
std::vector< SUnitSUnits
 The scheduling units.
 
SUnit EntrySU
 Special node for the region entry.
 
SUnit ExitSU
 Special node for the region exit.
 
bool StressSched
 

Protected Member Functions

virtual bool forceUnitLatencies () const
 ForceUnitLatencies - Return true if all scheduling edges should be given a latency value of one.
 
- Protected Member Functions inherited from llvm::ScheduleDAG
void dumpNodeAll (const SUnit &SU) const
 

Detailed Description

ScheduleDAGSDNodes - A ScheduleDAG for scheduling SDNode-based DAGs.

Edges between SUnits are initially based on edges in the SelectionDAG, and additional edges can be added by the schedulers as heuristics. SDNodes such as Constants, Registers, and a few others that are not interesting to schedulers are not allocated SUnits.

SDNodes with MVT::Glue operands are grouped along with the flagged nodes into a single SUnit so that they are scheduled together.

SDNode-based scheduling graphs do not use SDep::Anti or SDep::Output edges. Physical register dependence information is not carried in the DAG and must be handled explicitly by schedulers.

Definition at line 46 of file ScheduleDAGSDNodes.h.

Constructor & Destructor Documentation

◆ ScheduleDAGSDNodes()

ScheduleDAGSDNodes::ScheduleDAGSDNodes ( MachineFunction mf)
explicit

Definition at line 50 of file ScheduleDAGSDNodes.cpp.

◆ ~ScheduleDAGSDNodes()

llvm::ScheduleDAGSDNodes::~ScheduleDAGSDNodes ( )
overridedefault

References Run().

Member Function Documentation

◆ BuildSchedGraph()

void ScheduleDAGSDNodes::BuildSchedGraph ( AAResults AA)

BuildSchedGraph - Build the SUnit graph from the selection dag that we are input.

This SUnit graph is similar to the SelectionDAG, but excludes nodes that aren't interesting to scheduling, and represents flagged together nodes with a single SUnit.

This SUnit graph is similar to the SelectionDAG, but excludes nodes that aren't interesting to scheduling, and represents glued together nodes with a single SUnit.

Definition at line 539 of file ScheduleDAGSDNodes.cpp.

◆ Clone()

SUnit * ScheduleDAGSDNodes::Clone ( SUnit Old)

◆ computeLatency()

void ScheduleDAGSDNodes::computeLatency ( SUnit SU)
virtual

◆ computeOperandLatency()

void ScheduleDAGSDNodes::computeOperandLatency ( SDNode Def,
SDNode Use,
unsigned  OpIdx,
SDep dep 
) const
virtual

◆ dump()

void ScheduleDAGSDNodes::dump ( ) const
overridevirtual

◆ dumpNode()

void ScheduleDAGSDNodes::dumpNode ( const SUnit SU) const
overridevirtual

◆ dumpSchedule()

void ScheduleDAGSDNodes::dumpSchedule ( ) const

Definition at line 714 of file ScheduleDAGSDNodes.cpp.

References llvm::dbgs(), dumpNode(), and Sequence.

◆ EmitSchedule()

MachineBasicBlock * ScheduleDAGSDNodes::EmitSchedule ( MachineBasicBlock::iterator InsertPos)
virtual

EmitSchedule - Insert MachineInstrs into the MachineBasicBlock according to the order specified in Sequence.

EmitSchedule - Emit the machine code in scheduled order.

Return the new InsertPos and MachineBasicBlock that contains this insertion point. ScheduleDAGSDNodes holds a BB pointer for convenience, but this does not necessarily refer to returned BB. The emitter may split blocks.

Definition at line 851 of file ScheduleDAGSDNodes.cpp.

References llvm::MachineFunction::addCallSiteInfo(), After, assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), BB, Before, llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::MachineBasicBlock::begin(), llvm::MachineFunction::begin(), llvm::SelectionDAG::ByvalParmDbgBegin(), llvm::SelectionDAG::ByvalParmDbgEnd(), DAG, llvm::SelectionDAG::DbgBegin(), llvm::SelectionDAG::DbgEnd(), llvm::SelectionDAG::DbgLabelBegin(), llvm::SelectionDAG::DbgLabelEnd(), llvm::TargetOptions::EmitCallSiteInfo, Emitter, llvm::SmallVectorBase< Size_T >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::MachineBasicBlock::end(), End, llvm::SelectionDAG::getCallSiteInfo(), llvm::MachineBasicBlock::getFirstNonPHI(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::SDNode::getGluedNode(), llvm::SelectionDAG::getHeapAllocSite(), llvm::SelectionDAG::getMMRAMetadata(), llvm::SUnit::getNode(), llvm::SelectionDAG::getNoMergeSiteInfo(), llvm::MachineBasicBlock::getParent(), llvm::SelectionDAG::getPCSections(), llvm::SelectionDAG::getTarget(), llvm::SelectionDAG::hasDebugValues(), I, llvm::MachineBasicBlock::insert(), llvm::TargetInstrInfo::insertNoop(), llvm::SUnit::isCloned, LHS, llvm::make_early_inc_range(), llvm::make_range(), llvm::ScheduleDAG::MF, MI, N, llvm::MachineInstr::NoMerge, llvm::TargetMachine::Options, llvm::SUnit::OrigNode, llvm::SmallVectorTemplateBase< T, bool >::pop_back(), ProcessSourceNode(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), RHS, Sequence, llvm::SmallVectorBase< Size_T >::size(), llvm::stable_sort(), and llvm::ScheduleDAG::TII.

◆ forceUnitLatencies()

virtual bool llvm::ScheduleDAGSDNodes::forceUnitLatencies ( ) const
inlineprotectedvirtual

ForceUnitLatencies - Return true if all scheduling edges should be given a latency value of one.

The default is to return false; schedulers may override this as needed.

Definition at line 173 of file ScheduleDAGSDNodes.h.

Referenced by computeLatency(), and computeOperandLatency().

◆ getCustomGraphFeatures()

void ScheduleDAGSDNodes::getCustomGraphFeatures ( GraphWriter< ScheduleDAG * > &  GW) const
virtual

◆ getDAGName()

std::string ScheduleDAGSDNodes::getDAGName ( ) const
overridevirtual

Return the basic block label.

Implements llvm::ScheduleDAG.

Definition at line 1095 of file ScheduleDAGSDNodes.cpp.

References BB, and llvm::MachineBasicBlock::getFullName().

◆ getGraphNodeLabel()

std::string ScheduleDAGSDNodes::getGraphNodeLabel ( const SUnit SU) const
overridevirtual

◆ InitNumRegDefsLeft()

void ScheduleDAGSDNodes::InitNumRegDefsLeft ( SUnit SU)

InitNumRegDefsLeft - Determine the # of regs defined by this node.

Definition at line 608 of file ScheduleDAGSDNodes.cpp.

References assert(), I, and llvm::SUnit::NumRegDefsLeft.

◆ isPassiveNode()

static bool llvm::ScheduleDAGSDNodes::isPassiveNode ( SDNode Node)
inlinestatic

isPassiveNode - Return true if the node is a non-scheduled leaf.

Definition at line 65 of file ScheduleDAGSDNodes.h.

References llvm::ISD::EntryToken.

◆ newSUnit()

SUnit * ScheduleDAGSDNodes::newSUnit ( SDNode N)

◆ Run()

void ScheduleDAGSDNodes::Run ( SelectionDAG dag,
MachineBasicBlock bb 
)

Run - perform scheduling.

Definition at line 55 of file ScheduleDAGSDNodes.cpp.

References BB, llvm::ScheduleDAG::clearDAG(), DAG, Schedule(), and Sequence.

Referenced by ~ScheduleDAGSDNodes().

◆ Schedule()

virtual void llvm::ScheduleDAGSDNodes::Schedule ( )
pure virtual

Schedule - Order nodes according to selected style, filling in the Sequence member.

Referenced by Run().

◆ VerifyScheduledSequence()

void ScheduleDAGSDNodes::VerifyScheduledSequence ( bool  isBottomUp)

VerifyScheduledSequence - Verify that all SUnits are scheduled and consistent with the Sequence of scheduled instructions.

VerifyScheduledSequence - Verify that all SUnits were scheduled and that their state is consistent with the nodes listed in Sequence.

Definition at line 728 of file ScheduleDAGSDNodes.cpp.

References assert(), llvm::count(), Sequence, and llvm::ScheduleDAG::VerifyScheduledDAG().

Member Data Documentation

◆ BB

MachineBasicBlock* llvm::ScheduleDAGSDNodes::BB = nullptr

◆ DAG

SelectionDAG* llvm::ScheduleDAGSDNodes::DAG = nullptr

◆ InstrItins

const InstrItineraryData* llvm::ScheduleDAGSDNodes::InstrItins

Definition at line 50 of file ScheduleDAGSDNodes.h.

Referenced by computeLatency(), and computeOperandLatency().

◆ Sequence

std::vector<SUnit*> llvm::ScheduleDAGSDNodes::Sequence

The schedule. Null SUnit*'s represent noop instructions.

Definition at line 53 of file ScheduleDAGSDNodes.h.

Referenced by dumpSchedule(), EmitSchedule(), Run(), and VerifyScheduledSequence().


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