|
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 |
|
@@ -634,7 +636,7 @@ class VPIRFlags {
|
634 | 636 | char AllowContract : 1;
|
635 | 637 | char ApproxFunc : 1;
|
636 | 638 |
|
637 |
| - FastMathFlagsTy(const FastMathFlags &FMF); |
| 639 | + LLVM_ABI FastMathFlagsTy(const FastMathFlags &FMF); |
638 | 640 | };
|
639 | 641 |
|
640 | 642 | OperationType OpType;
|
@@ -786,7 +788,7 @@ class VPIRFlags {
|
786 | 788 | /// Returns true if the recipe has fast-math flags.
|
787 | 789 | bool hasFastMathFlags() const { return OpType == OperationType::FPMathOp; }
|
788 | 790 |
|
789 |
| - FastMathFlags getFastMathFlags() const; |
| 791 | + LLVM_ABI FastMathFlags getFastMathFlags() const; |
790 | 792 |
|
791 | 793 | /// Returns true if the recipe has non-negative flag.
|
792 | 794 | bool hasNonNegFlag() const { return OpType == OperationType::NonNegOp; }
|
@@ -870,7 +872,7 @@ struct VPRecipeWithIRFlags : public VPSingleDefRecipe, public VPIRFlags {
|
870 | 872 |
|
871 | 873 | /// Helper to access the operand that contains the unroll part for this recipe
|
872 | 874 | /// after unrolling.
|
873 |
| -template <unsigned PartOpIdx> class VPUnrollPartAccessor { |
| 875 | +template <unsigned PartOpIdx> class LLVM_ABI VPUnrollPartAccessor { |
874 | 876 | protected:
|
875 | 877 | /// Return the VPValue operand containing the unroll part or null if there is
|
876 | 878 | /// no such operand.
|
@@ -912,9 +914,9 @@ class VPIRMetadata {
|
912 | 914 | /// While as any Recipe it may generate a sequence of IR instructions when
|
913 | 915 | /// executed, these instructions would always form a single-def expression as
|
914 | 916 | /// the VPInstruction is also a single def-use vertex.
|
915 |
| -class VPInstruction : public VPRecipeWithIRFlags, |
916 |
| - public VPIRMetadata, |
917 |
| - public VPUnrollPartAccessor<1> { |
| 917 | +class LLVM_ABI VPInstruction : public VPRecipeWithIRFlags, |
| 918 | + public VPIRMetadata, |
| 919 | + public VPUnrollPartAccessor<1> { |
918 | 920 | friend class VPlanSlp;
|
919 | 921 |
|
920 | 922 | public:
|
@@ -1198,7 +1200,7 @@ class VPPhiAccessors {
|
1198 | 1200 | #endif
|
1199 | 1201 | };
|
1200 | 1202 |
|
1201 |
| -struct VPPhi : public VPInstruction, public VPPhiAccessors { |
| 1203 | +struct LLVM_ABI VPPhi : public VPInstruction, public VPPhiAccessors { |
1202 | 1204 | VPPhi(ArrayRef<VPValue *> Operands, DebugLoc DL, const Twine &Name = "")
|
1203 | 1205 | : VPInstruction(Instruction::PHI, Operands, DL, Name) {}
|
1204 | 1206 |
|
@@ -1319,7 +1321,7 @@ struct VPIRPhi : public VPIRInstruction, public VPPhiAccessors {
|
1319 | 1321 | /// opcode and operands of the recipe. This recipe covers most of the
|
1320 | 1322 | /// traditional vectorization cases where each recipe transforms into a
|
1321 | 1323 | /// vectorized version of itself.
|
1322 |
| -class VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { |
| 1324 | +class LLVM_ABI VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { |
1323 | 1325 | unsigned Opcode;
|
1324 | 1326 |
|
1325 | 1327 | public:
|
@@ -1504,7 +1506,8 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
|
1504 | 1506 | };
|
1505 | 1507 |
|
1506 | 1508 | /// A recipe for widening Call instructions using library calls.
|
1507 |
| -class VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { |
| 1509 | +class LLVM_ABI VPWidenCallRecipe : public VPRecipeWithIRFlags, |
| 1510 | + public VPIRMetadata { |
1508 | 1511 | /// Variant stores a pointer to the chosen function. There is a 1:1 mapping
|
1509 | 1512 | /// between a given VF and the chosen vectorized variant, so there will be a
|
1510 | 1513 | /// different VPlan for each VF with a valid variant.
|
@@ -1598,7 +1601,8 @@ class VPHistogramRecipe : public VPRecipeBase {
|
1598 | 1601 | };
|
1599 | 1602 |
|
1600 | 1603 | /// A recipe for widening select instructions.
|
1601 |
| -struct VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { |
| 1604 | +struct LLVM_ABI VPWidenSelectRecipe : public VPRecipeWithIRFlags, |
| 1605 | + public VPIRMetadata { |
1602 | 1606 | VPWidenSelectRecipe(SelectInst &I, ArrayRef<VPValue *> Operands)
|
1603 | 1607 | : VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I),
|
1604 | 1608 | VPIRMetadata(I) {}
|
@@ -1642,7 +1646,7 @@ struct VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
|
1642 | 1646 | };
|
1643 | 1647 |
|
1644 | 1648 | /// A recipe for handling GEP instructions.
|
1645 |
| -class VPWidenGEPRecipe : public VPRecipeWithIRFlags { |
| 1649 | +class LLVM_ABI VPWidenGEPRecipe : public VPRecipeWithIRFlags { |
1646 | 1650 | bool isPointerLoopInvariant() const {
|
1647 | 1651 | return getOperand(0)->isDefinedOutsideLoopRegions();
|
1648 | 1652 | }
|
@@ -1835,7 +1839,8 @@ class VPVectorPointerRecipe : public VPRecipeWithIRFlags,
|
1835 | 1839 | /// * VPWidenPointerInductionRecipe: Generate vector and scalar values for a
|
1836 | 1840 | /// pointer induction. Produces either a vector PHI per-part or scalar values
|
1837 | 1841 | /// per-lane based on the canonical induction.
|
1838 |
| -class VPHeaderPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors { |
| 1842 | +class LLVM_ABI VPHeaderPHIRecipe : public VPSingleDefRecipe, |
| 1843 | + public VPPhiAccessors { |
1839 | 1844 | protected:
|
1840 | 1845 | VPHeaderPHIRecipe(unsigned char VPDefID, Instruction *UnderlyingInstr,
|
1841 | 1846 | VPValue *Start, DebugLoc DL = DebugLoc::getUnknown())
|
@@ -2112,7 +2117,8 @@ class VPWidenPointerInductionRecipe : public VPWidenInductionRecipe,
|
2112 | 2117 | /// recipe is placed in an entry block to a (non-replicate) region, it must have
|
2113 | 2118 | /// exactly 2 incoming values, the first from the predecessor of the region and
|
2114 | 2119 | /// the second from the exiting block of the region.
|
2115 |
| -class VPWidenPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors { |
| 2120 | +class LLVM_ABI VPWidenPHIRecipe : public VPSingleDefRecipe, |
| 2121 | + public VPPhiAccessors { |
2116 | 2122 | /// Name to use for the generated IR instruction for the widened phi.
|
2117 | 2123 | std::string Name;
|
2118 | 2124 |
|
@@ -2257,7 +2263,7 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
|
2257 | 2263 |
|
2258 | 2264 | /// A recipe for vectorizing a phi-node as a sequence of mask-based select
|
2259 | 2265 | /// instructions.
|
2260 |
| -class VPBlendRecipe : public VPSingleDefRecipe { |
| 2266 | +class LLVM_ABI VPBlendRecipe : public VPSingleDefRecipe { |
2261 | 2267 | public:
|
2262 | 2268 | /// The blend operation is a User of the incoming values and of their
|
2263 | 2269 | /// respective masks, ordered [I0, M0, I1, M1, I2, M2, ...]. Note that M0 can
|
@@ -2324,7 +2330,7 @@ class VPBlendRecipe : public VPSingleDefRecipe {
|
2324 | 2330 | /// or stores into one wide load/store and shuffles. The first operand of a
|
2325 | 2331 | /// VPInterleave recipe is the address, followed by the stored values, followed
|
2326 | 2332 | /// by an optional mask.
|
2327 |
| -class VPInterleaveRecipe : public VPRecipeBase { |
| 2333 | +class LLVM_ABI VPInterleaveRecipe : public VPRecipeBase { |
2328 | 2334 | const InterleaveGroup<Instruction> *IG;
|
2329 | 2335 |
|
2330 | 2336 | /// Indicates if the interleave group is in a conditional block and requires a
|
@@ -2424,7 +2430,7 @@ class VPInterleaveRecipe : public VPRecipeBase {
|
2424 | 2430 | /// A recipe to represent inloop reduction operations, performing a reduction on
|
2425 | 2431 | /// a vector operand into a scalar value, and adding the result to a chain.
|
2426 | 2432 | /// The Operands are {ChainOp, VecOp, [Condition]}.
|
2427 |
| -class VPReductionRecipe : public VPRecipeWithIRFlags { |
| 2433 | +class LLVM_ABI VPReductionRecipe : public VPRecipeWithIRFlags { |
2428 | 2434 | /// The recurrence kind for the reduction in question.
|
2429 | 2435 | RecurKind RdxKind;
|
2430 | 2436 | bool IsOrdered;
|
@@ -2570,7 +2576,7 @@ class VPPartialReductionRecipe : public VPReductionRecipe {
|
2570 | 2576 | /// intrinsics, performing a reduction on a vector operand with the explicit
|
2571 | 2577 | /// vector length (EVL) into a scalar value, and adding the result to a chain.
|
2572 | 2578 | /// The Operands are {ChainOp, VecOp, EVL, [Condition]}.
|
2573 |
| -class VPReductionEVLRecipe : public VPReductionRecipe { |
| 2579 | +class LLVM_ABI VPReductionEVLRecipe : public VPReductionRecipe { |
2574 | 2580 | public:
|
2575 | 2581 | VPReductionEVLRecipe(VPReductionRecipe &R, VPValue &EVL, VPValue *CondOp,
|
2576 | 2582 | DebugLoc DL = {})
|
@@ -2613,7 +2619,8 @@ class VPReductionEVLRecipe : public VPReductionRecipe {
|
2613 | 2619 | /// copies of the original scalar type, one per lane, instead of producing a
|
2614 | 2620 | /// single copy of widened type for all lanes. If the instruction is known to be
|
2615 | 2621 | /// a single scalar, only one copy, per lane zero, will be generated.
|
2616 |
| -class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { |
| 2622 | +class LLVM_ABI VPReplicateRecipe : public VPRecipeWithIRFlags, |
| 2623 | + public VPIRMetadata { |
2617 | 2624 | /// Indicator if only a single replica per lane is needed.
|
2618 | 2625 | bool IsSingleScalar;
|
2619 | 2626 |
|
@@ -2691,7 +2698,7 @@ class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
|
2691 | 2698 | };
|
2692 | 2699 |
|
2693 | 2700 | /// A recipe for generating conditional branches on the bits of a mask.
|
2694 |
| -class VPBranchOnMaskRecipe : public VPRecipeBase { |
| 2701 | +class LLVM_ABI VPBranchOnMaskRecipe : public VPRecipeBase { |
2695 | 2702 | public:
|
2696 | 2703 | VPBranchOnMaskRecipe(VPValue *BlockInMask, DebugLoc DL)
|
2697 | 2704 | : VPRecipeBase(VPDef::VPBranchOnMaskSC, {BlockInMask}, DL) {}
|
@@ -2848,7 +2855,7 @@ class VPExpressionRecipe : public VPSingleDefRecipe {
|
2848 | 2855 | /// order to merge values that are set under such a branch and feed their uses.
|
2849 | 2856 | /// The phi nodes can be scalar or vector depending on the users of the value.
|
2850 | 2857 | /// This recipe works in concert with VPBranchOnMaskRecipe.
|
2851 |
| -class VPPredInstPHIRecipe : public VPSingleDefRecipe { |
| 2858 | +class LLVM_ABI VPPredInstPHIRecipe : public VPSingleDefRecipe { |
2852 | 2859 | public:
|
2853 | 2860 | /// Construct a VPPredInstPHIRecipe given \p PredInst whose value needs a phi
|
2854 | 2861 | /// nodes after merging back from a Branch-on-Mask.
|
@@ -2889,7 +2896,7 @@ class VPPredInstPHIRecipe : public VPSingleDefRecipe {
|
2889 | 2896 |
|
2890 | 2897 | /// A common base class for widening memory operations. An optional mask can be
|
2891 | 2898 | /// provided as the last operand.
|
2892 |
| -class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata { |
| 2899 | +class LLVM_ABI VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata { |
2893 | 2900 | protected:
|
2894 | 2901 | Instruction &Ingredient;
|
2895 | 2902 |
|
@@ -2970,7 +2977,8 @@ class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
|
2970 | 2977 |
|
2971 | 2978 | /// A recipe for widening load operations, using the address to load from and an
|
2972 | 2979 | /// optional mask.
|
2973 |
| -struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue { |
| 2980 | +struct LLVM_ABI VPWidenLoadRecipe final : public VPWidenMemoryRecipe, |
| 2981 | + public VPValue { |
2974 | 2982 | VPWidenLoadRecipe(LoadInst &Load, VPValue *Addr, VPValue *Mask,
|
2975 | 2983 | bool Consecutive, bool Reverse,
|
2976 | 2984 | const VPIRMetadata &Metadata, DebugLoc DL)
|
@@ -3049,7 +3057,7 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
|
3049 | 3057 |
|
3050 | 3058 | /// A recipe for widening store operations, using the stored value, the address
|
3051 | 3059 | /// to store to and an optional mask.
|
3052 |
| -struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe { |
| 3060 | +struct LLVM_ABI VPWidenStoreRecipe final : public VPWidenMemoryRecipe { |
3053 | 3061 | VPWidenStoreRecipe(StoreInst &Store, VPValue *Addr, VPValue *StoredVal,
|
3054 | 3062 | VPValue *Mask, bool Consecutive, bool Reverse,
|
3055 | 3063 | const VPIRMetadata &Metadata, DebugLoc DL)
|
@@ -3409,8 +3417,8 @@ class VPDerivedIVRecipe : public VPSingleDefRecipe {
|
3409 | 3417 |
|
3410 | 3418 | /// A recipe for handling phi nodes of integer and floating-point inductions,
|
3411 | 3419 | /// producing their scalar values.
|
3412 |
| -class VPScalarIVStepsRecipe : public VPRecipeWithIRFlags, |
3413 |
| - public VPUnrollPartAccessor<3> { |
| 3420 | +class LLVM_ABI VPScalarIVStepsRecipe : public VPRecipeWithIRFlags, |
| 3421 | + public VPUnrollPartAccessor<3> { |
3414 | 3422 | Instruction::BinaryOps InductionOpcode;
|
3415 | 3423 |
|
3416 | 3424 | public:
|
@@ -3519,7 +3527,7 @@ struct CastInfo<VPPhiAccessors, const VPRecipeBase *>
|
3519 | 3527 | /// VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. It
|
3520 | 3528 | /// holds a sequence of zero or more VPRecipe's each representing a sequence of
|
3521 | 3529 | /// output IR instructions. All PHI-like recipes must come before any non-PHI recipes.
|
3522 |
| -class VPBasicBlock : public VPBlockBase { |
| 3530 | +class LLVM_ABI VPBasicBlock : public VPBlockBase { |
3523 | 3531 | friend class VPlan;
|
3524 | 3532 |
|
3525 | 3533 | /// Use VPlan::createVPBasicBlock to create VPBasicBlocks.
|
@@ -3707,7 +3715,7 @@ class VPIRBasicBlock : public VPBasicBlock {
|
3707 | 3715 | /// this replication indicator helps to keep a single model for multiple
|
3708 | 3716 | /// candidate VF's. The actual replication takes place only once the desired VF
|
3709 | 3717 | /// and UF have been determined.
|
3710 |
| -class VPRegionBlock : public VPBlockBase { |
| 3718 | +class LLVM_ABI VPRegionBlock : public VPBlockBase { |
3711 | 3719 | friend class VPlan;
|
3712 | 3720 |
|
3713 | 3721 | /// Hold the Single Entry of the SESE region modelled by the VPRegionBlock.
|
@@ -3896,7 +3904,7 @@ class VPlan {
|
3896 | 3904 | TripCount = TC;
|
3897 | 3905 | }
|
3898 | 3906 |
|
3899 |
| - ~VPlan(); |
| 3907 | + LLVM_ABI ~VPlan(); |
3900 | 3908 |
|
3901 | 3909 | void setEntry(VPBasicBlock *VPBB) {
|
3902 | 3910 | Entry = VPBB;
|
@@ -3926,8 +3934,8 @@ class VPlan {
|
3926 | 3934 | }
|
3927 | 3935 |
|
3928 | 3936 | /// Returns the VPRegionBlock of the vector loop.
|
3929 |
| - VPRegionBlock *getVectorLoopRegion(); |
3930 |
| - const VPRegionBlock *getVectorLoopRegion() const; |
| 3937 | + LLVM_ABI VPRegionBlock *getVectorLoopRegion(); |
| 3938 | + LLVM_ABI const VPRegionBlock *getVectorLoopRegion() const; |
3931 | 3939 |
|
3932 | 3940 | /// Returns the 'middle' block of the plan, that is the block that selects
|
3933 | 3941 | /// whether to execute the scalar tail loop or the exit block from the loop
|
@@ -4166,7 +4174,7 @@ class VPlan {
|
4166 | 4174 | /// instructions in \p IRBB, except its terminator which is managed by the
|
4167 | 4175 | /// successors of the block in VPlan. The returned block is owned by the VPlan
|
4168 | 4176 | /// and deleted once the VPlan is destroyed.
|
4169 |
| - VPIRBasicBlock *createVPIRBasicBlock(BasicBlock *IRBB); |
| 4177 | + LLVM_ABI VPIRBasicBlock *createVPIRBasicBlock(BasicBlock *IRBB); |
4170 | 4178 |
|
4171 | 4179 | /// Returns true if the VPlan is based on a loop with an early exit. That is
|
4172 | 4180 | /// the case if the VPlan has either more than one exit block or a single exit
|
|
0 commit comments