@@ -1115,6 +1115,33 @@ class VPInstructionWithType : public VPInstruction {
11151115#endif
11161116};
11171117
1118+ // / Helper type to provide functions to access incoming values and blocks for
1119+ // / phi-like recipes.
1120+ class VPPhiAccessors {
1121+ protected:
1122+ // / Return a VPRecipeBase* to the current object.
1123+ virtual const VPRecipeBase *getAsRecipe () const = 0;
1124+
1125+ public:
1126+ virtual ~VPPhiAccessors () = default ;
1127+
1128+ // / Returns the incoming VPValue with index \p Idx.
1129+ VPValue *getIncomingValue (unsigned Idx) const {
1130+ return getAsRecipe ()->getOperand (Idx);
1131+ }
1132+
1133+ // / Returns the incoming block with index \p Idx.
1134+ const VPBasicBlock *getIncomingBlock (unsigned Idx) const ;
1135+
1136+ // / Returns the number of incoming values, also number of incoming blocks.
1137+ unsigned getNumIncoming () const { return getAsRecipe ()->getNumOperands (); }
1138+
1139+ #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1140+ // / Print the recipe.
1141+ void printPhiOperands (raw_ostream &O, VPSlotTracker &SlotTracker) const ;
1142+ #endif
1143+ };
1144+
11181145// / A recipe to wrap on original IR instruction not to be modified during
11191146// / execution, except for PHIs. PHIs are modeled via the VPIRPhi subclass.
11201147// / Expect PHIs, VPIRInstructions cannot have any operands.
@@ -1181,33 +1208,6 @@ class VPIRInstruction : public VPRecipeBase {
11811208 void extractLastLaneOfFirstOperand (VPBuilder &Builder);
11821209};
11831210
1184- // / Helper type to provide functions to access incoming values and blocks for
1185- // / phi-like recipes.
1186- class VPPhiAccessors {
1187- protected:
1188- // / Return a VPRecipeBase* to the current object.
1189- virtual const VPRecipeBase *getAsRecipe () const = 0;
1190-
1191- public:
1192- virtual ~VPPhiAccessors () = default ;
1193-
1194- // / Returns the incoming VPValue with index \p Idx.
1195- VPValue *getIncomingValue (unsigned Idx) const {
1196- return getAsRecipe ()->getOperand (Idx);
1197- }
1198-
1199- // / Returns the incoming block with index \p Idx.
1200- const VPBasicBlock *getIncomingBlock (unsigned Idx) const ;
1201-
1202- // / Returns the number of incoming values, also number of incoming blocks.
1203- unsigned getNumIncoming () const { return getAsRecipe ()->getNumOperands (); }
1204-
1205- #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1206- // / Print the recipe.
1207- void printPhiOperands (raw_ostream &O, VPSlotTracker &SlotTracker) const ;
1208- #endif
1209- };
1210-
12111211// / An overlay for VPIRInstructions wrapping PHI nodes enabling convenient use
12121212// / cast/dyn_cast/isa and execute() implementation. A single VPValue operand is
12131213// / allowed, and it is used to add a new incoming value for the single
0 commit comments