|
38 | 38 | #include "llvm/IR/DebugLoc.h"
|
39 | 39 | #include "llvm/IR/FMF.h"
|
40 | 40 | #include "llvm/IR/Operator.h"
|
| 41 | +#include "llvm/Support/Compiler.h" |
41 | 42 | #include "llvm/Support/InstructionCost.h"
|
42 | 43 | #include <algorithm>
|
43 | 44 | #include <cassert>
|
@@ -77,7 +78,7 @@ using VPlanPtr = std::unique_ptr<VPlan>;
|
77 | 78 |
|
78 | 79 | /// VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
|
79 | 80 | /// A VPBlockBase can be either a VPBasicBlock or a VPRegionBlock.
|
80 |
| -class VPBlockBase { |
| 81 | +class LLVM_ABI VPBlockBase { |
81 | 82 | friend class VPBlockUtils;
|
82 | 83 |
|
83 | 84 | const unsigned char SubclassID; ///< Subclass identifier (for isa/dyn_cast).
|
@@ -384,9 +385,10 @@ class VPBlockBase {
|
384 | 385 | /// and is responsible for deleting its defined values. Single-value
|
385 | 386 | /// recipes must inherit from VPSingleDef instead of inheriting from both
|
386 | 387 | /// VPRecipeBase and VPValue separately.
|
387 |
| -class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>, |
388 |
| - public VPDef, |
389 |
| - public VPUser { |
| 388 | +class LLVM_ABI VPRecipeBase |
| 389 | + : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>, |
| 390 | + public VPDef, |
| 391 | + public VPUser { |
390 | 392 | friend VPBasicBlock;
|
391 | 393 | friend class VPBlockUtils;
|
392 | 394 |
|
@@ -635,7 +637,7 @@ class VPIRFlags {
|
635 | 637 | char AllowContract : 1;
|
636 | 638 | char ApproxFunc : 1;
|
637 | 639 |
|
638 |
| - FastMathFlagsTy(const FastMathFlags &FMF); |
| 640 | + LLVM_ABI FastMathFlagsTy(const FastMathFlags &FMF); |
639 | 641 | };
|
640 | 642 |
|
641 | 643 | OperationType OpType;
|
@@ -787,7 +789,7 @@ class VPIRFlags {
|
787 | 789 | /// Returns true if the recipe has fast-math flags.
|
788 | 790 | bool hasFastMathFlags() const { return OpType == OperationType::FPMathOp; }
|
789 | 791 |
|
790 |
| - FastMathFlags getFastMathFlags() const; |
| 792 | + LLVM_ABI FastMathFlags getFastMathFlags() const; |
791 | 793 |
|
792 | 794 | /// Returns true if the recipe has non-negative flag.
|
793 | 795 | bool hasNonNegFlag() const { return OpType == OperationType::NonNegOp; }
|
@@ -872,7 +874,7 @@ struct VPRecipeWithIRFlags : public VPSingleDefRecipe, public VPIRFlags {
|
872 | 874 |
|
873 | 875 | /// Helper to access the operand that contains the unroll part for this recipe
|
874 | 876 | /// after unrolling.
|
875 |
| -template <unsigned PartOpIdx> class VPUnrollPartAccessor { |
| 877 | +template <unsigned PartOpIdx> class LLVM_ABI VPUnrollPartAccessor { |
876 | 878 | protected:
|
877 | 879 | /// Return the VPValue operand containing the unroll part or null if there is
|
878 | 880 | /// no such operand.
|
@@ -914,9 +916,9 @@ class VPIRMetadata {
|
914 | 916 | /// While as any Recipe it may generate a sequence of IR instructions when
|
915 | 917 | /// executed, these instructions would always form a single-def expression as
|
916 | 918 | /// the VPInstruction is also a single def-use vertex.
|
917 |
| -class VPInstruction : public VPRecipeWithIRFlags, |
918 |
| - public VPIRMetadata, |
919 |
| - public VPUnrollPartAccessor<1> { |
| 919 | +class LLVM_ABI VPInstruction : public VPRecipeWithIRFlags, |
| 920 | + public VPIRMetadata, |
| 921 | + public VPUnrollPartAccessor<1> { |
920 | 922 | friend class VPlanSlp;
|
921 | 923 |
|
922 | 924 | public:
|
@@ -1187,7 +1189,7 @@ class VPPhiAccessors {
|
1187 | 1189 | #endif
|
1188 | 1190 | };
|
1189 | 1191 |
|
1190 |
| -struct VPPhi : public VPInstruction, public VPPhiAccessors { |
| 1192 | +struct LLVM_ABI VPPhi : public VPInstruction, public VPPhiAccessors { |
1191 | 1193 | VPPhi(ArrayRef<VPValue *> Operands, DebugLoc DL, const Twine &Name = "")
|
1192 | 1194 | : VPInstruction(Instruction::PHI, Operands, DL, Name) {}
|
1193 | 1195 |
|
@@ -1308,7 +1310,7 @@ struct VPIRPhi : public VPIRInstruction, public VPPhiAccessors {
|
1308 | 1310 | /// opcode and operands of the recipe. This recipe covers most of the
|
1309 | 1311 | /// traditional vectorization cases where each recipe transforms into a
|
1310 | 1312 | /// vectorized version of itself.
|
1311 |
| -class VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { |
| 1313 | +class LLVM_ABI VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { |
1312 | 1314 | unsigned Opcode;
|
1313 | 1315 |
|
1314 | 1316 | public:
|
@@ -1493,7 +1495,8 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
|
1493 | 1495 | };
|
1494 | 1496 |
|
1495 | 1497 | /// A recipe for widening Call instructions using library calls.
|
1496 |
| -class VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { |
| 1498 | +class LLVM_ABI VPWidenCallRecipe : public VPRecipeWithIRFlags, |
| 1499 | + public VPIRMetadata { |
1497 | 1500 | /// Variant stores a pointer to the chosen function. There is a 1:1 mapping
|
1498 | 1501 | /// between a given VF and the chosen vectorized variant, so there will be a
|
1499 | 1502 | /// different VPlan for each VF with a valid variant.
|
@@ -1587,7 +1590,8 @@ class VPHistogramRecipe : public VPRecipeBase {
|
1587 | 1590 | };
|
1588 | 1591 |
|
1589 | 1592 | /// A recipe for widening select instructions.
|
1590 |
| -struct VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { |
| 1593 | +struct LLVM_ABI VPWidenSelectRecipe : public VPRecipeWithIRFlags, |
| 1594 | + public VPIRMetadata { |
1591 | 1595 | VPWidenSelectRecipe(SelectInst &I, ArrayRef<VPValue *> Operands)
|
1592 | 1596 | : VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I),
|
1593 | 1597 | VPIRMetadata(I) {}
|
@@ -1631,7 +1635,7 @@ struct VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
|
1631 | 1635 | };
|
1632 | 1636 |
|
1633 | 1637 | /// A recipe for handling GEP instructions.
|
1634 |
| -class VPWidenGEPRecipe : public VPRecipeWithIRFlags { |
| 1638 | +class LLVM_ABI VPWidenGEPRecipe : public VPRecipeWithIRFlags { |
1635 | 1639 | bool isPointerLoopInvariant() const {
|
1636 | 1640 | return getOperand(0)->isDefinedOutsideLoopRegions();
|
1637 | 1641 | }
|
@@ -1817,7 +1821,8 @@ class VPVectorPointerRecipe : public VPRecipeWithIRFlags,
|
1817 | 1821 | /// * VPWidenPointerInductionRecipe: Generate vector and scalar values for a
|
1818 | 1822 | /// pointer induction. Produces either a vector PHI per-part or scalar values
|
1819 | 1823 | /// per-lane based on the canonical induction.
|
1820 |
| -class VPHeaderPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors { |
| 1824 | +class LLVM_ABI VPHeaderPHIRecipe : public VPSingleDefRecipe, |
| 1825 | + public VPPhiAccessors { |
1821 | 1826 | protected:
|
1822 | 1827 | VPHeaderPHIRecipe(unsigned char VPDefID, Instruction *UnderlyingInstr,
|
1823 | 1828 | VPValue *Start, DebugLoc DL = DebugLoc::getUnknown())
|
@@ -2094,7 +2099,8 @@ class VPWidenPointerInductionRecipe : public VPWidenInductionRecipe,
|
2094 | 2099 | /// recipe is placed in an entry block to a (non-replicate) region, it must have
|
2095 | 2100 | /// exactly 2 incoming values, the first from the predecessor of the region and
|
2096 | 2101 | /// the second from the exiting block of the region.
|
2097 |
| -class VPWidenPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors { |
| 2102 | +class LLVM_ABI VPWidenPHIRecipe : public VPSingleDefRecipe, |
| 2103 | + public VPPhiAccessors { |
2098 | 2104 | /// Name to use for the generated IR instruction for the widened phi.
|
2099 | 2105 | std::string Name;
|
2100 | 2106 |
|
@@ -2242,7 +2248,7 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
|
2242 | 2248 |
|
2243 | 2249 | /// A recipe for vectorizing a phi-node as a sequence of mask-based select
|
2244 | 2250 | /// instructions.
|
2245 |
| -class VPBlendRecipe : public VPSingleDefRecipe { |
| 2251 | +class LLVM_ABI VPBlendRecipe : public VPSingleDefRecipe { |
2246 | 2252 | public:
|
2247 | 2253 | /// The blend operation is a User of the incoming values and of their
|
2248 | 2254 | /// respective masks, ordered [I0, M0, I1, M1, I2, M2, ...]. Note that M0 can
|
@@ -2309,7 +2315,7 @@ class VPBlendRecipe : public VPSingleDefRecipe {
|
2309 | 2315 | /// or stores into one wide load/store and shuffles. The first operand of a
|
2310 | 2316 | /// VPInterleave recipe is the address, followed by the stored values, followed
|
2311 | 2317 | /// by an optional mask.
|
2312 |
| -class VPInterleaveRecipe : public VPRecipeBase { |
| 2318 | +class LLVM_ABI VPInterleaveRecipe : public VPRecipeBase { |
2313 | 2319 | const InterleaveGroup<Instruction> *IG;
|
2314 | 2320 |
|
2315 | 2321 | /// Indicates if the interleave group is in a conditional block and requires a
|
@@ -2406,7 +2412,7 @@ class VPInterleaveRecipe : public VPRecipeBase {
|
2406 | 2412 | /// A recipe to represent inloop reduction operations, performing a reduction on
|
2407 | 2413 | /// a vector operand into a scalar value, and adding the result to a chain.
|
2408 | 2414 | /// The Operands are {ChainOp, VecOp, [Condition]}.
|
2409 |
| -class VPReductionRecipe : public VPRecipeWithIRFlags { |
| 2415 | +class LLVM_ABI VPReductionRecipe : public VPRecipeWithIRFlags { |
2410 | 2416 | /// The recurrence kind for the reduction in question.
|
2411 | 2417 | RecurKind RdxKind;
|
2412 | 2418 | bool IsOrdered;
|
@@ -2576,7 +2582,7 @@ class VPPartialReductionRecipe : public VPReductionRecipe {
|
2576 | 2582 | /// intrinsics, performing a reduction on a vector operand with the explicit
|
2577 | 2583 | /// vector length (EVL) into a scalar value, and adding the result to a chain.
|
2578 | 2584 | /// The Operands are {ChainOp, VecOp, EVL, [Condition]}.
|
2579 |
| -class VPReductionEVLRecipe : public VPReductionRecipe { |
| 2585 | +class LLVM_ABI VPReductionEVLRecipe : public VPReductionRecipe { |
2580 | 2586 | public:
|
2581 | 2587 | VPReductionEVLRecipe(VPReductionRecipe &R, VPValue &EVL, VPValue *CondOp,
|
2582 | 2588 | DebugLoc DL = {})
|
@@ -2803,7 +2809,8 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
|
2803 | 2809 | /// copies of the original scalar type, one per lane, instead of producing a
|
2804 | 2810 | /// single copy of widened type for all lanes. If the instruction is known to be
|
2805 | 2811 | /// a single scalar, only one copy, per lane zero, will be generated.
|
2806 |
| -class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { |
| 2812 | +class LLVM_ABI VPReplicateRecipe : public VPRecipeWithIRFlags, |
| 2813 | + public VPIRMetadata { |
2807 | 2814 | /// Indicator if only a single replica per lane is needed.
|
2808 | 2815 | bool IsSingleScalar;
|
2809 | 2816 |
|
@@ -2881,7 +2888,7 @@ class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
|
2881 | 2888 | };
|
2882 | 2889 |
|
2883 | 2890 | /// A recipe for generating conditional branches on the bits of a mask.
|
2884 |
| -class VPBranchOnMaskRecipe : public VPRecipeBase { |
| 2891 | +class LLVM_ABI VPBranchOnMaskRecipe : public VPRecipeBase { |
2885 | 2892 | public:
|
2886 | 2893 | VPBranchOnMaskRecipe(VPValue *BlockInMask, DebugLoc DL)
|
2887 | 2894 | : VPRecipeBase(VPDef::VPBranchOnMaskSC, {BlockInMask}, DL) {}
|
@@ -2922,7 +2929,7 @@ class VPBranchOnMaskRecipe : public VPRecipeBase {
|
2922 | 2929 | /// order to merge values that are set under such a branch and feed their uses.
|
2923 | 2930 | /// The phi nodes can be scalar or vector depending on the users of the value.
|
2924 | 2931 | /// This recipe works in concert with VPBranchOnMaskRecipe.
|
2925 |
| -class VPPredInstPHIRecipe : public VPSingleDefRecipe { |
| 2932 | +class LLVM_ABI VPPredInstPHIRecipe : public VPSingleDefRecipe { |
2926 | 2933 | public:
|
2927 | 2934 | /// Construct a VPPredInstPHIRecipe given \p PredInst whose value needs a phi
|
2928 | 2935 | /// nodes after merging back from a Branch-on-Mask.
|
@@ -2963,7 +2970,7 @@ class VPPredInstPHIRecipe : public VPSingleDefRecipe {
|
2963 | 2970 |
|
2964 | 2971 | /// A common base class for widening memory operations. An optional mask can be
|
2965 | 2972 | /// provided as the last operand.
|
2966 |
| -class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata { |
| 2973 | +class LLVM_ABI VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata { |
2967 | 2974 | protected:
|
2968 | 2975 | Instruction &Ingredient;
|
2969 | 2976 |
|
@@ -3044,7 +3051,8 @@ class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
|
3044 | 3051 |
|
3045 | 3052 | /// A recipe for widening load operations, using the address to load from and an
|
3046 | 3053 | /// optional mask.
|
3047 |
| -struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue { |
| 3054 | +struct LLVM_ABI VPWidenLoadRecipe final : public VPWidenMemoryRecipe, |
| 3055 | + public VPValue { |
3048 | 3056 | VPWidenLoadRecipe(LoadInst &Load, VPValue *Addr, VPValue *Mask,
|
3049 | 3057 | bool Consecutive, bool Reverse,
|
3050 | 3058 | const VPIRMetadata &Metadata, DebugLoc DL)
|
@@ -3123,7 +3131,7 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
|
3123 | 3131 |
|
3124 | 3132 | /// A recipe for widening store operations, using the stored value, the address
|
3125 | 3133 | /// to store to and an optional mask.
|
3126 |
| -struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe { |
| 3134 | +struct LLVM_ABI VPWidenStoreRecipe final : public VPWidenMemoryRecipe { |
3127 | 3135 | VPWidenStoreRecipe(StoreInst &Store, VPValue *Addr, VPValue *StoredVal,
|
3128 | 3136 | VPValue *Mask, bool Consecutive, bool Reverse,
|
3129 | 3137 | const VPIRMetadata &Metadata, DebugLoc DL)
|
@@ -3483,8 +3491,8 @@ class VPDerivedIVRecipe : public VPSingleDefRecipe {
|
3483 | 3491 |
|
3484 | 3492 | /// A recipe for handling phi nodes of integer and floating-point inductions,
|
3485 | 3493 | /// producing their scalar values.
|
3486 |
| -class VPScalarIVStepsRecipe : public VPRecipeWithIRFlags, |
3487 |
| - public VPUnrollPartAccessor<3> { |
| 3494 | +class LLVM_ABI VPScalarIVStepsRecipe : public VPRecipeWithIRFlags, |
| 3495 | + public VPUnrollPartAccessor<3> { |
3488 | 3496 | Instruction::BinaryOps InductionOpcode;
|
3489 | 3497 |
|
3490 | 3498 | public:
|
@@ -3593,7 +3601,7 @@ struct CastInfo<VPPhiAccessors, const VPRecipeBase *>
|
3593 | 3601 | /// VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. It
|
3594 | 3602 | /// holds a sequence of zero or more VPRecipe's each representing a sequence of
|
3595 | 3603 | /// output IR instructions. All PHI-like recipes must come before any non-PHI recipes.
|
3596 |
| -class VPBasicBlock : public VPBlockBase { |
| 3604 | +class LLVM_ABI VPBasicBlock : public VPBlockBase { |
3597 | 3605 | friend class VPlan;
|
3598 | 3606 |
|
3599 | 3607 | /// Use VPlan::createVPBasicBlock to create VPBasicBlocks.
|
@@ -3781,7 +3789,7 @@ class VPIRBasicBlock : public VPBasicBlock {
|
3781 | 3789 | /// this replication indicator helps to keep a single model for multiple
|
3782 | 3790 | /// candidate VF's. The actual replication takes place only once the desired VF
|
3783 | 3791 | /// and UF have been determined.
|
3784 |
| -class VPRegionBlock : public VPBlockBase { |
| 3792 | +class LLVM_ABI VPRegionBlock : public VPBlockBase { |
3785 | 3793 | friend class VPlan;
|
3786 | 3794 |
|
3787 | 3795 | /// Hold the Single Entry of the SESE region modelled by the VPRegionBlock.
|
@@ -3970,7 +3978,7 @@ class VPlan {
|
3970 | 3978 | TripCount = TC;
|
3971 | 3979 | }
|
3972 | 3980 |
|
3973 |
| - ~VPlan(); |
| 3981 | + LLVM_ABI ~VPlan(); |
3974 | 3982 |
|
3975 | 3983 | void setEntry(VPBasicBlock *VPBB) {
|
3976 | 3984 | Entry = VPBB;
|
@@ -4000,8 +4008,8 @@ class VPlan {
|
4000 | 4008 | }
|
4001 | 4009 |
|
4002 | 4010 | /// Returns the VPRegionBlock of the vector loop.
|
4003 |
| - VPRegionBlock *getVectorLoopRegion(); |
4004 |
| - const VPRegionBlock *getVectorLoopRegion() const; |
| 4011 | + LLVM_ABI VPRegionBlock *getVectorLoopRegion(); |
| 4012 | + LLVM_ABI const VPRegionBlock *getVectorLoopRegion() const; |
4005 | 4013 |
|
4006 | 4014 | /// Returns the 'middle' block of the plan, that is the block that selects
|
4007 | 4015 | /// whether to execute the scalar tail loop or the exit block from the loop
|
@@ -4240,7 +4248,7 @@ class VPlan {
|
4240 | 4248 | /// instructions in \p IRBB, except its terminator which is managed by the
|
4241 | 4249 | /// successors of the block in VPlan. The returned block is owned by the VPlan
|
4242 | 4250 | /// and deleted once the VPlan is destroyed.
|
4243 |
| - VPIRBasicBlock *createVPIRBasicBlock(BasicBlock *IRBB); |
| 4251 | + LLVM_ABI VPIRBasicBlock *createVPIRBasicBlock(BasicBlock *IRBB); |
4244 | 4252 |
|
4245 | 4253 | /// Returns true if the VPlan is based on a loop with an early exit. That is
|
4246 | 4254 | /// the case if the VPlan has either more than one exit block or a single exit
|
|
0 commit comments