Skip to content

Commit 2a44997

Browse files
committed
[llvm] export private API so that VectorizeTests builds against Windows DLL
1 parent 5024cb2 commit 2a44997

File tree

6 files changed

+60
-48
lines changed

6 files changed

+60
-48
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "llvm/IR/DebugLoc.h"
3939
#include "llvm/IR/FMF.h"
4040
#include "llvm/IR/Operator.h"
41+
#include "llvm/Support/Compiler.h"
4142
#include "llvm/Support/InstructionCost.h"
4243
#include <algorithm>
4344
#include <cassert>
@@ -77,7 +78,7 @@ using VPlanPtr = std::unique_ptr<VPlan>;
7778

7879
/// VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
7980
/// A VPBlockBase can be either a VPBasicBlock or a VPRegionBlock.
80-
class VPBlockBase {
81+
class LLVM_ABI VPBlockBase {
8182
friend class VPBlockUtils;
8283

8384
const unsigned char SubclassID; ///< Subclass identifier (for isa/dyn_cast).
@@ -384,9 +385,10 @@ class VPBlockBase {
384385
/// and is responsible for deleting its defined values. Single-value
385386
/// recipes must inherit from VPSingleDef instead of inheriting from both
386387
/// 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 {
390392
friend VPBasicBlock;
391393
friend class VPBlockUtils;
392394

@@ -634,7 +636,7 @@ class VPIRFlags {
634636
char AllowContract : 1;
635637
char ApproxFunc : 1;
636638

637-
FastMathFlagsTy(const FastMathFlags &FMF);
639+
LLVM_ABI FastMathFlagsTy(const FastMathFlags &FMF);
638640
};
639641

640642
OperationType OpType;
@@ -786,7 +788,7 @@ class VPIRFlags {
786788
/// Returns true if the recipe has fast-math flags.
787789
bool hasFastMathFlags() const { return OpType == OperationType::FPMathOp; }
788790

789-
FastMathFlags getFastMathFlags() const;
791+
LLVM_ABI FastMathFlags getFastMathFlags() const;
790792

791793
/// Returns true if the recipe has non-negative flag.
792794
bool hasNonNegFlag() const { return OpType == OperationType::NonNegOp; }
@@ -870,7 +872,7 @@ struct VPRecipeWithIRFlags : public VPSingleDefRecipe, public VPIRFlags {
870872

871873
/// Helper to access the operand that contains the unroll part for this recipe
872874
/// after unrolling.
873-
template <unsigned PartOpIdx> class VPUnrollPartAccessor {
875+
template <unsigned PartOpIdx> class LLVM_ABI VPUnrollPartAccessor {
874876
protected:
875877
/// Return the VPValue operand containing the unroll part or null if there is
876878
/// no such operand.
@@ -912,9 +914,9 @@ class VPIRMetadata {
912914
/// While as any Recipe it may generate a sequence of IR instructions when
913915
/// executed, these instructions would always form a single-def expression as
914916
/// 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> {
918920
friend class VPlanSlp;
919921

920922
public:
@@ -1198,7 +1200,7 @@ class VPPhiAccessors {
11981200
#endif
11991201
};
12001202

1201-
struct VPPhi : public VPInstruction, public VPPhiAccessors {
1203+
struct LLVM_ABI VPPhi : public VPInstruction, public VPPhiAccessors {
12021204
VPPhi(ArrayRef<VPValue *> Operands, DebugLoc DL, const Twine &Name = "")
12031205
: VPInstruction(Instruction::PHI, Operands, DL, Name) {}
12041206

@@ -1319,7 +1321,7 @@ struct VPIRPhi : public VPIRInstruction, public VPPhiAccessors {
13191321
/// opcode and operands of the recipe. This recipe covers most of the
13201322
/// traditional vectorization cases where each recipe transforms into a
13211323
/// vectorized version of itself.
1322-
class VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
1324+
class LLVM_ABI VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
13231325
unsigned Opcode;
13241326

13251327
public:
@@ -1504,7 +1506,8 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15041506
};
15051507

15061508
/// 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 {
15081511
/// Variant stores a pointer to the chosen function. There is a 1:1 mapping
15091512
/// between a given VF and the chosen vectorized variant, so there will be a
15101513
/// different VPlan for each VF with a valid variant.
@@ -1598,7 +1601,8 @@ class VPHistogramRecipe : public VPRecipeBase {
15981601
};
15991602

16001603
/// A recipe for widening select instructions.
1601-
struct VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
1604+
struct LLVM_ABI VPWidenSelectRecipe : public VPRecipeWithIRFlags,
1605+
public VPIRMetadata {
16021606
VPWidenSelectRecipe(SelectInst &I, ArrayRef<VPValue *> Operands)
16031607
: VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I),
16041608
VPIRMetadata(I) {}
@@ -1642,7 +1646,7 @@ struct VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
16421646
};
16431647

16441648
/// A recipe for handling GEP instructions.
1645-
class VPWidenGEPRecipe : public VPRecipeWithIRFlags {
1649+
class LLVM_ABI VPWidenGEPRecipe : public VPRecipeWithIRFlags {
16461650
bool isPointerLoopInvariant() const {
16471651
return getOperand(0)->isDefinedOutsideLoopRegions();
16481652
}
@@ -1835,7 +1839,8 @@ class VPVectorPointerRecipe : public VPRecipeWithIRFlags,
18351839
/// * VPWidenPointerInductionRecipe: Generate vector and scalar values for a
18361840
/// pointer induction. Produces either a vector PHI per-part or scalar values
18371841
/// per-lane based on the canonical induction.
1838-
class VPHeaderPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors {
1842+
class LLVM_ABI VPHeaderPHIRecipe : public VPSingleDefRecipe,
1843+
public VPPhiAccessors {
18391844
protected:
18401845
VPHeaderPHIRecipe(unsigned char VPDefID, Instruction *UnderlyingInstr,
18411846
VPValue *Start, DebugLoc DL = DebugLoc::getUnknown())
@@ -2112,7 +2117,8 @@ class VPWidenPointerInductionRecipe : public VPWidenInductionRecipe,
21122117
/// recipe is placed in an entry block to a (non-replicate) region, it must have
21132118
/// exactly 2 incoming values, the first from the predecessor of the region and
21142119
/// 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 {
21162122
/// Name to use for the generated IR instruction for the widened phi.
21172123
std::string Name;
21182124

@@ -2257,7 +2263,7 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
22572263

22582264
/// A recipe for vectorizing a phi-node as a sequence of mask-based select
22592265
/// instructions.
2260-
class VPBlendRecipe : public VPSingleDefRecipe {
2266+
class LLVM_ABI VPBlendRecipe : public VPSingleDefRecipe {
22612267
public:
22622268
/// The blend operation is a User of the incoming values and of their
22632269
/// respective masks, ordered [I0, M0, I1, M1, I2, M2, ...]. Note that M0 can
@@ -2324,7 +2330,7 @@ class VPBlendRecipe : public VPSingleDefRecipe {
23242330
/// or stores into one wide load/store and shuffles. The first operand of a
23252331
/// VPInterleave recipe is the address, followed by the stored values, followed
23262332
/// by an optional mask.
2327-
class VPInterleaveRecipe : public VPRecipeBase {
2333+
class LLVM_ABI VPInterleaveRecipe : public VPRecipeBase {
23282334
const InterleaveGroup<Instruction> *IG;
23292335

23302336
/// Indicates if the interleave group is in a conditional block and requires a
@@ -2424,7 +2430,7 @@ class VPInterleaveRecipe : public VPRecipeBase {
24242430
/// A recipe to represent inloop reduction operations, performing a reduction on
24252431
/// a vector operand into a scalar value, and adding the result to a chain.
24262432
/// The Operands are {ChainOp, VecOp, [Condition]}.
2427-
class VPReductionRecipe : public VPRecipeWithIRFlags {
2433+
class LLVM_ABI VPReductionRecipe : public VPRecipeWithIRFlags {
24282434
/// The recurrence kind for the reduction in question.
24292435
RecurKind RdxKind;
24302436
bool IsOrdered;
@@ -2570,7 +2576,7 @@ class VPPartialReductionRecipe : public VPReductionRecipe {
25702576
/// intrinsics, performing a reduction on a vector operand with the explicit
25712577
/// vector length (EVL) into a scalar value, and adding the result to a chain.
25722578
/// The Operands are {ChainOp, VecOp, EVL, [Condition]}.
2573-
class VPReductionEVLRecipe : public VPReductionRecipe {
2579+
class LLVM_ABI VPReductionEVLRecipe : public VPReductionRecipe {
25742580
public:
25752581
VPReductionEVLRecipe(VPReductionRecipe &R, VPValue &EVL, VPValue *CondOp,
25762582
DebugLoc DL = {})
@@ -2613,7 +2619,8 @@ class VPReductionEVLRecipe : public VPReductionRecipe {
26132619
/// copies of the original scalar type, one per lane, instead of producing a
26142620
/// single copy of widened type for all lanes. If the instruction is known to be
26152621
/// 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 {
26172624
/// Indicator if only a single replica per lane is needed.
26182625
bool IsSingleScalar;
26192626

@@ -2691,7 +2698,7 @@ class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
26912698
};
26922699

26932700
/// A recipe for generating conditional branches on the bits of a mask.
2694-
class VPBranchOnMaskRecipe : public VPRecipeBase {
2701+
class LLVM_ABI VPBranchOnMaskRecipe : public VPRecipeBase {
26952702
public:
26962703
VPBranchOnMaskRecipe(VPValue *BlockInMask, DebugLoc DL)
26972704
: VPRecipeBase(VPDef::VPBranchOnMaskSC, {BlockInMask}, DL) {}
@@ -2848,7 +2855,7 @@ class VPExpressionRecipe : public VPSingleDefRecipe {
28482855
/// order to merge values that are set under such a branch and feed their uses.
28492856
/// The phi nodes can be scalar or vector depending on the users of the value.
28502857
/// This recipe works in concert with VPBranchOnMaskRecipe.
2851-
class VPPredInstPHIRecipe : public VPSingleDefRecipe {
2858+
class LLVM_ABI VPPredInstPHIRecipe : public VPSingleDefRecipe {
28522859
public:
28532860
/// Construct a VPPredInstPHIRecipe given \p PredInst whose value needs a phi
28542861
/// nodes after merging back from a Branch-on-Mask.
@@ -2889,7 +2896,7 @@ class VPPredInstPHIRecipe : public VPSingleDefRecipe {
28892896

28902897
/// A common base class for widening memory operations. An optional mask can be
28912898
/// provided as the last operand.
2892-
class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
2899+
class LLVM_ABI VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
28932900
protected:
28942901
Instruction &Ingredient;
28952902

@@ -2970,7 +2977,8 @@ class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
29702977

29712978
/// A recipe for widening load operations, using the address to load from and an
29722979
/// optional mask.
2973-
struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
2980+
struct LLVM_ABI VPWidenLoadRecipe final : public VPWidenMemoryRecipe,
2981+
public VPValue {
29742982
VPWidenLoadRecipe(LoadInst &Load, VPValue *Addr, VPValue *Mask,
29752983
bool Consecutive, bool Reverse,
29762984
const VPIRMetadata &Metadata, DebugLoc DL)
@@ -3049,7 +3057,7 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
30493057

30503058
/// A recipe for widening store operations, using the stored value, the address
30513059
/// to store to and an optional mask.
3052-
struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
3060+
struct LLVM_ABI VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
30533061
VPWidenStoreRecipe(StoreInst &Store, VPValue *Addr, VPValue *StoredVal,
30543062
VPValue *Mask, bool Consecutive, bool Reverse,
30553063
const VPIRMetadata &Metadata, DebugLoc DL)
@@ -3409,8 +3417,8 @@ class VPDerivedIVRecipe : public VPSingleDefRecipe {
34093417

34103418
/// A recipe for handling phi nodes of integer and floating-point inductions,
34113419
/// producing their scalar values.
3412-
class VPScalarIVStepsRecipe : public VPRecipeWithIRFlags,
3413-
public VPUnrollPartAccessor<3> {
3420+
class LLVM_ABI VPScalarIVStepsRecipe : public VPRecipeWithIRFlags,
3421+
public VPUnrollPartAccessor<3> {
34143422
Instruction::BinaryOps InductionOpcode;
34153423

34163424
public:
@@ -3519,7 +3527,7 @@ struct CastInfo<VPPhiAccessors, const VPRecipeBase *>
35193527
/// VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. It
35203528
/// holds a sequence of zero or more VPRecipe's each representing a sequence of
35213529
/// 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 {
35233531
friend class VPlan;
35243532

35253533
/// Use VPlan::createVPBasicBlock to create VPBasicBlocks.
@@ -3707,7 +3715,7 @@ class VPIRBasicBlock : public VPBasicBlock {
37073715
/// this replication indicator helps to keep a single model for multiple
37083716
/// candidate VF's. The actual replication takes place only once the desired VF
37093717
/// and UF have been determined.
3710-
class VPRegionBlock : public VPBlockBase {
3718+
class LLVM_ABI VPRegionBlock : public VPBlockBase {
37113719
friend class VPlan;
37123720

37133721
/// Hold the Single Entry of the SESE region modelled by the VPRegionBlock.
@@ -3896,7 +3904,7 @@ class VPlan {
38963904
TripCount = TC;
38973905
}
38983906

3899-
~VPlan();
3907+
LLVM_ABI ~VPlan();
39003908

39013909
void setEntry(VPBasicBlock *VPBB) {
39023910
Entry = VPBB;
@@ -3926,8 +3934,8 @@ class VPlan {
39263934
}
39273935

39283936
/// 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;
39313939

39323940
/// Returns the 'middle' block of the plan, that is the block that selects
39333941
/// whether to execute the scalar tail loop or the exit block from the loop
@@ -4166,7 +4174,7 @@ class VPlan {
41664174
/// instructions in \p IRBB, except its terminator which is managed by the
41674175
/// successors of the block in VPlan. The returned block is owned by the VPlan
41684176
/// and deleted once the VPlan is destroyed.
4169-
VPIRBasicBlock *createVPIRBasicBlock(BasicBlock *IRBB);
4177+
LLVM_ABI VPIRBasicBlock *createVPIRBasicBlock(BasicBlock *IRBB);
41704178

41714179
/// Returns true if the VPlan is based on a loop with an early exit. That is
41724180
/// the case if the VPlan has either more than one exit block or a single exit

llvm/lib/Transforms/Vectorize/VPlanDominatorTree.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "llvm/ADT/GraphTraits.h"
2121
#include "llvm/IR/Dominators.h"
2222
#include "llvm/Support/GenericDomTree.h"
23+
#include "llvm/Support/GenericDomTreeConstruction.h"
2324

2425
namespace llvm {
2526

llvm/lib/Transforms/Vectorize/VPlanSLP.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class VPInterleavedAccessInfo {
4747
InterleavedAccessInfo &IAI);
4848

4949
public:
50-
VPInterleavedAccessInfo(VPlan &Plan, InterleavedAccessInfo &IAI);
50+
LLVM_ABI VPInterleavedAccessInfo(VPlan &Plan, InterleavedAccessInfo &IAI);
5151
VPInterleavedAccessInfo(const VPInterleavedAccessInfo &) = delete;
5252
VPInterleavedAccessInfo &operator=(const VPInterleavedAccessInfo &) = delete;
5353

@@ -132,7 +132,7 @@ class VPlanSlp {
132132

133133
/// Tries to build an SLP tree rooted at \p Operands and returns a
134134
/// VPInstruction combining \p Operands, if they can be combined.
135-
VPInstruction *buildGraph(ArrayRef<VPValue *> Operands);
135+
LLVM_ABI VPInstruction *buildGraph(ArrayRef<VPValue *> Operands);
136136

137137
/// Return the width of the widest combined bundle in bits.
138138
unsigned getWidestBundleBits() const { return WidestBundleBits; }

llvm/lib/Transforms/Vectorize/VPlanTransforms.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "VPlanVerifier.h"
1818
#include "llvm/ADT/STLFunctionalExtras.h"
1919
#include "llvm/Support/CommandLine.h"
20+
#include "llvm/Support/Compiler.h"
2021

2122
namespace llvm {
2223

@@ -53,7 +54,8 @@ struct VPlanTransforms {
5354
verifyVPlanIsValid(Plan);
5455
}
5556

56-
static std::unique_ptr<VPlan> buildPlainCFG(Loop *TheLoop, LoopInfo &LI);
57+
LLVM_ABI static std::unique_ptr<VPlan> buildPlainCFG(Loop *TheLoop,
58+
LoopInfo &LI);
5759

5860
/// Prepare the plan for vectorization. It will introduce a dedicated
5961
/// VPBasicBlock for the vector pre-header as well as a VPBasicBlock as exit
@@ -63,21 +65,19 @@ struct VPlanTransforms {
6365
/// blocks. \p InductionTy is the type of the canonical induction and used for
6466
/// related values, like the trip count expression. It also creates a VPValue
6567
/// expression for the original trip count.
66-
static void prepareForVectorization(VPlan &Plan, Type *InductionTy,
67-
PredicatedScalarEvolution &PSE,
68-
bool RequiresScalarEpilogueCheck,
69-
bool TailFolded, Loop *TheLoop,
70-
DebugLoc IVDL, bool HasUncountableExit,
71-
VFRange &Range);
68+
LLVM_ABI static void prepareForVectorization(
69+
VPlan &Plan, Type *InductionTy, PredicatedScalarEvolution &PSE,
70+
bool RequiresScalarEpilogueCheck, bool TailFolded, Loop *TheLoop,
71+
DebugLoc IVDL, bool HasUncountableExit, VFRange &Range);
7272

7373
/// Replace loops in \p Plan's flat CFG with VPRegionBlocks, turning \p Plan's
7474
/// flat CFG into a hierarchical CFG.
75-
static void createLoopRegions(VPlan &Plan);
75+
LLVM_ABI static void createLoopRegions(VPlan &Plan);
7676

7777
/// Replaces the VPInstructions in \p Plan with corresponding
7878
/// widen recipes. Returns false if any VPInstructions could not be converted
7979
/// to a wide recipe if needed.
80-
static bool tryToConvertVPInstructionsToVPRecipes(
80+
LLVM_ABI static bool tryToConvertVPInstructionsToVPRecipes(
8181
VPlanPtr &Plan,
8282
function_ref<const InductionDescriptor *(PHINode *)>
8383
GetIntOrFpInductionDescriptor,

llvm/lib/Transforms/Vectorize/VPlanValue.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "llvm/ADT/StringMap.h"
2727
#include "llvm/ADT/TinyPtrVector.h"
2828
#include "llvm/ADT/iterator_range.h"
29+
#include "llvm/Support/Compiler.h"
2930

3031
namespace llvm {
3132

@@ -44,7 +45,7 @@ class VPPhiAccessors;
4445
// flow into, within and out of the VPlan. VPValues can stand for live-ins
4546
// coming from the input IR and instructions which VPlan will generate if
4647
// executed.
47-
class VPValue {
48+
class LLVM_ABI VPValue {
4849
friend class VPDef;
4950
friend struct VPDoubleValueDef;
5051
friend class VPInterleaveRecipe;

llvm/lib/Transforms/Vectorize/VPlanVerifier.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANVERIFIER_H
2525
#define LLVM_TRANSFORMS_VECTORIZE_VPLANVERIFIER_H
2626

27+
#include "llvm/Support/Compiler.h"
28+
2729
namespace llvm {
2830
class VPlan;
2931

@@ -35,7 +37,7 @@ class VPlan;
3537
/// 2. all phi-like recipes must be at the beginning of a block, with no other
3638
/// recipes in between. Note that currently there is still an exception for
3739
/// VPBlendRecipes.
38-
bool verifyVPlanIsValid(const VPlan &Plan, bool VerifyLate = false);
40+
LLVM_ABI bool verifyVPlanIsValid(const VPlan &Plan, bool VerifyLate = false);
3941

4042
} // namespace llvm
4143

0 commit comments

Comments
 (0)