20#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
21#define LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
38class VPWidenMemoryInstructionRecipe;
55 const unsigned char SubclassID;
111#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
182 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
187 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
218#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
231 template <
typename IterT>
243 Op->removeUser(*
this);
267 Op->removeUser(*
this);
288 "Op must be an operand of the recipe");
296 "Op must be an operand of the recipe");
310 const unsigned char SubclassID;
316 void addDefinedValue(
VPValue *V) {
318 "can only add VPValue already linked with this VPDef");
324 void removeDefinedValue(
VPValue *V) {
325 assert(V->Def ==
this &&
"can only remove VPValue linked with this VPDef");
327 "VPValue to remove must be in DefinedValues");
347 VPWidenCanonicalIVSC,
350 VPWidenMemoryInstructionSC,
359 VPActiveLaneMaskPHISC,
360 VPFirstOrderRecurrencePHISC,
362 VPWidenIntOrFpInductionSC,
363 VPWidenPointerInductionSC,
367 VPFirstPHISC = VPBlendSC,
368 VPFirstHeaderPHISC = VPCanonicalIVPHISC,
369 VPLastHeaderPHISC = VPReductionPHISC,
370 VPLastPHISC = VPReductionPHISC,
373 VPDef(
const unsigned char SC) : SubclassID(SC) {}
378 "all defined VPValues should point to the containing VPDef");
379 assert(
D->getNumUsers() == 0 &&
380 "all defined VPValues should have no more users");
389 assert(DefinedValues.
size() == 1 &&
"must have exactly one defined value");
390 assert(DefinedValues[0] &&
"defined value must be non-null");
391 return DefinedValues[0];
394 assert(DefinedValues.
size() == 1 &&
"must have exactly one defined value");
395 assert(DefinedValues[0] &&
"defined value must be non-null");
396 return DefinedValues[0];
401 assert(DefinedValues[
I] &&
"defined value must be non-null");
402 return DefinedValues[
I];
405 assert(DefinedValues[
I] &&
"defined value must be non-null");
406 return DefinedValues[
I];
422#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
440 unsigned NextSlot = 0;
442 void assignSlot(
const VPValue *V);
443 void assignSlots(
const VPlan &Plan);
453 auto I = Slots.
find(V);
454 if (
I == Slots.
end())
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
This file defines the DenseMap class.
iv Induction Variable Users
mir Rename Register Operands
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This class represents an Operation in the Expression.
iterator find(const_arg_type_t< KeyT > Val)
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...
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
VPlan-based builder utility analogous to IRBuilder.
This class augments a recipe with a set of VPValues defined by the recipe.
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.
enum { VPBranchOnMaskSC, VPDerivedIVSC, VPExpandSCEVSC, VPInstructionSC, VPInterleaveSC, VPReductionSC, VPReplicateSC, VPScalarIVStepsSC, VPWidenCallSC, VPWidenCanonicalIVSC, VPWidenCastSC, VPWidenGEPSC, VPWidenMemoryInstructionSC, VPWidenSC, VPWidenSelectSC, VPBlendSC, VPPredInstPHISC, VPCanonicalIVPHISC, VPActiveLaneMaskPHISC, VPFirstOrderRecurrencePHISC, VPWidenPHISC, VPWidenIntOrFpInductionSC, VPWidenPointerInductionSC, VPReductionPHISC, VPFirstPHISC=VPBlendSC, VPFirstHeaderPHISC=VPCanonicalIVPHISC, VPLastHeaderPHISC=VPReductionPHISC, VPLastPHISC=VPReductionPHISC, } VPRecipeTy
An enumeration for keeping track of the concrete subclass of VPRecipeBase that is actually instantiat...
unsigned getVPDefID() const
VPDef(const unsigned char SC)
const VPValue * getVPValue(unsigned I) const
This is a concrete Recipe that models a single VPlan-level instruction.
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
This class can be used to assign consecutive numbers to all VPValues in a VPlan and allows querying t...
unsigned getSlot(const VPValue *V) const
VPSlotTracker(const VPlan *Plan=nullptr)
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
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
VPUser(ArrayRef< VPValue * > Operands, VPUserID ID)
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(const VPUser &)=delete
virtual bool onlyFirstLaneUsed(const VPValue *Op) const
Returns true if the VPUser only uses the first lane of operand Op.
VPUserID
Subclass identifier (for isa/dyn_cast).
iterator_range< const_operand_iterator > const_operand_range
VPUser(iterator_range< IterT > Operands, VPUserID ID)
SmallVectorImpl< VPValue * >::iterator operand_iterator
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)
VPUser(std::initializer_list< VPValue * > Operands, VPUserID ID)
VPUserID getVPUserID() const
bool hasDefiningRecipe() const
Returns true if this VPValue is defined by a recipe.
VPValue(Value *UV=nullptr)
Create a live-in VPValue.
Value * getUnderlyingValue()
Return the underlying Value attached to this VPValue.
bool hasMoreThanOneUniqueUser()
Returns true if the value has more than one unique user.
unsigned getVPValueID() const
VPRecipeBase * getDefiningRecipe()
Returns the recipe defining this VPValue or nullptr if it is not defined by a recipe,...
void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) 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
const Value * getLiveInIRValue() const
void addUser(VPUser &User)
@ VPVRecipeSC
A generic VPValue, like live-in values or defined by a recipe that defines multiple values.
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 dump() const
Dump the value to stderr (for debugging).
void setUnderlyingValue(Value *Val)
SmallVectorImpl< VPUser * >::iterator user_iterator
iterator_range< user_iterator > user_range
const_user_iterator user_end() const
void print(raw_ostream &OS, VPSlotTracker &Tracker) const
void replaceAllUsesWith(VPValue *New)
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
Value * getLiveInIRValue()
Returns the underlying IR value, if this VPValue is defined outside the scope of VPlan.
const Value * getUnderlyingValue() 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
bool isDefinedOutsideVectorRegions() const
Returns true if the VPValue is defined outside any vector regions, i.e.
A Recipe for widening load/store operations.
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
LLVM Value Representation.
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.
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...
DenseMap< VPValue *, Value * > VPValue2ValueTy
void erase_value(Container &C, ValueType V)
Wrapper function to remove a value from a container:
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
DenseMap< Value *, VPValue * > Value2VPValueTy