Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | class VPRecipeBuilder { | ||||
EdgeMaskCacheTy EdgeMaskCache; | EdgeMaskCacheTy EdgeMaskCache; | ||||
BlockMaskCacheTy BlockMaskCache; | BlockMaskCacheTy BlockMaskCache; | ||||
// VPlan-VPlan transformations support: Hold a mapping from ingredients to | // VPlan-VPlan transformations support: Hold a mapping from ingredients to | ||||
// their recipe. To save on memory, only do so for selected ingredients, | // their recipe. To save on memory, only do so for selected ingredients, | ||||
// marked by having a nullptr entry in this map. | // marked by having a nullptr entry in this map. | ||||
DenseMap<Instruction *, VPRecipeBase *> Ingredient2Recipe; | DenseMap<Instruction *, VPRecipeBase *> Ingredient2Recipe; | ||||
DenseMap<Instruction *, const InterleaveGroup<Instruction> *> InsertPtToGroup; | |||||
/// Check if \p I can be widened at the start of \p Range and possibly | /// Check if \p I can be widened at the start of \p Range and possibly | ||||
/// decrease the range such that the returned value holds for the entire \p | /// decrease the range such that the returned value holds for the entire \p | ||||
/// Range. The function should not be called for memory instructions or calls. | /// Range. The function should not be called for memory instructions or calls. | ||||
bool shouldWiden(Instruction *I, VFRange &Range) const; | bool shouldWiden(Instruction *I, VFRange &Range) const; | ||||
/// Check if the load or store instruction \p I should widened for \p | /// Check if the load or store instruction \p I should widened for \p | ||||
/// Range.Start and potentially masked. Such instructions are handled by a | /// Range.Start and potentially masked. Such instructions are handled by a | ||||
/// recipe that takes an additional VPInstruction for the mask. | /// recipe that takes an additional VPInstruction for the mask. | ||||
VPWidenMemoryInstructionRecipe * | VPRecipeBase *tryToWidenMemory(Instruction *I, VFRange &Range, | ||||
tryToWidenMemory(Instruction *I, VFRange &Range, VPlanPtr &Plan); | VPlanPtr &Plan); | ||||
/// Check if an induction recipe should be constructed for \I. If so build and | /// Check if an induction recipe should be constructed for \I. If so build and | ||||
/// return it. If not, return null. | /// return it. If not, return null. | ||||
VPWidenIntOrFpInductionRecipe *tryToOptimizeInductionPHI(PHINode *Phi) const; | VPWidenIntOrFpInductionRecipe *tryToOptimizeInductionPHI(PHINode *Phi) const; | ||||
/// Optimize the special case where the operand of \p I is a constant integer | /// Optimize the special case where the operand of \p I is a constant integer | ||||
/// induction variable. | /// induction variable. | ||||
VPWidenIntOrFpInductionRecipe * | VPWidenIntOrFpInductionRecipe * | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | public: | ||||
/// Mark given ingredient for recording its recipe once one is created for | /// Mark given ingredient for recording its recipe once one is created for | ||||
/// it. | /// it. | ||||
void recordRecipeOf(Instruction *I) { | void recordRecipeOf(Instruction *I) { | ||||
assert((!Ingredient2Recipe.count(I) || Ingredient2Recipe[I] == nullptr) && | assert((!Ingredient2Recipe.count(I) || Ingredient2Recipe[I] == nullptr) && | ||||
"Recipe already set for ingredient"); | "Recipe already set for ingredient"); | ||||
Ingredient2Recipe[I] = nullptr; | Ingredient2Recipe[I] = nullptr; | ||||
} | } | ||||
void recordInterleaveGroup(const InterleaveGroup<Instruction> *IG) { | |||||
InsertPtToGroup[IG->getInsertPos()] = IG; | |||||
} | |||||
/// Return the recipe created for given ingredient. | /// Return the recipe created for given ingredient. | ||||
VPRecipeBase *getRecipe(Instruction *I) { | VPRecipeBase *getRecipe(Instruction *I) { | ||||
assert(Ingredient2Recipe.count(I) && | assert(Ingredient2Recipe.count(I) && | ||||
"Recording this ingredients recipe was not requested"); | "Recording this ingredients recipe was not requested"); | ||||
assert(Ingredient2Recipe[I] != nullptr && | assert(Ingredient2Recipe[I] != nullptr && | ||||
"Ingredient doesn't have a recipe"); | "Ingredient doesn't have a recipe"); | ||||
return Ingredient2Recipe[I]; | return Ingredient2Recipe[I]; | ||||
} | } | ||||
Show All 20 Lines |