LLVM  8.0.1
Public Member Functions | Friends | List of all members
llvm::VectorizerValueMap Struct Reference

This is a helper struct for maintaining vectorization state. More...

#include "Transforms/Vectorize/VPlan.h"

Public Member Functions

 VectorizerValueMap (unsigned UF, unsigned VF)
 Construct an empty map with the given unroll and vectorization factors. More...
 
bool hasAnyVectorValue (Value *Key) const
 
bool hasVectorValue (Value *Key, unsigned Part) const
 
bool hasAnyScalarValue (Value *Key) const
 
bool hasScalarValue (Value *Key, const VPIteration &Instance) const
 
ValuegetVectorValue (Value *Key, unsigned Part)
 Retrieve the existing vector value that corresponds to Key and Part. More...
 
ValuegetScalarValue (Value *Key, const VPIteration &Instance)
 Retrieve the existing scalar value that corresponds to Key and Instance. More...
 
void setVectorValue (Value *Key, unsigned Part, Value *Vector)
 Set a vector value associated with Key and Part. More...
 
void setScalarValue (Value *Key, const VPIteration &Instance, Value *Scalar)
 Set a scalar value associated with Key and Instance. More...
 
void resetVectorValue (Value *Key, unsigned Part, Value *Vector)
 Reset the vector value associated with Key for the given Part. More...
 
void resetScalarValue (Value *Key, const VPIteration &Instance, Value *Scalar)
 Reset the scalar value associated with Key for Part and Lane. More...
 

Friends

struct VPTransformState
 

Detailed Description

This is a helper struct for maintaining vectorization state.

It's used for mapping values from the original loop to their corresponding values in the new loop. Two mappings are maintained: one for vectorized values and one for scalarized values. Vectorized values are represented with UF vector values in the new loop, and scalarized values are represented with UF x VF scalar values in the new loop. UF and VF are the unroll and vectorization factors, respectively.

Entries can be added to either map with setVectorValue and setScalarValue, which assert that an entry was not already added before. If an entry is to replace an existing one, call resetVectorValue and resetScalarValue. This is currently needed to modify the mapped values during "fix-up" operations that occur once the first phase of widening is complete. These operations include type truncation and the second phase of recurrence widening.

Entries from either map can be retrieved using the getVectorValue and getScalarValue functions, which assert that the desired value exists.

Definition at line 109 of file VPlan.h.

Constructor & Destructor Documentation

◆ VectorizerValueMap()

llvm::VectorizerValueMap::VectorizerValueMap ( unsigned  UF,
unsigned  VF 
)
inline

Construct an empty map with the given unroll and vectorization factors.

Definition at line 129 of file VPlan.h.

Member Function Documentation

◆ getScalarValue()

Value* llvm::VectorizerValueMap::getScalarValue ( Value Key,
const VPIteration Instance 
)
inline

◆ getVectorValue()

Value* llvm::VectorizerValueMap::getVectorValue ( Value Key,
unsigned  Part 
)
inline

◆ hasAnyScalarValue()

bool llvm::VectorizerValueMap::hasAnyScalarValue ( Value Key) const
inline
Returns
True if the map has any scalar entry for Key.

Definition at line 147 of file VPlan.h.

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

◆ hasAnyVectorValue()

bool llvm::VectorizerValueMap::hasAnyVectorValue ( Value Key) const
inline
Returns
True if the map has any vector entry for Key.

Definition at line 132 of file VPlan.h.

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

◆ hasScalarValue()

bool llvm::VectorizerValueMap::hasScalarValue ( Value Key,
const VPIteration Instance 
) const
inline
Returns
True if the map has a scalar entry for Key and Instance.

Definition at line 152 of file VPlan.h.

References assert(), llvm::VPIteration::Lane, llvm::VPIteration::Part, and llvm::SmallVectorBase::size().

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

◆ hasVectorValue()

bool llvm::VectorizerValueMap::hasVectorValue ( Value Key,
unsigned  Part 
) const
inline
Returns
True if the map has a vector entry for Key and Part.

Definition at line 137 of file VPlan.h.

References assert(), and llvm::SmallVectorBase::size().

Referenced by llvm::VPPredInstPHIRecipe::execute(), and llvm::InnerLoopVectorizer::getOrCreateVectorValue().

◆ resetScalarValue()

void llvm::VectorizerValueMap::resetScalarValue ( Value Key,
const VPIteration Instance,
Value Scalar 
)
inline

Reset the scalar value associated with Key for Part and Lane.

This function can be used to update values that have already been scalarized. This is the case for "fix-up" operations including scalar phi nodes for scalarized and predicated instructions.

Definition at line 217 of file VPlan.h.

References assert(), llvm::VPIteration::Lane, llvm::VPIteration::Part, and llvm::NVPTX::PTXLdStInstCode::Scalar.

Referenced by llvm::VPPredInstPHIRecipe::execute().

◆ resetVectorValue()

void llvm::VectorizerValueMap::resetVectorValue ( Value Key,
unsigned  Part,
Value Vector 
)
inline

Reset the vector value associated with Key for the given Part.

This function can be used to update values that have already been vectorized. This is the case for "fix-up" operations including type truncation and the second phase of recurrence vectorization.

Definition at line 208 of file VPlan.h.

References assert().

Referenced by llvm::VPPredInstPHIRecipe::execute(), llvm::InnerLoopVectorizer::fixFirstOrderRecurrence(), llvm::InnerLoopVectorizer::fixReduction(), llvm::InnerLoopVectorizer::packScalarIntoVectorValue(), and llvm::InnerLoopVectorizer::truncateToMinimalBitwidths().

◆ setScalarValue()

void llvm::VectorizerValueMap::setScalarValue ( Value Key,
const VPIteration Instance,
Value Scalar 
)
inline

◆ setVectorValue()

void llvm::VectorizerValueMap::setVectorValue ( Value Key,
unsigned  Part,
Value Vector 
)
inline

Friends And Related Function Documentation

◆ VPTransformState

friend struct VPTransformState
friend

Definition at line 110 of file VPlan.h.


The documentation for this struct was generated from the following file: