20#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
21#define LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
37struct VPDoubleValueDef;
41class VPInterleaveRecipe;
50 friend struct VPDoubleValueDef;
55 const unsigned char SubclassID;
105#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
141 if (getNumUsers() == 0)
145 auto Current = std::next(user_begin());
146 while (Current != user_end() && *user_begin() == *Current)
148 return Current != user_end();
156 void replaceUsesWithIf(
169 bool isLiveIn()
const {
return !hasDefiningRecipe(); }
176 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
177 return getUnderlyingValue();
181 bool isDefinedOutsideLoopRegions()
const;
185 assert(!UnderlyingVal &&
"Underlying Value is already set.");
205 void removeOperand(
unsigned Idx) {
211#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
227 Op->removeUser(*
this);
274 "Op must be an operand of the recipe");
282 "Op must be an operand of the recipe");
290 "Op must be an operand of the recipe");
304 const unsigned char SubclassID;
310 void addDefinedValue(
VPValue *V) {
312 "can only add VPValue already linked with this VPDef");
318 void removeDefinedValue(
VPValue *V) {
319 assert(V->Def ==
this &&
"can only remove VPValue linked with this VPDef");
321 "VPValue to remove must be in DefinedValues");
341 VPPartialReductionSC,
345 VPVectorEndPointerSC,
347 VPWidenCanonicalIVSC,
365 VPActiveLaneMaskPHISC,
367 VPFirstOrderRecurrencePHISC,
368 VPWidenIntOrFpInductionSC,
369 VPWidenPointerInductionSC,
373 VPFirstPHISC = VPWidenPHISC,
374 VPFirstHeaderPHISC = VPCanonicalIVPHISC,
375 VPLastHeaderPHISC = VPReductionPHISC,
376 VPLastPHISC = VPReductionPHISC,
379 VPDef(
const unsigned char SC) : SubclassID(SC) {}
384 "all defined VPValues should point to the containing VPDef");
385 assert(
D->getNumUsers() == 0 &&
386 "all defined VPValues should have no more users");
395 assert(DefinedValues.
size() == 1 &&
"must have exactly one defined value");
396 assert(DefinedValues[0] &&
"defined value must be non-null");
397 return DefinedValues[0];
400 assert(DefinedValues.
size() == 1 &&
"must have exactly one defined value");
401 assert(DefinedValues[0] &&
"defined value must be non-null");
402 return DefinedValues[0];
407 assert(DefinedValues[
I] &&
"defined value must be non-null");
408 return DefinedValues[
I];
411 assert(DefinedValues[
I] &&
"defined value must be non-null");
412 return DefinedValues[
I];
428#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
BlockVerifier::State From
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static void replaceAllUsesWith(Value *Old, Value *New, SmallPtrSet< BasicBlock *, 32 > &FreshBBs, bool IsHuge)
Replace all old uses with new ones, and push the updated BBs into FreshBBs.
#define LLVM_ABI_FOR_TEST
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
iv Induction Variable Users
mir Rename Register Operands
This file defines the SmallVector class.
static const BasicSubtargetSubTypeKV * find(StringRef S, ArrayRef< BasicSubtargetSubTypeKV > A)
Find KV in array using binary search.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This class represents an Operation in the Expression.
This class provides computation of slot numbers for LLVM Assembly writing.
typename SuperClass::const_iterator const_iterator
typename SuperClass::iterator iterator
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
void push_back(EltTy NewVal)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This class augments a recipe with a set of VPValues defined by the recipe.
enum { VPBranchOnMaskSC, VPDerivedIVSC, VPExpandSCEVSC, VPExpressionSC, VPIRInstructionSC, VPInstructionSC, VPInterleaveSC, VPReductionEVLSC, VPReductionSC, VPPartialReductionSC, VPReplicateSC, VPScalarIVStepsSC, VPVectorPointerSC, VPVectorEndPointerSC, VPWidenCallSC, VPWidenCanonicalIVSC, VPWidenCastSC, VPWidenGEPSC, VPWidenIntrinsicSC, VPWidenLoadEVLSC, VPWidenLoadSC, VPWidenStoreEVLSC, VPWidenStoreSC, VPWidenSC, VPWidenSelectSC, VPBlendSC, VPHistogramSC, VPWidenPHISC, VPPredInstPHISC, VPCanonicalIVPHISC, VPActiveLaneMaskPHISC, VPEVLBasedIVPHISC, VPFirstOrderRecurrencePHISC, VPWidenIntOrFpInductionSC, VPWidenPointerInductionSC, VPReductionPHISC, VPFirstPHISC=VPWidenPHISC, VPFirstHeaderPHISC=VPCanonicalIVPHISC, VPLastHeaderPHISC=VPReductionPHISC, VPLastPHISC=VPReductionPHISC, } VPRecipeTy
An enumeration for keeping track of the concrete subclass of VPRecipeBase that is actually instantiat...
void dump() const
Dump the VPDef to stderr (for debugging).
unsigned getNumDefinedValues() const
Returns the number of values defined by the VPDef.
ArrayRef< VPValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
VPValue * getVPSingleValue()
Returns the only VPValue defined by the VPDef.
const VPValue * getVPSingleValue() const
ArrayRef< VPValue * > definedValues() const
Returns an ArrayRef of the values defined by the VPDef.
virtual void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const =0
Each concrete VPDef prints itself.
VPValue * getVPValue(unsigned I)
Returns the VPValue with index I defined by the VPDef.
unsigned getVPDefID() const
VPDef(const unsigned char SC)
const VPValue * getVPValue(unsigned I) const
A recipe to combine multiple recipes into a single 'expression' recipe, which should be considered a ...
VPInterleaveRecipe is a recipe for transforming an interleave group of load or stores into one wide l...
Helper type to provide functions to access incoming values and blocks for phi-like recipes.
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
This class can be used to assign names to VPValues.
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
void replaceUsesOfWith(VPValue *From, VPValue *To)
Replaces all uses of From in the VPUser with To.
void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const
Print the operands to O.
void setOperand(unsigned I, VPValue *New)
VPUser & operator=(const VPUser &)=delete
unsigned getNumOperands() const
SmallVectorImpl< VPValue * >::const_iterator const_operand_iterator
const_operand_iterator op_begin() const
operand_iterator op_end()
const_operand_range operands() const
operand_iterator op_begin()
VPValue * getOperand(unsigned N) const
VPUser(ArrayRef< VPValue * > Operands)
VPUser(const VPUser &)=delete
virtual bool onlyFirstLaneUsed(const VPValue *Op) const
Returns true if the VPUser only uses the first lane of operand Op.
iterator_range< const_operand_iterator > const_operand_range
void swapOperands()
Swap operands of the VPUser. It must have exactly 2 operands.
SmallVectorImpl< VPValue * >::iterator operand_iterator
virtual bool onlyFirstPartUsed(const VPValue *Op) const
Returns true if the VPUser only uses the first part of operand Op.
const_operand_iterator op_end() const
virtual bool usesScalars(const VPValue *Op) const
Returns true if the VPUser uses scalars of operand Op.
iterator_range< operand_iterator > operand_range
void addOperand(VPValue *Operand)
bool hasDefiningRecipe() const
Returns true if this VPValue is defined by a recipe.
VPValue(Value *UV=nullptr)
Create a live-in VPValue.
unsigned getVPValueID() const
void removeUser(VPUser &User)
Remove a single User from the list of users.
SmallVectorImpl< VPUser * >::const_iterator const_user_iterator
const_user_iterator user_begin() const
void addUser(VPUser &User)
bool hasMoreThanOneUniqueUser() const
Returns true if the value has more than one unique user.
Value * getLiveInIRValue() const
Returns the underlying IR value, if this VPValue is defined outside the scope of VPlan.
Value * getUnderlyingValue() const
Return the underlying Value attached to this VPValue.
VPValue(Value *UV, VPDef *Def)
Create a VPValue for a Def which defines multiple values.
const_user_range users() const
VPValue(const VPValue &)=delete
VPValue & operator=(const VPValue &)=delete
void setUnderlyingValue(Value *Val)
SmallVectorImpl< VPUser * >::iterator user_iterator
iterator_range< user_iterator > user_range
const_user_iterator user_end() const
VPValue(VPDef *Def, Value *UV=nullptr)
Create a VPValue for a Def which is a subclass of VPValue.
user_iterator user_begin()
unsigned getNumUsers() const
bool isLiveIn() const
Returns true if this VPValue is a live-in, i.e. defined outside the VPlan.
VPDef * Def
Pointer to the VPDef that defines this VPValue.
iterator_range< const_user_iterator > const_user_range
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
LLVM Value Representation.
An efficient, type-erasing, non-owning reference to a callable.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
void erase(Container &C, ValueType V)
Wrapper function to remove a value from a container:
DenseMap< VPValue *, Value * > VPValue2ValueTy
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
DenseMap< Value *, VPValue * > Value2VPValueTy
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.