LLVM 20.0.0git
Public Types | Public Member Functions | Protected Attributes | List of all members
llvm::sandboxir::SeedBundle Class Referenceabstract

A set of candidate Instructions for vectorizing together. More...

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

Inheritance diagram for llvm::sandboxir::SeedBundle:
Inheritance graph
[legend]

Public Types

using iterator = SmallVector< Instruction * >::iterator
 
using const_iterator = SmallVector< Instruction * >::const_iterator
 

Public Member Functions

 SeedBundle (Instruction *I)
 Initialize a bundle with I.
 
 SeedBundle (SmallVector< Instruction * > &&L)
 
 SeedBundle (const SeedBundle &)=delete
 No need to allow copies.
 
SeedBundleoperator= (const SeedBundle &)=delete
 
virtual ~SeedBundle ()
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
Instructionoperator[] (unsigned Idx) const
 
void insertAt (iterator Pos, Instruction *I)
 Insert I into position P.
 
virtual void insert (Instruction *I, ScalarEvolution &SE)=0
 
unsigned getFirstUnusedElementIdx () const
 
void setUsed (Instruction *I)
 Marks instruction I "used" within the bundle.
 
void setUsed (unsigned ElementIdx, unsigned Sz=1, bool VerifyUnused=true)
 
bool isUsed (unsigned Element) const
 \Returns whether or not Element has been used.
 
bool allUsed () const
 
unsigned getNumUnusedBits () const
 
MutableArrayRef< Instruction * > getSlice (unsigned StartIdx, unsigned MaxVecRegBits, bool ForcePowOf2)
 \Returns a slice of seed elements, starting at the element StartIdx, with a total size <= MaxVecRegBits, or an empty slice if the requirements cannot be met .
 
std::size_t size () const
 \Returns the number of seed elements in the bundle.
 
void dump (raw_ostream &OS) const
 
LLVM_DUMP_METHOD void dump () const
 

Protected Attributes

SmallVector< Instruction * > Seeds
 
BitVector UsedLanes
 The lanes that we have already vectorized.
 
unsigned UsedLaneCount = 0
 Tracks used lanes for constant-time accessor.
 
unsigned NumUnusedBits = 0
 Tracks the remaining bits available to vectorize.
 

Detailed Description

A set of candidate Instructions for vectorizing together.

Definition at line 27 of file SeedCollector.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 41 of file SeedCollector.h.

◆ iterator

Definition at line 40 of file SeedCollector.h.

Constructor & Destructor Documentation

◆ SeedBundle() [1/3]

llvm::sandboxir::SeedBundle::SeedBundle ( Instruction I)
inlineexplicit

Initialize a bundle with I.

Definition at line 30 of file SeedCollector.h.

References begin(), I, and insertAt().

◆ SeedBundle() [2/3]

llvm::sandboxir::SeedBundle::SeedBundle ( SmallVector< Instruction * > &&  L)
inlineexplicit

Definition at line 31 of file SeedCollector.h.

References llvm::sandboxir::Utils::getNumBits(), NumUnusedBits, and Seeds.

◆ SeedBundle() [3/3]

llvm::sandboxir::SeedBundle::SeedBundle ( const SeedBundle )
delete

No need to allow copies.

◆ ~SeedBundle()

virtual llvm::sandboxir::SeedBundle::~SeedBundle ( )
inlinevirtual

Definition at line 38 of file SeedCollector.h.

Member Function Documentation

◆ allUsed()

bool llvm::sandboxir::SeedBundle::allUsed ( ) const
inline

Definition at line 91 of file SeedCollector.h.

References Seeds, and UsedLaneCount.

◆ begin() [1/2]

iterator llvm::sandboxir::SeedBundle::begin ( )
inline

Definition at line 42 of file SeedCollector.h.

References Seeds.

Referenced by llvm::sandboxir::MemSeedBundle< LoadOrStoreT >::insert(), SeedBundle(), and setUsed().

◆ begin() [2/2]

const_iterator llvm::sandboxir::SeedBundle::begin ( ) const
inline

Definition at line 44 of file SeedCollector.h.

References Seeds.

◆ dump() [1/2]

LLVM_DUMP_METHOD void llvm::sandboxir::SeedBundle::dump ( ) const
inline

Definition at line 125 of file SeedCollector.h.

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

Referenced by dump().

◆ dump() [2/2]

void llvm::sandboxir::SeedBundle::dump ( raw_ostream OS) const
inline

Definition at line 115 of file SeedCollector.h.

References llvm::enumerate(), I, isUsed(), and OS.

◆ end() [1/2]

iterator llvm::sandboxir::SeedBundle::end ( )
inline

Definition at line 43 of file SeedCollector.h.

