Go to the documentation of this file.
20 #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
21 #define LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
38 class VPWidenMemoryInstructionRecipe;
55 const unsigned char SubclassID;
126 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
189 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
194 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
220 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
233 template <
typename IterT>
245 Op->removeUser(*
this);
269 Op->removeUser(*
this);
293 "Op must be an operand of the recipe");
301 "Op must be an operand of the recipe");
315 const unsigned char SubclassID;
321 void addDefinedValue(
VPValue *V) {
323 "can only add VPValue already linked with this VPDef");
329 void removeDefinedValue(
VPValue *V) {
331 "can only remove VPValue linked with this VPDef");
333 "VPValue to remove must be in DefinedValues");
352 VPWidenCanonicalIVSC,
354 VPWidenMemoryInstructionSC,
361 VPFirstOrderRecurrencePHISC,
363 VPWidenIntOrFpInductionSC,
364 VPWidenPointerInductionSC,
367 VPFirstPHISC = VPBlendSC,
368 VPLastPHISC = VPReductionPHISC,
376 "all defined VPValues should point to the containing VPDef");
377 assert(
D->getNumUsers() == 0 &&
378 "all defined VPValues should have no more users");
387 assert(DefinedValues.
size() == 1 &&
"must have exactly one defined value");
388 assert(DefinedValues[0] &&
"defined value must be non-null");
389 return DefinedValues[0];
392 assert(DefinedValues.
size() == 1 &&
"must have exactly one defined value");
393 assert(DefinedValues[0] &&
"defined value must be non-null");
394 return DefinedValues[0];
399 assert(DefinedValues[
I] &&
"defined value must be non-null");
400 return DefinedValues[
I];
403 assert(DefinedValues[
I] &&
"defined value must be non-null");
404 return DefinedValues[
I];
420 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
438 unsigned NextSlot = 0;
440 void assignSlot(
const VPValue *V);
441 void assignSlots(
const VPlan &Plan);
450 auto I = Slots.
find(V);
451 if (
I == Slots.
end())
459 #endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
VPUserID getVPUserID() const
operand_iterator op_end()
This is an optimization pass for GlobalISel generic memory operations.
VPUser(iterator_range< IterT > Operands, VPUserID ID)
const_user_iterator user_end() const
const VPDef * getDef() const
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
SmallVectorImpl< VPUser * >::iterator user_iterator
Value * getLiveInIRValue()
Returns the underlying IR value, if this VPValue is defined outside the scope of VPlan.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
VPValue * getVPSingleValue()
Returns the only VPValue defined by the VPDef.
virtual void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const =0
Each concrete VPDef prints itself.
iterator_range< user_iterator > user_range
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
VPValue & operator=(const VPValue &)=delete
void dump() const
Dump the value to stderr (for debugging).
operand_iterator op_begin()
VPDef(const unsigned char SC)
const VPValue * getVPSingleValue() const
void print(raw_ostream &OS, VPSlotTracker &Tracker) const
VPUserID
Subclass identifier (for isa/dyn_cast).
VPValue(const unsigned char SC, Value *UV=nullptr, VPDef *Def=nullptr)
SmallVectorImpl< VPValue * >::const_iterator const_operand_iterator
This class augments a recipe with a set of VPValues defined by the recipe.
VPUser(std::initializer_list< VPValue * > Operands, VPUserID ID)
This is a concrete Recipe that models a single VPlan-level instruction.
const_operand_iterator op_end() const
@ SC
CHAIN = SC CHAIN, Imm128 - System call.
VPlan-based builder utility analogous to IRBuilder.
void addUser(VPUser &User)
ArrayRef< VPValue * > definedValues() const
Returns an ArrayRef of the values defined by the VPDef.
void push_back(EltTy NewVal)
@ VPVWidenPointerInductionSC
void replaceAllUsesWith(VPValue *New)
This class implements an extremely fast bulk output stream that can only output to a stream.
@ VPVFirstOrderRecurrencePHISC
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
unsigned getNumDefinedValues() const
Returns the number of values defined by the VPDef.
const Value * getUnderlyingValue() const
const_user_range users() const
unsigned getNumOperands() const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
void erase_value(Container &C, ValueType V)
Wrapper function to remove a value from a container:
const Value * getLiveInIRValue() const
mir Rename Register Operands
void setOperand(unsigned I, VPValue *New)
VPDef * Def
Pointer to the VPDef that defines this VPValue.
unsigned getSlot(const VPValue *V) const
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
unsigned getNumUsers() const
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...
const_operand_iterator op_begin() const
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
iterator find(const_arg_type_t< KeyT > Val)
typename SuperClass::const_iterator const_iterator
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const_user_iterator user_begin() const
DenseMap< Value *, VPValue * > Value2VPValueTy
void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const
Print the operands to O.
A Recipe for widening load/store operations.
VPSlotTracker(const VPlan *Plan=nullptr)
user_iterator user_begin()
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
void addOperand(VPValue *Operand)
virtual bool onlyFirstLaneUsed(const VPValue *Op) const
Returns true if the VPUser only uses the first lane of operand Op.
const VPValue * getVPValue(unsigned I) const
VPValue * getVPValue(unsigned I)
Returns the VPValue with index I defined by the VPDef.
void setUnderlyingValue(Value *Val)
iterator_range< operand_iterator > operand_range
SmallVectorImpl< VPValue * >::iterator operand_iterator
static bool classof(const VPDef *Recipe)
Method to support type inquiry through isa, cast, and dyn_cast.
void dump() const
Dump the VPDef to stderr (for debugging).
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This class can be used to assign consecutive numbers to all VPValues in a VPlan and allows querying t...
VPUser(ArrayRef< VPValue * > Operands, VPUserID ID)
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
VPUser & operator=(const VPUser &)=delete
This class provides computation of slot numbers for LLVM Assembly writing.
iterator_range< const_user_iterator > const_user_range
DenseMap< VPValue *, Value * > VPValue2ValueTy
bool hasMoreThanOneUniqueUser()
Returns true if the value has more than one unique user.
enum { VPBranchOnMaskSC, VPExpandSCEVSC, VPInstructionSC, VPInterleaveSC, VPReductionSC, VPReplicateSC, VPScalarIVStepsSC, VPWidenCallSC, VPWidenCanonicalIVSC, VPWidenGEPSC, VPWidenMemoryInstructionSC, VPWidenSC, VPWidenSelectSC, VPBlendSC, VPCanonicalIVPHISC, VPFirstOrderRecurrencePHISC, VPWidenPHISC, VPWidenIntOrFpInductionSC, VPWidenPointerInductionSC, VPPredInstPHISC, VPReductionPHISC, VPFirstPHISC=VPBlendSC, VPLastPHISC=VPReductionPHISC, } VPRecipeTy
An enumeration for keeping track of the concrete subclass of VPRecipeBase that is actually instantiat...
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
typename SuperClass::iterator iterator
VPValue * getOperand(unsigned N) const
iv Induction Variable Users
A range adaptor for a pair of iterators.
ArrayRef< VPValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
virtual bool usesScalars(const VPValue *Op) const
Returns true if the VPUser uses scalars of operand Op.
unsigned getVPValueID() const
@ VPVWidenIntOrFpInductionSC
const_operand_range operands() const
void removeUser(VPUser &User)
Remove a single User from the list of users.
VPValue(Value *UV=nullptr, VPDef *Def=nullptr)
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
unsigned getVPDefID() const
Value * getUnderlyingValue()
Return the underlying Value attached to this VPValue.
SmallVectorImpl< VPUser * >::const_iterator const_user_iterator
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
LLVM Value Representation.
void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const
Optional< std::vector< StOtherPiece > > Other
iterator_range< const_operand_iterator > const_operand_range