20#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
21#define LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
38struct VPDoubleValueDef;
55 const unsigned char SubclassID;
62 VPValue(
const unsigned char SC,
Value *UV =
nullptr)
63 : SubclassID(SC), UnderlyingVal(UV) {}
77 Value *getLiveInIRValue()
const;
91 assert(Users.empty() &&
"trying to delete a VPValue with remaining users");
99#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
115 if (
I != Users.end())
159 void replaceUsesWithIf(
172 bool isDefinedOutsideLoopRegions()
const;
176 assert(!UnderlyingVal &&
"Underlying Value is already set.");
182 const VPRecipeBase &R);
188 assert(UV &&
"VPIRValue requires an underlying IR value");
261 void removeOperand(
unsigned Idx) {
263 Operands.erase(Operands.begin() + Idx);
267#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
273 for (
VPValue *Operand : Operands)
283 Op->removeUser(*
this);
287 Operands.push_back(Operand);
293 assert(
N < Operands.size() &&
"Operand index out of bounds");
298 Operands[
I]->removeUser(*
this);
305 assert(Operands.size() == 2 &&
"must have 2 operands to swap");
330 "Op must be an operand of the recipe");
338 "Op must be an operand of the recipe");
346 "Op must be an operand of the recipe");
361 const unsigned char SubclassID;
369 "can only add VPValue already linked with this VPDef");
370 DefinedValues.push_back(V);
376 assert(V->Def ==
this &&
"can only remove VPValue linked with this VPDef");
378 "VPValue to remove must be in DefinedValues");
402 VPVectorEndPointerSC,
404 VPWidenCanonicalIVSC,
421 VPActiveLaneMaskPHISC,
423 VPFirstOrderRecurrencePHISC,
424 VPWidenIntOrFpInductionSC,
425 VPWidenPointerInductionSC,
429 VPFirstPHISC = VPWidenPHISC,
430 VPFirstHeaderPHISC = VPCanonicalIVPHISC,
431 VPLastHeaderPHISC = VPReductionPHISC,
432 VPLastPHISC = VPReductionPHISC,
435 VPDef(
const unsigned char SC) : SubclassID(SC) {}
440 "all defined VPValues should point to the containing VPDef");
441 assert(
D->getNumUsers() == 0 &&
442 "all defined VPValues should have no more users");
450 assert(DefinedValues.size() == 1 &&
"must have exactly one defined value");
451 assert(DefinedValues[0] &&
"defined value must be non-null");
452 return DefinedValues[0];
455 assert(DefinedValues.size() == 1 &&
"must have exactly one defined value");
456 assert(DefinedValues[0] &&
"defined value must be non-null");
457 return DefinedValues[0];
462 assert(DefinedValues[
I] &&
"defined value must be non-null");
463 return DefinedValues[
I];
466 assert(DefinedValues[
I] &&
"defined value must be non-null");
467 return DefinedValues[
I];
483#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
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
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file defines the SmallVector class.
static const BasicSubtargetSubTypeKV * find(StringRef S, ArrayRef< BasicSubtargetSubTypeKV > A)
Find KV in array using binary search.
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
bool isZero() const
Determine if this value is zero, i.e. all bits are clear.
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool isOne() const
Determine if this is a value of 1.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This is the shared class of boolean and integer constants.
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...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
This class augments a recipe with a set of VPValues defined by the recipe.
LLVM_ABI_FOR_TEST void dump() const
Dump the VPDef to stderr (for debugging).
unsigned getNumDefinedValues() const
Returns the number of values defined by the VPDef.
friend class VPRecipeValue
VPValue * getVPSingleValue()
Returns the only VPValue defined by the VPDef.
const VPValue * getVPSingleValue() const
virtual void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const =0
Each concrete VPDef prints itself.
enum { VPBranchOnMaskSC, VPDerivedIVSC, VPExpandSCEVSC, VPExpressionSC, VPIRInstructionSC, VPInstructionSC, VPInterleaveEVLSC, VPInterleaveSC, VPReductionEVLSC, VPReductionSC, VPReplicateSC, VPScalarIVStepsSC, VPVectorPointerSC, VPVectorEndPointerSC, VPWidenCallSC, VPWidenCanonicalIVSC, VPWidenCastSC, VPWidenGEPSC, VPWidenIntrinsicSC, VPWidenLoadEVLSC, VPWidenLoadSC, VPWidenStoreEVLSC, VPWidenStoreSC, VPWidenSC, 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...
VPValue * getVPValue(unsigned I)
Returns the VPValue with index I defined by the VPDef.
ArrayRef< VPRecipeValue * > definedValues() const
Returns an ArrayRef of the values defined by the VPDef.
ArrayRef< VPRecipeValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
unsigned getVPDefID() const
VPDef(const unsigned char SC)
const VPValue * getVPValue(unsigned I) const
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.
A VPValue defined by a recipe that produces one or more values.
virtual LLVM_ABI_FOR_TEST ~VPRecipeValue()
LLVM_ABI_FOR_TEST VPRecipeValue(VPDef *Def, Value *UV=nullptr)
static bool classof(const VPValue *V)
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
friend class VPPhiAccessors
Grant access to removeOperand for VPPhiAccessors, the only supported user.
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
iterator_range< const_operand_iterator > const_operand_range
virtual bool usesFirstPartOnly(const VPValue *Op) const
Returns true if the VPUser only uses the first part of operand Op.
void swapOperands()
Swap operands of the VPUser. It must have exactly 2 operands.
SmallVectorImpl< VPValue * >::iterator operand_iterator
virtual bool usesFirstLaneOnly(const VPValue *Op) const
Returns true if the VPUser only uses the first lane 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)
This is the base class of the VPlan Def/Use graph, used for modeling the data flow into,...
bool hasDefiningRecipe() const
Returns true if this VPValue is defined by a recipe.
unsigned getVPValueID() const
VPRecipeBase * getDefiningRecipe()
Returns the recipe defining this VPValue or nullptr if it is not defined by a recipe,...
void removeUser(VPUser &User)
Remove a single User from the list of users.
SmallVectorImpl< VPUser * >::const_iterator const_user_iterator
friend class VPRecipeValue
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 * getUnderlyingValue() const
Return the underlying Value attached to this VPValue.
const_user_range users() const
VPValue(const VPValue &)=delete
VPValue & operator=(const VPValue &)=delete
@ VPVSymbolicSC
A live-in VPValue wrapping an IR Value.
@ VPVRecipeValueSC
A symbolic live-in VPValue without IR backing.
const VPUser * getSingleUser() const
void setUnderlyingValue(Value *Val)
SmallVectorImpl< VPUser * >::iterator user_iterator
iterator_range< user_iterator > user_range
const_user_iterator user_end() const
VPUser * getSingleUser()
Return the single user of this value, or nullptr if there is not exactly one user.
user_iterator user_begin()
unsigned getNumUsers() const
friend struct VPSymbolicValue
friend struct VPDoubleValueDef
iterator_range< const_user_iterator > const_user_range
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)
void erase(Container &C, ValueType V)
Wrapper function to remove a value from a container:
SmallVector< ValueTypeFromRangeType< R >, Size > to_vector(R &&Range)
Given a range of type R, iterate the entire range and return a SmallVector with elements of the vecto...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
DWARFExpression::Operation Op
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
VPConstantInt(ConstantInt *CI)
static bool classof(const VPValue *V)
const APInt & getAPInt() const
uint64_t getZExtValue() const
unsigned getBitWidth() const
Value * getValue() const
Returns the underlying IR value.
static bool classof(const VPValue *V)
Type * getType() const
Returns the type of the underlying IR value.
static bool classof(const VPValue *V)