LLVM 24.0.0git
llvm::sandboxir::DGNode Class Reference

A DependencyGraph Node that points to an Instruction and contains memory dependency edges. More...

#include "llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h"

Inheritance diagram for llvm::sandboxir::DGNode:
[legend]

Public Types

using iterator = PredIterator
using succ_iterator = SuccIterator

Public Member Functions

 DGNode (Instruction *I)
 DGNode (const DGNode &Other)=delete
virtual ~DGNode ()
unsigned getNumUnscheduledDeps () const
 \Returns the number of unscheduled successors.
bool validUnscheduledDeps () const
void decrUnscheduledDeps ()
void incrUnscheduledDeps ()
void resetScheduleState ()
bool ready () const
 \Returns true if all dependent successors (or predecessors during top-down scheduling) have been scheduled.
bool scheduled () const
 \Returns true if this node has been scheduled.
void setScheduled ()
SchedBundlegetSchedBundle () const
 \Returns the scheduling bundle that this node belongs to, or nullptr.
bool comesBefore (const DGNode *Other)
 \Returns true if this is before Other in program order.
virtual iterator preds_begin (DependencyGraph &DAG)
virtual iterator preds_end (DependencyGraph &DAG)
iterator preds_begin (DependencyGraph &DAG) const
iterator preds_end (DependencyGraph &DAG) const
iterator_range< iteratorpreds (DependencyGraph &DAG) const
 \Returns a range of DAG predecessors nodes.
virtual succ_iterator succs_begin (DependencyGraph &DAG)
virtual succ_iterator succs_end (DependencyGraph &DAG)
succ_iterator succs_begin (DependencyGraph &DAG) const
succ_iterator succs_end (DependencyGraph &DAG) const
iterator_range< succ_iteratorsuccs (DependencyGraph &DAG) const
 \Returns a range of DAG successor nodes.
InstructiongetInstruction () const
virtual void print (raw_ostream &OS, bool PrintDeps=true) const
LLVM_DUMP_METHOD void dump () const

Static Public Member Functions

static bool isStackSaveOrRestoreIntrinsic (Instruction *I)
static bool isMemIntrinsic (IntrinsicInst *I)
 \Returns true if intrinsic I touches memory.
static bool isMemDepCandidate (Instruction *I)
 We consider I as a Memory Dependency Candidate instruction if it reads/write memory or if it has side-effects.
static bool isFenceLike (Instruction *I)
 \Returns true if I is fence like. It excludes non-mem intrinsics.
static bool isMemDepNodeCandidate (Instruction *I)
 \Returns true if I is a memory dependency candidate instruction.

Protected Member Functions

void setSchedBundle (SchedBundle &SB)
void clearSchedBundle ()
 DGNode (Instruction *I, DGNodeID ID)

Protected Attributes

InstructionI
DGNodeID SubclassID
 For isa/dyn_cast etc.
std::optional< unsignedUnscheduledDeps = 0
 The number of unscheduled successors (predecessors) depending on the scheduling direction.
bool Scheduled = false
 This is true if this node has been scheduled.
SchedBundleSB = nullptr
 The scheduler bundle that this node belongs to.

Friends

class SchedBundle
class MemDGNode
class DependencyGraph
raw_ostreamoperator<< (raw_ostream &OS, DGNode &N)

Detailed Description

A DependencyGraph Node that points to an Instruction and contains memory dependency edges.

Definition at line 146 of file DependencyGraph.h.

Member Typedef Documentation

◆ iterator

◆ succ_iterator

Constructor & Destructor Documentation

◆ DGNode() [1/3]

◆ DGNode() [2/3]

llvm::sandboxir::DGNode::DGNode ( Instruction * I)
inline

Definition at line 170 of file DependencyGraph.h.

References assert(), DGNode(), I, isMemDepNodeCandidate(), and SubclassID.

◆ DGNode() [3/3]

llvm::sandboxir::DGNode::DGNode ( const DGNode & Other)
delete

References DGNode(), and llvm::Other.

◆ ~DGNode()

llvm::sandboxir::DGNode::~DGNode ( )
virtual

Definition at line 149 of file DependencyGraph.cpp.

References SB.

Member Function Documentation

◆ clearSchedBundle()

void llvm::sandboxir::DGNode::clearSchedBundle ( )
inlineprotected

Definition at line 162 of file DependencyGraph.h.

◆ comesBefore()

bool llvm::sandboxir::DGNode::comesBefore ( const DGNode * Other)
inline

\Returns true if this is before Other in program order.

Definition at line 209 of file DependencyGraph.h.

References DGNode(), I, and llvm::Other.

◆ decrUnscheduledDeps()

void llvm::sandboxir::DGNode::decrUnscheduledDeps ( )
inline

Definition at line 186 of file DependencyGraph.h.

References assert(), and UnscheduledDeps.

Referenced by llvm::sandboxir::MemDGNode::removeMemPred().

◆ dump()

