Skip to content

Commit 8b29d95

Browse files
committed
[llvm] export private API so that VectorizeTests builds against Windows DLL
1 parent b015217 commit 8b29d95

File tree

6 files changed

+44
-38
lines changed

6 files changed

+44
-38
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 31 additions & 30 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,7 +385,7 @@ 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+
class LLVM_ABI VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
388389
public VPDef,
389390
public VPUser {
390391
friend VPBasicBlock;
@@ -635,7 +636,7 @@ class VPIRFlags {
635636
char AllowContract : 1;
636637
char ApproxFunc : 1;
637638

638-
FastMathFlagsTy(const FastMathFlags &FMF);
639+
LLVM_ABI FastMathFlagsTy(const FastMathFlags &FMF);
639640
};
640641

641642
OperationType OpType;
@@ -787,7 +788,7 @@ class VPIRFlags {
787788
/// Returns true if the recipe has fast-math flags.
788789
bool hasFastMathFlags() const { return OpType == OperationType::FPMathOp; }
789790

790-
FastMathFlags getFastMathFlags() const;
791+
LLVM_ABI FastMathFlags getFastMathFlags() const;
791792

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

873874
/// Helper to access the operand that contains the unroll part for this recipe
874875
/// after unrolling.
875-
template <unsigned PartOpIdx> class VPUnrollPartAccessor {
876+
template <unsigned PartOpIdx> class LLVM_ABI VPUnrollPartAccessor {
876877
protected:
877878
/// Return the VPValue operand containing the unroll part or null if there is
878879
/// no such operand.
@@ -914,7 +915,7 @@ class VPIRMetadata {
914915
/// While as any Recipe it may generate a sequence of IR instructions when
915916
/// executed, these instructions would always form a single-def expression as
916917
/// the VPInstruction is also a single def-use vertex.
917-
class VPInstruction : public VPRecipeWithIRFlags,
918+
class LLVM_ABI VPInstruction : public VPRecipeWithIRFlags,
918919
public VPIRMetadata,
919920
public VPUnrollPartAccessor<1> {
920921
friend class VPlanSlp;
@@ -1187,7 +1188,7 @@ class VPPhiAccessors {
11871188
#endif
11881189
};
11891190

1190-
struct VPPhi : public VPInstruction, public VPPhiAccessors {
1191+
struct LLVM_ABI VPPhi : public VPInstruction, public VPPhiAccessors {
11911192
VPPhi(ArrayRef<VPValue *> Operands, DebugLoc DL, const Twine &Name = "")
11921193
: VPInstruction(Instruction::PHI, Operands, DL, Name) {}
11931194

@@ -1308,7 +1309,7 @@ struct VPIRPhi : public VPIRInstruction, public VPPhiAccessors {
13081309
/// opcode and operands of the recipe. This recipe covers most of the
13091310
/// traditional vectorization cases where each recipe transforms into a
13101311
/// vectorized version of itself.
1311-
class VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
1312+
class LLVM_ABI VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
13121313
unsigned Opcode;
13131314

13141315
public:
@@ -1493,7 +1494,7 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
14931494
};
14941495

14951496
/// A recipe for widening Call instructions using library calls.
1496-
class VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
1497+
class LLVM_ABI VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
14971498
/// Variant stores a pointer to the chosen function. There is a 1:1 mapping
14981499
/// between a given VF and the chosen vectorized variant, so there will be a
14991500
/// different VPlan for each VF with a valid variant.
@@ -1587,7 +1588,7 @@ class VPHistogramRecipe : public VPRecipeBase {
15871588
};
15881589

15891590
/// A recipe for widening select instructions.
1590-
struct VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
1591+
struct LLVM_ABI VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15911592
VPWidenSelectRecipe(SelectInst &I, ArrayRef<VPValue *> Operands)
15921593
: VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I),
15931594
VPIRMetadata(I) {}
@@ -1631,7 +1632,7 @@ struct VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
16311632
};
16321633

16331634
/// A recipe for handling GEP instructions.
1634-
class VPWidenGEPRecipe : public VPRecipeWithIRFlags {
1635+
class LLVM_ABI VPWidenGEPRecipe : public VPRecipeWithIRFlags {
16351636
bool isPointerLoopInvariant() const {
16361637
return getOperand(0)->isDefinedOutsideLoopRegions();
16371638
}
@@ -1817,7 +1818,7 @@ class VPVectorPointerRecipe : public VPRecipeWithIRFlags,
18171818
/// * VPWidenPointerInductionRecipe: Generate vector and scalar values for a
18181819
/// pointer induction. Produces either a vector PHI per-part or scalar values
18191820
/// per-lane based on the canonical induction.
1820-
class VPHeaderPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors {
1821+
class LLVM_ABI VPHeaderPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors {
18211822
protected:
18221823
VPHeaderPHIRecipe(unsigned char VPDefID, Instruction *UnderlyingInstr,
18231824
VPValue *Start, DebugLoc DL = DebugLoc::getUnknown())
@@ -2094,7 +2095,7 @@ class VPWidenPointerInductionRecipe : public VPWidenInductionRecipe,
20942095
/// recipe is placed in an entry block to a (non-replicate) region, it must have
20952096
/// exactly 2 incoming values, the first from the predecessor of the region and
20962097
/// the second from the exiting block of the region.
2097-
class VPWidenPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors {
2098+
class LLVM_ABI VPWidenPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors {
20982099
/// Name to use for the generated IR instruction for the widened phi.
20992100
std::string Name;
21002101

@@ -2242,7 +2243,7 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
22422243

22432244
/// A recipe for vectorizing a phi-node as a sequence of mask-based select
22442245
/// instructions.
2245-
class VPBlendRecipe : public VPSingleDefRecipe {
2246+
class LLVM_ABI VPBlendRecipe : public VPSingleDefRecipe {
22462247
public:
22472248
/// The blend operation is a User of the incoming values and of their
22482249
/// respective masks, ordered [I0, M0, I1, M1, I2, M2, ...]. Note that M0 can
@@ -2309,7 +2310,7 @@ class VPBlendRecipe : public VPSingleDefRecipe {
23092310
/// or stores into one wide load/store and shuffles. The first operand of a
23102311
/// VPInterleave recipe is the address, followed by the stored values, followed
23112312
/// by an optional mask.
2312-
class VPInterleaveRecipe : public VPRecipeBase {
2313+
class LLVM_ABI VPInterleaveRecipe : public VPRecipeBase {
23132314
const InterleaveGroup<Instruction> *IG;
23142315

23152316
/// Indicates if the interleave group is in a conditional block and requires a
@@ -2406,7 +2407,7 @@ class VPInterleaveRecipe : public VPRecipeBase {
24062407
/// A recipe to represent inloop reduction operations, performing a reduction on
24072408
/// a vector operand into a scalar value, and adding the result to a chain.
24082409
/// The Operands are {ChainOp, VecOp, [Condition]}.
2409-
class VPReductionRecipe : public VPRecipeWithIRFlags {
2410+
class LLVM_ABI VPReductionRecipe : public VPRecipeWithIRFlags {
24102411
/// The recurrence kind for the reduction in question.
24112412
RecurKind RdxKind;
24122413
bool IsOrdered;
@@ -2576,7 +2577,7 @@ class VPPartialReductionRecipe : public VPReductionRecipe {
25762577
/// intrinsics, performing a reduction on a vector operand with the explicit
25772578
/// vector length (EVL) into a scalar value, and adding the result to a chain.
25782579
/// The Operands are {ChainOp, VecOp, EVL, [Condition]}.
2579-
class VPReductionEVLRecipe : public VPReductionRecipe {
2580+
class LLVM_ABI VPReductionEVLRecipe : public VPReductionRecipe {
25802581
public:
25812582
VPReductionEVLRecipe(VPReductionRecipe &R, VPValue &EVL, VPValue *CondOp,
25822583
DebugLoc DL = {})
@@ -2803,7 +2804,7 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
28032804
/// copies of the original scalar type, one per lane, instead of producing a
28042805
/// single copy of widened type for all lanes. If the instruction is known to be
28052806
/// a single scalar, only one copy, per lane zero, will be generated.
2806-
class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
2807+
class LLVM_ABI VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
28072808
/// Indicator if only a single replica per lane is needed.
28082809
bool IsSingleScalar;
28092810

@@ -2881,7 +2882,7 @@ class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
28812882
};
28822883

28832884
/// A recipe for generating conditional branches on the bits of a mask.
2884-
class VPBranchOnMaskRecipe : public VPRecipeBase {
2885+
class LLVM_ABI VPBranchOnMaskRecipe : public VPRecipeBase {
28852886
public:
28862887
VPBranchOnMaskRecipe(VPValue *BlockInMask, DebugLoc DL)
28872888
: VPRecipeBase(VPDef::VPBranchOnMaskSC, {BlockInMask}, DL) {}
@@ -2922,7 +2923,7 @@ class VPBranchOnMaskRecipe : public VPRecipeBase {
29222923
/// order to merge values that are set under such a branch and feed their uses.
29232924
/// The phi nodes can be scalar or vector depending on the users of the value.
29242925
/// This recipe works in concert with VPBranchOnMaskRecipe.
2925-
class VPPredInstPHIRecipe : public VPSingleDefRecipe {
2926+
class LLVM_ABI VPPredInstPHIRecipe : public VPSingleDefRecipe {
29262927
public:
29272928
/// Construct a VPPredInstPHIRecipe given \p PredInst whose value needs a phi
29282929
/// nodes after merging back from a Branch-on-Mask.
@@ -2963,7 +2964,7 @@ class VPPredInstPHIRecipe : public VPSingleDefRecipe {
29632964

29642965
/// A common base class for widening memory operations. An optional mask can be
29652966
/// provided as the last operand.
2966-
class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
2967+
class LLVM_ABI VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
29672968
protected:
29682969
Instruction &Ingredient;
29692970

@@ -3044,7 +3045,7 @@ class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
30443045

30453046
/// A recipe for widening load operations, using the address to load from and an
30463047
/// optional mask.
3047-
struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
3048+
struct LLVM_ABI VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
30483049
VPWidenLoadRecipe(LoadInst &Load, VPValue *Addr, VPValue *Mask,
30493050
bool Consecutive, bool Reverse,
30503051
const VPIRMetadata &Metadata, DebugLoc DL)
@@ -3123,7 +3124,7 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
31233124

31243125
/// A recipe for widening store operations, using the stored value, the address
31253126
/// to store to and an optional mask.
3126-
struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
3127+
struct LLVM_ABI VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
31273128
VPWidenStoreRecipe(StoreInst &Store, VPValue *Addr, VPValue *StoredVal,
31283129
VPValue *Mask, bool Consecutive, bool Reverse,
31293130
const VPIRMetadata &Metadata, DebugLoc DL)
@@ -3483,7 +3484,7 @@ class VPDerivedIVRecipe : public VPSingleDefRecipe {
34833484

34843485
/// A recipe for handling phi nodes of integer and floating-point inductions,
34853486
/// producing their scalar values.
3486-
class VPScalarIVStepsRecipe : public VPRecipeWithIRFlags,
3487+
class LLVM_ABI VPScalarIVStepsRecipe : public VPRecipeWithIRFlags,
34873488
public VPUnrollPartAccessor<3> {
34883489
Instruction::BinaryOps InductionOpcode;
34893490

@@ -3593,7 +3594,7 @@ struct CastInfo<VPPhiAccessors, const VPRecipeBase *>
35933594
/// VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. It
35943595
/// holds a sequence of zero or more VPRecipe's each representing a sequence of
35953596
/// output IR instructions. All PHI-like recipes must come before any non-PHI recipes.
3596-
class VPBasicBlock : public VPBlockBase {
3597+
class LLVM_ABI VPBasicBlock : public VPBlockBase {
35973598
friend class VPlan;
35983599

35993600
/// Use VPlan::createVPBasicBlock to create VPBasicBlocks.
@@ -3781,7 +3782,7 @@ class VPIRBasicBlock : public VPBasicBlock {
37813782
/// this replication indicator helps to keep a single model for multiple
37823783
/// candidate VF's. The actual replication takes place only once the desired VF
37833784
/// and UF have been determined.
3784-
class VPRegionBlock : public VPBlockBase {
3785+
class LLVM_ABI VPRegionBlock : public VPBlockBase {
37853786
friend class VPlan;
37863787

37873788
/// Hold the Single Entry of the SESE region modelled by the VPRegionBlock.
@@ -3970,7 +3971,7 @@ class VPlan {
39703971
TripCount = TC;
39713972
}
39723973

3973-
~VPlan();
3974+
LLVM_ABI ~VPlan();
39743975

39753976
void setEntry(VPBasicBlock *VPBB) {
39763977
Entry = VPBB;
@@ -4000,8 +4001,8 @@ class VPlan {
40004001
}
40014002

40024003
/// Returns the VPRegionBlock of the vector loop.
4003-
VPRegionBlock *getVectorLoopRegion();
4004-
const VPRegionBlock *getVectorLoopRegion() const;
4004+
LLVM_ABI VPRegionBlock *getVectorLoopRegion();
4005+
LLVM_ABI const VPRegionBlock *getVectorLoopRegion() const;
40054006

40064007
/// Returns the 'middle' block of the plan, that is the block that selects
40074008
/// whether to execute the scalar tail loop or the exit block from the loop
@@ -4240,7 +4241,7 @@ class VPlan {
42404241
/// instructions in \p IRBB, except its terminator which is managed by the
42414242
/// successors of the block in VPlan. The returned block is owned by the VPlan
42424243
/// and deleted once the VPlan is destroyed.
4243-
VPIRBasicBlock *createVPIRBasicBlock(BasicBlock *IRBB);
4244+
LLVM_ABI VPIRBasicBlock *createVPIRBasicBlock(BasicBlock *IRBB);
42444245

42454246
/// Returns true if the VPlan is based on a loop with an early exit. That is
42464247
/// 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: 5 additions & 4 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,7 @@ 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, LoopInfo &LI);
5758

5859
/// Prepare the plan for vectorization. It will introduce a dedicated
5960
/// VPBasicBlock for the vector pre-header as well as a VPBasicBlock as exit
@@ -63,7 +64,7 @@ struct VPlanTransforms {
6364
/// blocks. \p InductionTy is the type of the canonical induction and used for
6465
/// related values, like the trip count expression. It also creates a VPValue
6566
/// expression for the original trip count.
66-
static void prepareForVectorization(VPlan &Plan, Type *InductionTy,
67+
LLVM_ABI static void prepareForVectorization(VPlan &Plan, Type *InductionTy,
6768
PredicatedScalarEvolution &PSE,
6869
bool RequiresScalarEpilogueCheck,
6970
bool TailFolded, Loop *TheLoop,
@@ -72,12 +73,12 @@ struct VPlanTransforms {
7273

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

7778
/// Replaces the VPInstructions in \p Plan with corresponding
7879
/// widen recipes. Returns false if any VPInstructions could not be converted
7980
/// to a wide recipe if needed.
80-
static bool tryToConvertVPInstructionsToVPRecipes(
81+
LLVM_ABI static bool tryToConvertVPInstructionsToVPRecipes(
8182
VPlanPtr &Plan,
8283
function_ref<const InductionDescriptor *(PHINode *)>
8384
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)