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

The scheduling point in the context of the Scheduler points to the top-of-schedule (i.e., the top-most instruction of the top bundle) during bottom-up scheduling or the bottom of the schedule (i.e., the bottom-most instruction of the bottom bundle) during top-down. More...

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

Public Member Functions

 SchedulingPoint (BasicBlock::iterator It)
 Creates a scheduling point pointing at It, meaning any instruction in a BB or BB.end().
BasicBlock * atBeforeBeginOrNull () const
 If the SchedulingPoint points to before the beginning of a BB, then this returns that BB, else returns nullptr.
BasicBlock * atEndOrNull () const
 If the SchedulingPoint points after the last instruction in the BB then this returns the corresponding BasicBlock, nullptr otherwise.
Instruction * atInstrOrNull () const
 Returns the instruction pointed to by this SchedulingPoint or null if we are before/after BB.
 operator Instruction * () const
 Cast to Instruction *.
BasicBlock::iterator getIterator () const
 Returns the corresponding BB::iterator.
 operator BasicBlock::iterator () const
SchedulingPoint getNext () const
 Returns the SchedulingPoint pointing after this.
SchedulingPoint getPrev () const
 Returns the SchedulingPoint pointing before this.
bool operator== (const SchedulingPoint &Other) const
bool comesBefore (Instruction &I) const
 Returns true if the scheduling point is after I in program order.
void print (raw_ostream &OS) const
LLVM_DUMP_METHOD void dump () const

Static Public Member Functions

static SchedulingPoint createAt (BasicBlock::iterator It)
 Returns a SchedulingPoint that points to It.
static SchedulingPoint createBefore (BasicBlock::iterator It)
 Returns a SchedulingPoint that points to one element before It.
static SchedulingPoint createAfter (BasicBlock::iterator It)
 Returns a SchedulingPoint that points to one element after It.

Detailed Description

The scheduling point in the context of the Scheduler points to the top-of-schedule (i.e., the top-most instruction of the top bundle) during bottom-up scheduling or the bottom of the schedule (i.e., the bottom-most instruction of the bottom bundle) during top-down.

This class can be thought of as an extended BB::iterator, one that can not only point to after the last instruction in a BB (i.e., BB.end()), but also before the first instruction (i.e., something equivalent to prev(BB.begin()), which is not a legal BasicBlock::iterator).

This is needed for symmetric implementations of top-down and bottom-up scheduling. More specifically, if this is the first scheduling attempt we need the scheduling front to still point to a hypothetical last scheduling point. In bottom-up this can be at BB.end() but in top-down this can be before BB.begin(). This is why a BasicBlock::iterator is not suitable for this.

Definition at line 198 of file Scheduler.h.

Constructor & Destructor Documentation

◆ SchedulingPoint()

llvm::sandboxir::SchedulingPoint::SchedulingPoint ( BasicBlock::iterator It)
inline

Creates a scheduling point pointing at It, meaning any instruction in a BB or BB.end().

Definition at line 210 of file Scheduler.h.

Member Function Documentation

◆ atBeforeBeginOrNull()

BasicBlock * llvm::sandboxir::SchedulingPoint::atBeforeBeginOrNull ( ) const
inline

If the SchedulingPoint points to before the beginning of a BB, then this returns that BB, else returns nullptr.

Definition at line 230 of file Scheduler.h.

References llvm::sandboxir::BasicBlock().

Referenced by atInstrOrNull(), comesBefore(), getIterator(), getNext(), getPrev(), and print().

◆ atEndOrNull()

BasicBlock * llvm::sandboxir::SchedulingPoint::atEndOrNull ( ) const
inline

If the SchedulingPoint points after the last instruction in the BB then this returns the corresponding BasicBlock, nullptr otherwise.

Definition at line 237 of file Scheduler.h.

References llvm::sandboxir::BasicBlock().

Referenced by atInstrOrNull(), comesBefore(), getNext(), and print().

◆ atInstrOrNull()

Instruction * llvm::sandboxir::SchedulingPoint::atInstrOrNull ( ) const
inline

Returns the instruction pointed to by this SchedulingPoint or null if we are before/after BB.

Definition at line 245 of file Scheduler.h.

References atBeforeBeginOrNull(), and atEndOrNull().

Referenced by comesBefore(), operator Instruction *(), and print().

◆ comesBefore()

bool llvm::sandboxir::SchedulingPoint::comesBefore ( Instruction & I) const
inline

Returns true if the scheduling point is after I in program order.

Definition at line 281 of file Scheduler.h.

References assert(), atBeforeBeginOrNull(), atEndOrNull(), atInstrOrNull(), llvm::sandboxir::BasicBlock(), llvm::sandboxir::Instruction::comesBefore(), and I.

◆ createAfter()

SchedulingPoint llvm::sandboxir::SchedulingPoint::createAfter ( BasicBlock::iterator It)
inlinestatic

Returns a SchedulingPoint that points to one element after It.

Definition at line 223 of file Scheduler.h.

References assert().

◆ createAt()

SchedulingPoint llvm::sandboxir::SchedulingPoint::createAt ( BasicBlock::iterator It)
inlinestatic

Returns a SchedulingPoint that points to It.

Definition at line 212 of file Scheduler.h.

◆ createBefore()

SchedulingPoint llvm::sandboxir::SchedulingPoint::createBefore ( BasicBlock::iterator It)
inlinestatic

Returns a SchedulingPoint that points to one element before It.

Definition at line 216 of file Scheduler.h.

References llvm::sandboxir::BasicBlock(), and llvm::BasicBlock::begin().

◆ dump()

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

Definition at line 77 of file Scheduler.cpp.

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

◆ getIterator()

BasicBlock::iterator llvm::sandboxir::SchedulingPoint::getIterator ( ) const
inline

Returns the corresponding BB::iterator.

Asserts that we are not pointing before BB begin.

Definition at line 255 of file Scheduler.h.

References assert(), and atBeforeBeginOrNull().

Referenced by getNext(), getPrev(), and operator BasicBlock::iterator().

◆ getNext()

SchedulingPoint llvm::sandboxir::SchedulingPoint::getNext ( ) const
inline

◆ getPrev()

SchedulingPoint llvm::sandboxir::SchedulingPoint::getPrev ( ) const
inline

Returns the SchedulingPoint pointing before this.

Definition at line 268 of file Scheduler.h.

References assert(), atBeforeBeginOrNull(), llvm::BasicBlock::begin(), and getIterator().

Referenced by llvm::sandboxir::Scheduler::trySchedule().

◆ operator BasicBlock::iterator()

llvm::sandboxir::SchedulingPoint::operator BasicBlock::iterator ( ) const
inline

Definition at line 259 of file Scheduler.h.

References getIterator().

◆ operator Instruction *()

llvm::sandboxir::SchedulingPoint::operator Instruction * ( ) const
inline

Cast to Instruction *.

Asserts that we are pointing to an instruction and not before/after the beginning/end of a BB.

Definition at line 252 of file Scheduler.h.

References atInstrOrNull().

◆ operator==()

bool llvm::sandboxir::SchedulingPoint::operator== ( const SchedulingPoint & Other) const
inline

Definition at line 276 of file Scheduler.h.

References llvm::Other.

◆ print()

void llvm::sandboxir::SchedulingPoint::print ( raw_ostream & OS) const

Definition at line 68 of file Scheduler.cpp.

References atBeforeBeginOrNull(), atEndOrNull(), atInstrOrNull(), and llvm::sandboxir::BasicBlock().

Referenced by dump().


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