void llvm::sandboxir::DGNode::dump ( ) const

Definition at line 164 of file DependencyGraph.cpp.

References llvm::dbgs(), and print().

◆ getInstruction()

Instruction * llvm::sandboxir::DGNode::getInstruction ( ) const
inline

◆ getNumUnscheduledDeps()

unsigned llvm::sandboxir::DGNode::getNumUnscheduledDeps ( ) const
inline

\Returns the number of unscheduled successors.

Definition at line 176 of file DependencyGraph.h.

References assert(), and UnscheduledDeps.

◆ getSchedBundle()

SchedBundle * llvm::sandboxir::DGNode::getSchedBundle ( ) const
inline

\Returns the scheduling bundle that this node belongs to, or nullptr.

Definition at line 207 of file DependencyGraph.h.

References SB, and SchedBundle.

◆ incrUnscheduledDeps()

void llvm::sandboxir::DGNode::incrUnscheduledDeps ( )
inline

Definition at line 190 of file DependencyGraph.h.

References UnscheduledDeps.

Referenced by llvm::sandboxir::MemDGNode::addMemPred().

◆ isFenceLike()

bool llvm::sandboxir::DGNode::isFenceLike ( Instruction * I)
inlinestatic

\Returns true if I is fence like. It excludes non-mem intrinsics.

Definition at line 281 of file DependencyGraph.h.

References llvm::dyn_cast(), I, II, and isMemIntrinsic().

Referenced by isMemDepNodeCandidate(), and llvm::sandboxir::isOrdered().

◆ isMemDepCandidate()

bool llvm::sandboxir::DGNode::isMemDepCandidate ( Instruction * I)
inlinestatic

We consider I as a Memory Dependency Candidate instruction if it reads/write memory or if it has side-effects.

This is used by the dependency graph.

Definition at line 274 of file DependencyGraph.h.

References llvm::dyn_cast(), I, II, and isMemIntrinsic().

Referenced by isMemDepNodeCandidate(), and llvm::sandboxir::isOrdered().

◆ isMemDepNodeCandidate()

◆ isMemIntrinsic()

bool llvm::sandboxir::DGNode::isMemIntrinsic ( IntrinsicInst * I)
inlinestatic

\Returns true if intrinsic I touches memory.

This is used by the dependency graph.

Definition at line 266 of file DependencyGraph.h.

References I.

Referenced by isFenceLike(), and isMemDepCandidate().

◆ isStackSaveOrRestoreIntrinsic()

bool llvm::sandboxir::DGNode::isStackSaveOrRestoreIntrinsic ( Instruction * I)
inlinestatic

Definition at line 256 of file DependencyGraph.h.

References llvm::dyn_cast(), I, and II.

Referenced by isMemDepNodeCandidate().

◆ preds()

iterator_range< iterator > llvm::sandboxir::DGNode::preds ( DependencyGraph & DAG) const
inline

\Returns a range of DAG predecessors nodes.

If this is a MemDGNode then this will also include the memory dependency predecessors. Please note that this can include the same node more than once, if for example it's both a use-def predecessor and a mem dep predecessor.

Definition at line 229 of file DependencyGraph.h.

References DependencyGraph, llvm::make_range(), preds_begin(), and preds_end().

◆ preds_begin() [1/2]

virtual iterator llvm::sandboxir::DGNode::preds_begin ( DependencyGraph & DAG)
inlinevirtual

Reimplemented in llvm::sandboxir::MemDGNode.

Definition at line 211 of file DependencyGraph.h.

References DependencyGraph, and I.

Referenced by preds(), and preds_begin().

◆ preds_begin() [2/2]

iterator llvm::sandboxir::DGNode::preds_begin ( DependencyGraph & DAG) const
inline

Definition at line 219 of file DependencyGraph.h.

References DependencyGraph, DGNode(), and preds_begin().

◆ preds_end() [1/2]

virtual iterator llvm::sandboxir::DGNode::preds_end ( DependencyGraph & DAG)
inlinevirtual

Reimplemented in llvm::sandboxir::MemDGNode.

Definition at line 216 of file DependencyGraph.h.

References DependencyGraph, and I.

Referenced by preds(), and preds_end().

◆ preds_end() [2/2]

iterator llvm::sandboxir::DGNode::preds_end ( DependencyGraph & DAG) const
inline

Definition at line 222 of file DependencyGraph.h.

References DependencyGraph, DGNode(), and preds_end().

◆ print()

void llvm::sandboxir::DGNode::print ( raw_ostream & OS,
bool PrintDeps = true ) const
virtual

Reimplemented in llvm::sandboxir::MemDGNode.

Definition at line 156 of file DependencyGraph.cpp.

References I, Scheduled, and UnscheduledDeps.

Referenced by dump(), and llvm::sandboxir::MemDGNode::print().

◆ ready()

bool llvm::sandboxir::DGNode::ready ( ) const
inline

\Returns true if all dependent successors (or predecessors during top-down scheduling) have been scheduled.