References Seeds.

Referenced by llvm::sandboxir::MemSeedBundle< LoadOrStoreT >::insert(), and setUsed().

◆ end() [2/2]

const_iterator llvm::sandboxir::SeedBundle::end ( ) const
inline

Definition at line 45 of file SeedCollector.h.

References Seeds.

◆ getFirstUnusedElementIdx()

unsigned llvm::sandboxir::SeedBundle::getFirstUnusedElementIdx ( ) const
inline

Definition at line 59 of file SeedCollector.h.

References isUsed(), and Seeds.

◆ getNumUnusedBits()

unsigned llvm::sandboxir::SeedBundle::getNumUnusedBits ( ) const
inline

Definition at line 92 of file SeedCollector.h.

References NumUnusedBits.

◆ getSlice()

MutableArrayRef< Instruction * > llvm::sandboxir::SeedBundle::getSlice ( unsigned  StartIdx,
unsigned  MaxVecRegBits,
bool  ForcePowOf2 
)

\Returns a slice of seed elements, starting at the element StartIdx, with a total size <= MaxVecRegBits, or an empty slice if the requirements cannot be met .

If ForcePowOf2 is true, then the returned slice will have a total number of bits that is a power of 2.

Definition at line 34 of file SeedCollector.cpp.

References assert(), llvm::sandboxir::Utils::getNumBits(), llvm::isPowerOf2_32(), isUsed(), llvm::make_range(), and Seeds.

◆ insert()

virtual void llvm::sandboxir::SeedBundle::insert ( Instruction I,
ScalarEvolution SE 
)
pure virtual

◆ insertAt()

void llvm::sandboxir::SeedBundle::insertAt ( iterator  Pos,
Instruction I 
)
inline

Insert I into position P.

Clients should choose Pos by symbol, symbol-offset, and program order (which depends if scheduling bottom-up or top-down).

Definition at line 52 of file SeedCollector.h.

References llvm::sandboxir::Utils::getNumBits(), I, NumUnusedBits, and Seeds.

Referenced by llvm::sandboxir::MemSeedBundle< LoadOrStoreT >::insert(), and SeedBundle().

◆ isUsed()

bool llvm::sandboxir::SeedBundle::isUsed ( unsigned  Element) const
inline

\Returns whether or not Element has been used.

Definition at line 88 of file SeedCollector.h.

References llvm::BitVector::size(), llvm::BitVector::test(), and UsedLanes.

Referenced by dump(), getFirstUnusedElementIdx(), and getSlice().

◆ operator=()

SeedBundle & llvm::sandboxir::SeedBundle::operator= ( const SeedBundle )
delete

◆ operator[]()

Instruction * llvm::sandboxir::SeedBundle::operator[] ( unsigned  Idx) const
inline

Definition at line 47 of file SeedCollector.h.

References Idx, and Seeds.

◆ setUsed() [1/2]

void llvm::sandboxir::SeedBundle::setUsed ( Instruction I)
inline

Marks instruction I "used" within the bundle.

Clients use this property when assembling a vectorized instruction from the seeds in a bundle. This allows constant time evaluation and "removal" from the list.

Definition at line 69 of file SeedCollector.h.

References assert(), begin(), end(), I, Idx, and setUsed().

Referenced by llvm::sandboxir::SeedContainer::erase(), and setUsed().

◆ setUsed() [2/2]

void llvm::sandboxir::SeedBundle::setUsed ( unsigned  ElementIdx,
unsigned  Sz = 1,
bool  VerifyUnused = true 
)
inline

◆ size()

std::size_t llvm::sandboxir::SeedBundle::size ( ) const
inline

\Returns the number of seed elements in the bundle.

Definition at line 102 of file SeedCollector.h.

References Seeds.

Member Data Documentation

◆ NumUnusedBits

unsigned llvm::sandboxir::SeedBundle::NumUnusedBits = 0
protected

Tracks the remaining bits available to vectorize.

Definition at line 111 of file SeedCollector.h.

Referenced by getNumUnusedBits(), insertAt(), SeedBundle(), and setUsed().

◆ Seeds

SmallVector<Instruction *> llvm::sandboxir::SeedBundle::Seeds
protected

◆ UsedLaneCount

unsigned llvm::sandboxir::SeedBundle::UsedLaneCount = 0
protected

Tracks used lanes for constant-time accessor.

Definition at line 109 of file SeedCollector.h.

Referenced by allUsed(), and setUsed().

◆ UsedLanes

BitVector llvm::sandboxir::SeedBundle::UsedLanes
protected

The lanes that we have already vectorized.

Definition at line 107 of file SeedCollector.h.

Referenced by isUsed(), and setUsed().


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