LLVM  14.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::VPLane Class Reference

In what follows, the term "input IR" refers to code that is fed into the vectorizer whereas the term "output IR" refers to code that is generated by the vectorizer. More...

#include "Transforms/Vectorize/VPlan.h"

Public Types

enum  Kind : uint8_t { Kind::First, Kind::ScalableLast }
 Kind describes how to interpret Lane. More...
 

Public Member Functions

 VPLane (unsigned Lane, Kind LaneKind)
 
unsigned getKnownLane () const
 Returns a compile-time known value for the lane index and asserts if the lane can only be calculated at runtime. More...
 
ValuegetAsRuntimeExpr (IRBuilder<> &Builder, const ElementCount &VF) const
 Returns an expression describing the lane index that can be used at runtime. More...
 
Kind getKind () const
 Returns the Kind of lane offset. More...
 
bool isFirstLane () const
 Returns true if this is the first lane of the whole vector. More...
 
unsigned mapToCacheIndex (const ElementCount &VF) const
 Maps the lane to a cache index based on VF. More...
 

Static Public Member Functions

static VPLane getFirstLane ()
 
static VPLane getLastLaneForVF (const ElementCount &VF)
 
static unsigned getNumCachedLanes (const ElementCount &VF)
 Returns the maxmimum number of lanes that we are able to consider caching for VF. More...
 

Detailed Description

In what follows, the term "input IR" refers to code that is fed into the vectorizer whereas the term "output IR" refers to code that is generated by the vectorizer.

VPLane provides a way to access lanes in both fixed width and scalable vectors, where for the latter the lane index sometimes needs calculating as a runtime expression.

Definition at line 101 of file VPlan.h.

Member Enumeration Documentation

◆ Kind

enum llvm::VPLane::Kind : uint8_t
strong

Kind describes how to interpret Lane.

Enumerator
First 

For First, Lane is the index into the first N elements of a fixed-vector <N x <ElTy>> or a scalable vector <vscale x N x <ElTy>>.

ScalableLast 

For ScalableLast, Lane is the offset from the start of the last N-element subvector in a scalable vector <vscale x N x <ElTy>>.

For example, a Lane of 0 corresponds to lane (vscale - 1) * N, a Lane of 1 corresponds to ((vscale - 1) * N) + 1, etc.

Definition at line 104 of file VPlan.h.

Constructor & Destructor Documentation

◆ VPLane()

llvm::VPLane::VPLane ( unsigned  Lane,
Kind  LaneKind 
)
inline

Definition at line 123 of file VPlan.h.

Referenced by getFirstLane(), and getLastLaneForVF().

Member Function Documentation

◆ getAsRuntimeExpr()

Value * VPLane::getAsRuntimeExpr ( IRBuilder<> &  Builder,
const ElementCount VF 
) const

Returns an expression describing the lane index that can be used at runtime.

Definition at line 63 of file VPlan.cpp.

References Builder, First, llvm::LinearPolySize< LeafTy >::getKnownMinValue(), llvm::getRuntimeVF(), llvm_unreachable, and ScalableLast.

Referenced by llvm::InnerLoopVectorizer::packScalarIntoVectorValue().

◆ getFirstLane()

static VPLane llvm::VPLane::getFirstLane ( )
inlinestatic

◆ getKind()

Kind llvm::VPLane::getKind ( ) const
inline

Returns the Kind of lane offset.

Definition at line 151 of file VPlan.h.

◆ getKnownLane()

unsigned llvm::VPLane::getKnownLane ( ) const
inline

Returns a compile-time known value for the lane index and asserts if the lane can only be calculated at runtime.

Definition at line 141 of file VPlan.h.

References assert(), and First.

◆ getLastLaneForVF()

static VPLane llvm::VPLane::getLastLaneForVF ( const ElementCount VF)
inlinestatic

◆ getNumCachedLanes()

static unsigned llvm::VPLane::getNumCachedLanes ( const ElementCount VF)
inlinestatic

Returns the maxmimum number of lanes that we are able to consider caching for VF.

Definition at line 170 of file VPlan.h.

References llvm::LinearPolySize< LeafTy >::getKnownMinValue(), and llvm::LinearPolySize< LeafTy >::isScalable().

◆ isFirstLane()

bool llvm::VPLane::isFirstLane ( ) const
inline

Returns true if this is the first lane of the whole vector.

Definition at line 154 of file VPlan.h.

References First.

Referenced by llvm::VPIteration::isFirstIteration().

◆ mapToCacheIndex()

unsigned llvm::VPLane::mapToCacheIndex ( const ElementCount VF) const
inline

Maps the lane to a cache index based on VF.

Definition at line 157 of file VPlan.h.

References assert(), llvm::LinearPolySize< LeafTy >::getKnownMinValue(), llvm::LinearPolySize< LeafTy >::isScalable(), and ScalableLast.


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