Definition at line 198 of file DependencyGraph.h.

References UnscheduledDeps.

◆ resetScheduleState()

void llvm::sandboxir::DGNode::resetScheduleState ( )
inline

Definition at line 192 of file DependencyGraph.h.

References Scheduled, and UnscheduledDeps.

◆ scheduled()

bool llvm::sandboxir::DGNode::scheduled ( ) const
inline

\Returns true if this node has been scheduled.

Definition at line 200 of file DependencyGraph.h.

References Scheduled.

◆ setSchedBundle()

void llvm::sandboxir::DGNode::setSchedBundle ( SchedBundle & SB)
protected

Definition at line 143 of file DependencyGraph.cpp.

References SB, and SchedBundle.

◆ setScheduled()

void llvm::sandboxir::DGNode::setScheduled ( )
inline

Definition at line 201 of file DependencyGraph.h.

References Scheduled, and UnscheduledDeps.

◆ succs()

iterator_range< succ_iterator > llvm::sandboxir::DGNode::succs ( DependencyGraph & DAG) const
inline

\Returns a range of DAG successor nodes.

If this is a MemDGNode then this will also include the memory dependency successors. Please note that this can include the same node more than once, if for example it's both a use-def predecessor and a mem dep successor.

Definition at line 252 of file DependencyGraph.h.

References DependencyGraph, llvm::make_range(), succs_begin(), and succs_end().

◆ succs_begin() [1/2]

virtual succ_iterator llvm::sandboxir::DGNode::succs_begin ( DependencyGraph & DAG)
inlinevirtual

Reimplemented in llvm::sandboxir::MemDGNode.

Definition at line 234 of file DependencyGraph.h.

References DependencyGraph, and I.

Referenced by succs(), and succs_begin().

◆ succs_begin() [2/2]

succ_iterator llvm::sandboxir::DGNode::succs_begin ( DependencyGraph & DAG) const
inline

Definition at line 242 of file DependencyGraph.h.

References DependencyGraph, DGNode(), and succs_begin().

◆ succs_end() [1/2]

virtual succ_iterator llvm::sandboxir::DGNode::succs_end ( DependencyGraph & DAG)
inlinevirtual

Reimplemented in llvm::sandboxir::MemDGNode.

Definition at line 239 of file DependencyGraph.h.

References DependencyGraph, and I.

Referenced by succs(), and succs_end().

◆ succs_end() [2/2]

succ_iterator llvm::sandboxir::DGNode::succs_end ( DependencyGraph & DAG) const
inline

Definition at line 245 of file DependencyGraph.h.

References DependencyGraph, DGNode(), and succs_end().

◆ validUnscheduledDeps()

bool llvm::sandboxir::DGNode::validUnscheduledDeps ( ) const
inline
Returns
true if unscheduled successors(predecessors) contains valid data (for testing).

Definition at line 183 of file DependencyGraph.h.

References UnscheduledDeps.

◆ DependencyGraph

◆ MemDGNode

friend class MemDGNode
friend

Definition at line 166 of file DependencyGraph.h.

References MemDGNode.

Referenced by MemDGNode.

◆ operator<<

raw_ostream & operator<< ( raw_ostream & OS,
DGNode & N )
friend

Definition at line 300 of file DependencyGraph.h.

References DGNode(), and N.

◆ SchedBundle

friend class SchedBundle
friend

Definition at line 163 of file DependencyGraph.h.

References SchedBundle.

Referenced by getSchedBundle(), SchedBundle, and setSchedBundle().

Member Data Documentation

◆ I

◆ SB

SchedBundle* llvm::sandboxir::DGNode::SB = nullptr
protected

The scheduler bundle that this node belongs to.

Definition at line 159 of file DependencyGraph.h.

Referenced by getSchedBundle(), setSchedBundle(), and ~DGNode().

◆ Scheduled

bool llvm::sandboxir::DGNode::Scheduled = false
protected

This is true if this node has been scheduled.

Definition at line 157 of file DependencyGraph.h.

Referenced by llvm::sandboxir::MemDGNode::addMemPred(), print(), llvm::sandboxir::MemDGNode::removeMemPred(), resetScheduleState(), scheduled(), and setScheduled().

◆ SubclassID

DGNodeID llvm::sandboxir::DGNode::SubclassID
protected

For isa/dyn_cast etc.

Definition at line 151 of file DependencyGraph.h.

Referenced by DGNode(), and DGNode().

◆ UnscheduledDeps

std::optional<unsigned> llvm::sandboxir::DGNode::UnscheduledDeps = 0
protected

The number of unscheduled successors (predecessors) depending on the scheduling direction.

Optional represents whether the value is meaningless, e.g., after a node gets scheduled.

Definition at line 155 of file DependencyGraph.h.

Referenced by decrUnscheduledDeps(), getNumUnscheduledDeps(), incrUnscheduledDeps(), print(), ready(), resetScheduleState(), setScheduled(), and validUnscheduledDeps().


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