Skip to content

Commit 2cb6bee

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

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

@@ -635,7 +637,7 @@ class VPIRFlags {
635637
char AllowContract : 1;
636638
char ApproxFunc : 1;
637639

638-
FastMathFlagsTy(const FastMathFlags &FMF);
640+
LLVM_ABI FastMathFlagsTy(const FastMathFlags &FMF);
639641
};
640642

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

790-
FastMathFlags getFastMathFlags() const;
792+
LLVM_ABI FastMathFlags getFastMathFlags() const;
791793

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

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

922924
public:
@@ -1187,7 +1189,7 @@ class VPPhiAccessors {
11871189
#endif
11881190
};
11891191

1190-
struct VPPhi : public VPInstruction, public VPPhiAccessors {
1192+
struct LLVM_ABI VPPhi : public VPInstruction, public VPPhiAccessors {
11911193
VPPhi(ArrayRef<VPValue *> Operands, DebugLoc DL, const Twine &Name = "")
11921194
: VPInstruction(Instruction::PHI, Operands, DL, Name) {}
11931195

@@ -1308,7 +1310,7 @@ struct VPIRPhi : public VPIRInstruction, public VPPhiAccessors {
13081310
/// opcode and operands of the recipe. This recipe covers most of the
13091311
/// traditional vectorization cases where each recipe transforms into a
13101312
/// vectorized version of itself.
1311-
class VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
1313+
class LLVM_ABI VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
13121314
unsigned Opcode;
13131315

13141316
public:
@@ -1493,7 +1495,8 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
14931495
};
14941496

14951497
/// 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 {
14971500
/// Variant stores a pointer to the chosen function. There is a 1:1 mapping
14981501
/// between a given VF and the chosen vectorized variant, so there will be a
14991502
/// different VPlan for each VF with a valid variant.
@@ -1587,7 +1590,8 @@ class VPHistogramRecipe : public VPRecipeBase {
15871590
};
15881591

15891592
/// A recipe for widening select instructions.
1590-
struct VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
1593+
struct LLVM_ABI VPWidenSelectRecipe : public VPRecipeWithIRFlags,
1594+
public VPIRMetadata {
15911595
VPWidenSelectRecipe(SelectInst &I, ArrayRef<VPValue *> Operands)
15921596
: VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I),
15931597
VPIRMetadata(I) {}
@@ -1631,7 +1635,7 @@ struct VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
16311635
};
16321636

16331637
/// A recipe for handling GEP instructions.
1634-
class VPWidenGEPRecipe : public VPRecipeWithIRFlags {
1638+
class LLVM_ABI VPWidenGEPRecipe : public VPRecipeWithIRFlags {
16351639
bool isPointerLoopInvariant() const {
16361640
return getOperand(0)->isDefinedOutsideLoopRegions();
16371641
}
@@ -1817,7 +1821,8 @@ class VPVectorPointerRecipe : public VPRecipeWithIRFlags,
18171821
/// * VPWidenPointerInductionRecipe: Generate vector and scalar values for a
18181822
/// pointer induction. Produces either a vector PHI per-part or scalar values
18191823
/// per-lane based on the canonical induction.
1820-
class VPHeaderPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors {
1824+
class LLVM_ABI VPHeaderPHIRecipe : public VPSingleDefRecipe,
1825+
public VPPhiAccessors {
18211826
protected:
18221827
VPHeaderPHIRecipe(unsigned char VPDefID, Instruction *UnderlyingInstr,
18231828
VPValue *Start, DebugLoc DL = DebugLoc::getUnknown())
@@ -2094,7 +2099,8 @@ class VPWidenPointerInductionRecipe : public VPWidenInductionRecipe,
20942099
/// recipe is placed in an entry block to a (non-replicate) region, it must have
20952100
/// exactly 2 incoming values, the first from the predecessor of the region and
20962101
/// 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 {
20982104
/// Name to use for the generated IR instruction for the widened phi.
20992105
std::string Name;
21002106

@@ -2242,7 +2248,7 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
22422248

22432249
/// A recipe for vectorizing a phi-node as a sequence of mask-based select
22442250
/// instructions.
2245-
class VPBlendRecipe : public VPSingleDefRecipe {
2251+
class LLVM_ABI VPBlendRecipe : public VPSingleDefRecipe {
22462252
public:
22472253
/// The blend operation is a User of the incoming values and of their
22482254
/// respective masks, ordered [I0, M0, I1, M1, I2, M2, ...]. Note that M0 can
@@ -2309,7 +2315,7 @@ class VPBlendRecipe : public VPSingleDefRecipe {
23092315
/// or stores into one wide load/store and shuffles. The first operand of a
23102316
/// VPInterleave recipe is the address, followed by the stored values, followed
23112317
/// by an optional mask.
2312-
class VPInterleaveRecipe : public VPRecipeBase {
2318+
class LLVM_ABI VPInterleaveRecipe : public VPRecipeBase {
23132319
const InterleaveGroup<Instruction> *IG;
23142320

23152321
/// Indicates if the interleave group is in a conditional block and requires a
@@ -2406,7 +2412,7 @@ class VPInterleaveRecipe : public VPRecipeBase {
24062412
/// A recipe to represent inloop reduction operations, performing a reduction on
24072413
/// a vector operand into a scalar value, and adding the result to a chain.
24082414
/// The Operands are {ChainOp, VecOp, [Condition]}.
2409-
class VPReductionRecipe : public VPRecipeWithIRFlags {
2415+
class LLVM_ABI VPReductionRecipe : public VPRecipeWithIRFlags {
24102416
/// The recurrence kind for the reduction in question.
24112417
RecurKind RdxKind;
24122418
bool IsOrdered;
@@ -2576,7 +2582,7 @@ class VPPartialReductionRecipe : public VPReductionRecipe {
25762582
/// intrinsics, performing a reduction on a vector operand with the explicit
25772583
/// vector length (EVL) into a scalar value, and adding the result to a chain.
25782584
/// The Operands are {ChainOp, VecOp, EVL, [Condition]}.
2579-
class VPReductionEVLRecipe : public VPReductionRecipe {
2585+
class LLVM_ABI VPReductionEVLRecipe : public VPReductionRecipe {
25802586
public:
25812587
VPReductionEVLRecipe(VPReductionRecipe &R, VPValue &EVL, VPValue *CondOp,
25822588
DebugLoc DL = {})
@@ -2803,7 +2809,8 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
28032809
/// copies of the original scalar type, one per lane, instead of producing a
28042810
/// single copy of widened type for all lanes. If the instruction is known to be
28052811
/// 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 {
28072814
/// Indicator if only a single replica per lane is needed.
28082815
bool IsSingleScalar;
28092816

@@ -2881,7 +2888,7 @@ class VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
28812888
};
28822889

28832890
/// A recipe for generating conditional branches on the bits of a mask.
2884-
class VPBranchOnMaskRecipe : public VPRecipeBase {
2891+
class LLVM_ABI VPBranchOnMaskRecipe : public VPRecipeBase {
28852892
public:
28862893
VPBranchOnMaskRecipe(VPValue *BlockInMask, DebugLoc DL)
28872894
: VPRecipeBase(VPDef::VPBranchOnMaskSC, {BlockInMask}, DL) {}
@@ -2922,7 +2929,7 @@ class VPBranchOnMaskRecipe : public VPRecipeBase {
29222929
/// order to merge values that are set under such a branch and feed their uses.
29232930
/// The phi nodes can be scalar or vector depending on the users of the value.
29242931
/// This recipe works in concert with VPBranchOnMaskRecipe.
2925-
class VPPredInstPHIRecipe : public VPSingleDefRecipe {
2932+
class LLVM_ABI VPPredInstPHIRecipe : public VPSingleDefRecipe {
29262933
public:
29272934
/// Construct a VPPredInstPHIRecipe given \p PredInst whose value needs a phi
29282935
/// nodes after merging back from a Branch-on-Mask.
@@ -2963,7 +2970,7 @@ class VPPredInstPHIRecipe : public VPSingleDefRecipe {
29632970

29642971
/// A common base class for widening memory operations. An optional mask can be
29652972
/// provided as the last operand.
2966-
class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
2973+
class LLVM_ABI VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
29672974
protected:
29682975
Instruction &Ingredient;
29692976

@@ -3044,7 +3051,8 @@ class VPWidenMemoryRecipe : public VPRecipeBase, public VPIRMetadata {
30443051

30453052
/// A recipe for widening load operations, using the address to load from and an
30463053
/// optional mask.
3047-
struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
3054+
struct LLVM_ABI VPWidenLoadRecipe final : public VPWidenMemoryRecipe,
3055+
public VPValue {
30483056
VPWidenLoadRecipe(LoadInst &Load, VPValue *Addr, VPValue *Mask,
30493057
bool Consecutive, bool Reverse,
30503058
const VPIRMetadata &Metadata, DebugLoc DL)
@@ -3123,7 +3131,7 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
31233131

31243132
/// A recipe for widening store operations, using the stored value, the address
31253133
/// to store to and an optional mask.
3126-
struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
3134+
struct LLVM_ABI VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
31273135
VPWidenStoreRecipe(StoreInst &Store, VPValue *Addr, VPValue *StoredVal,
31283136
VPValue *Mask, bool Consecutive, bool Reverse,
31293137
const VPIRMetadata &Metadata, DebugLoc DL)
@@ -3483,8 +3491,8 @@ class VPDerivedIVRecipe : public VPSingleDefRecipe {
34833491

34843492
/// A recipe for handling phi nodes of integer and floating-point inductions,
34853493
/// producing their scalar values.
3486-
class VPScalarIVStepsRecipe : public VPRecipeWithIRFlags,
3487-
public VPUnrollPartAccessor<3> {
3494+
class LLVM_ABI VPScalarIVStepsRecipe : public VPRecipeWithIRFlags,
3495+
public VPUnrollPartAccessor<3> {
34883496
Instruction::BinaryOps InductionOpcode;
34893497

34903498
public:
@@ -3593,7 +3601,7 @@ struct CastInfo<VPPhiAccessors, const VPRecipeBase *>
35933601
/// VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. It
35943602
/// holds a sequence of zero or more VPRecipe's each representing a sequence of
35953603
/// 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 {
35973605
friend class VPlan;
35983606

35993607
/// Use VPlan::createVPBasicBlock to create VPBasicBlocks.
@@ -3781,7 +3789,7 @@ class VPIRBasicBlock : public VPBasicBlock {
37813789
/// this replication indicator helps to keep a single model for multiple
37823790
/// candidate VF's. The actual replication takes place only once the desired VF
37833791
/// and UF have been determined.
3784-
class VPRegionBlock : public VPBlockBase {
3792+
class LLVM_ABI VPRegionBlock : public VPBlockBase {
37853793
friend class VPlan;
37863794

37873795
/// Hold the Single Entry of the SESE region modelled by the VPRegionBlock.
@@ -3970,7 +3978,7 @@ class VPlan {
39703978
TripCount = TC;
39713979
}
39723980

3973-
~VPlan();
3981+
LLVM_ABI ~VPlan();
39743982

39753983
void setEntry(VPBasicBlock *VPBB) {
39763984
Entry = VPBB;
@@ -4000,8 +4008,8 @@ class VPlan {
40004008
}
40014009

40024010
/// 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;
40054013

40064014
/// Returns the 'middle' block of the plan, that is the block that selects
40074015
/// whether to execute the scalar tail loop or the exit block from the loop
@@ -4240,7 +4248,7 @@ class VPlan {
42404248
/// instructions in \p IRBB, except its terminator which is managed by the
42414249
/// successors of the block in VPlan. The returned block is owned by the VPlan
42424250
/// and deleted once the VPlan is destroyed.
4243-
VPIRBasicBlock *createVPIRBasicBlock(BasicBlock *IRBB);
4251+
LLVM_ABI VPIRBasicBlock *createVPIRBasicBlock(BasicBlock *IRBB);
42444252

42454253
/// Returns true if the VPlan is based on a loop with an early exit. That is
42464254
/// 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)