LLVM  6.0.0svn
Public Member Functions | 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...
 

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 84 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 102 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 120 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 105 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 125 of file VPlan.h.

References assert(), llvm::VPIteration::Lane, llvm::VPIteration::Part, and llvm::SmallVectorTemplateCommon< T, typename >::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 110 of file VPlan.h.

References assert(), llvm::VPIteration::Part, and llvm::SmallVectorTemplateCommon< T, typename >::size().

Referenced by llvm::InnerLoopVectorizer::createBlockInMask(), 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 190 of file VPlan.h.

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

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

◆ 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 181 of file VPlan.h.

References assert(), and llvm::VPIteration::Part.

Referenced by llvm::InnerLoopVectorizer::createBlockInMask(), 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

Set a scalar value associated with Key and Instance.

Assumes such a value is not already set.

Definition at line 164 of file VPlan.h.

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

Referenced by llvm::InnerLoopVectorizer::buildScalarSteps(), llvm::InnerLoopVectorizer::scalarizeInstruction(), and llvm::InnerLoopVectorizer::widenPHIInstruction().

◆ setVectorValue()

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

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