Skip to content

Commit d478baa

Browse files
authored
Add more missing LLVM_ABI annotations (llvm#168765)
This patch updates various LLVM headers to properly add the `LLVM_ABI` and `LLVM_ABI_FOR_TEST` annotations ot build LLVM as a DLL on Windows. This effort is tracked in llvm#109483.
1 parent 95e6edc commit d478baa

File tree

7 files changed

+39
-35
lines changed

7 files changed

+39
-35
lines changed

llvm/include/llvm-c/Core.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3997,31 +3997,33 @@ LLVMGetPreviousDbgRecord(LLVMDbgRecordRef DbgRecord);
39973997
*
39983998
* @see llvm::DbgRecord::getDebugLoc()
39993999
*/
4000-
LLVMMetadataRef LLVMDbgRecordGetDebugLoc(LLVMDbgRecordRef Rec);
4000+
LLVM_C_ABI LLVMMetadataRef LLVMDbgRecordGetDebugLoc(LLVMDbgRecordRef Rec);
40014001

4002-
LLVMDbgRecordKind LLVMDbgRecordGetKind(LLVMDbgRecordRef Rec);
4002+
LLVM_C_ABI LLVMDbgRecordKind LLVMDbgRecordGetKind(LLVMDbgRecordRef Rec);
40034003

40044004
/**
40054005
* Get the value of the DbgVariableRecord.
40064006
*
40074007
* @see llvm::DbgVariableRecord::getValue()
40084008
*/
4009-
LLVMValueRef LLVMDbgVariableRecordGetValue(LLVMDbgRecordRef Rec,
4010-
unsigned OpIdx);
4009+
LLVM_C_ABI LLVMValueRef LLVMDbgVariableRecordGetValue(LLVMDbgRecordRef Rec,
4010+
unsigned OpIdx);
40114011

40124012
/**
40134013
* Get the debug info variable of the DbgVariableRecord.
40144014
*
40154015
* @see llvm::DbgVariableRecord::getVariable()
40164016
*/
4017-
LLVMMetadataRef LLVMDbgVariableRecordGetVariable(LLVMDbgRecordRef Rec);
4017+
LLVM_C_ABI LLVMMetadataRef
4018+
LLVMDbgVariableRecordGetVariable(LLVMDbgRecordRef Rec);
40184019

40194020
/**
40204021
* Get the debug info expression of the DbgVariableRecord.
40214022
*
40224023
* @see llvm::DbgVariableRecord::getExpression()
40234024
*/
4024-
LLVMMetadataRef LLVMDbgVariableRecordGetExpression(LLVMDbgRecordRef Rec);
4025+
LLVM_C_ABI LLVMMetadataRef
4026+
LLVMDbgVariableRecordGetExpression(LLVMDbgRecordRef Rec);
40254027

40264028
/**
40274029
* @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations

llvm/include/llvm/CAS/ActionCache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CacheKey {
3333
public:
3434
StringRef getKey() const { return Key; }
3535

36-
CacheKey(const CASID &ID);
36+
LLVM_ABI CacheKey(const CASID &ID);
3737
LLVM_ABI_FOR_TEST CacheKey(const ObjectProxy &Proxy);
3838
CacheKey(const ObjectStore &CAS, const ObjectRef &Ref);
3939

llvm/include/llvm/CAS/BuiltinUnifiedCASDatabases.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ enum class ValidationResult {
5151
/// was invalid but has been cleared, \c Skipped if validation is not needed,
5252
/// or an \c Error if validation cannot be performed or if the data is left
5353
/// in an invalid state because \p AllowRecovery is false.
54+
LLVM_ABI
5455
Expected<ValidationResult> validateOnDiskUnifiedCASDatabasesIfNeeded(
5556
StringRef Path, bool CheckHash, bool AllowRecovery, bool ForceValidation,
5657
std::optional<StringRef> LLVMCasBinaryPath);

llvm/include/llvm/CAS/ObjectStore.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ class ObjectStore {
251251

252252
/// Import object from another CAS. This will import the full tree from the
253253
/// other CAS.
254-
Expected<ObjectRef> importObject(ObjectStore &Upstream, ObjectRef Other);
254+
LLVM_ABI Expected<ObjectRef> importObject(ObjectStore &Upstream,
255+
ObjectRef Other);
255256

256257
/// Print the ObjectStore internals for debugging purpose.
257258
virtual void print(raw_ostream &) const {}

llvm/include/llvm/IR/RuntimeLibcalls.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct RuntimeLibcallsInfo {
8080

8181
RuntimeLibcallsInfo() = default;
8282

83-
explicit RuntimeLibcallsInfo(
83+
LLVM_ABI explicit RuntimeLibcallsInfo(
8484
const Triple &TT,
8585
ExceptionHandling ExceptionModel = ExceptionHandling::None,
8686
FloatABI::ABIType FloatABI = FloatABI::Default,
@@ -89,8 +89,8 @@ struct RuntimeLibcallsInfo {
8989

9090
explicit RuntimeLibcallsInfo(const Module &M);
9191

92-
bool invalidate(Module &M, const PreservedAnalyses &PA,
93-
ModuleAnalysisManager::Invalidator &);
92+
LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
93+
ModuleAnalysisManager::Invalidator &);
9494

9595
/// Get the libcall routine name for the specified libcall implementation.
9696
static StringRef getLibcallImplName(RTLIB::LibcallImpl CallImpl) {

llvm/include/llvm/SandboxIR/Instruction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,8 +1901,8 @@ class SwitchInst : public SingleLLVMInstructionImpl<llvm::SwitchInst> {
19011901
public:
19021902
CaseHandleImpl(Context &Ctx, LLVMCaseItT LLVMCaseIt)
19031903
: Ctx(Ctx), LLVMCaseIt(LLVMCaseIt) {}
1904-
ConstT *getCaseValue() const;
1905-
BlockT *getCaseSuccessor() const;
1904+
LLVM_ABI_FOR_TEST ConstT *getCaseValue() const;
1905+
LLVM_ABI_FOR_TEST BlockT *getCaseSuccessor() const;
19061906
unsigned getCaseIndex() const {
19071907
const auto &LLVMCaseHandle = *LLVMCaseIt;
19081908
return LLVMCaseHandle.getCaseIndex();

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ class VPIRFlags {
910910
public:
911911
#if !defined(NDEBUG)
912912
/// Returns true if the set flags are valid for \p Opcode.
913-
bool flagsValidForOpcode(unsigned Opcode) const;
913+
LLVM_ABI_FOR_TEST bool flagsValidForOpcode(unsigned Opcode) const;
914914
#endif
915915

916916
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
@@ -1579,11 +1579,11 @@ class VPWidenCastRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15791579
VP_CLASSOF_IMPL(VPDef::VPWidenCastSC)
15801580

15811581
/// Produce widened copies of the cast.
1582-
void execute(VPTransformState &State) override;
1582+
LLVM_ABI_FOR_TEST void execute(VPTransformState &State) override;
15831583

15841584
/// Return the cost of this VPWidenCastRecipe.
1585-
InstructionCost computeCost(ElementCount VF,
1586-
VPCostContext &Ctx) const override;
1585+
LLVM_ABI_FOR_TEST InstructionCost
1586+
computeCost(ElementCount VF, VPCostContext &Ctx) const override;
15871587

15881588
Instruction::CastOps getOpcode() const { return Opcode; }
15891589

@@ -1593,8 +1593,8 @@ class VPWidenCastRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15931593
protected:
15941594
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
15951595
/// Print the recipe.
1596-
void printRecipe(raw_ostream &O, const Twine &Indent,
1597-
VPSlotTracker &SlotTracker) const override;
1596+
LLVM_ABI_FOR_TEST void printRecipe(raw_ostream &O, const Twine &Indent,
1597+
VPSlotTracker &SlotTracker) const override;
15981598
#endif
15991599
};
16001600

@@ -1663,11 +1663,11 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
16631663
VP_CLASSOF_IMPL(VPDef::VPWidenIntrinsicSC)
16641664

16651665
/// Produce a widened version of the vector intrinsic.
1666-
void execute(VPTransformState &State) override;
1666+
LLVM_ABI_FOR_TEST void execute(VPTransformState &State) override;
16671667

16681668
/// Return the cost of this vector intrinsic.
1669-
InstructionCost computeCost(ElementCount VF,
1670-
VPCostContext &Ctx) const override;
1669+
LLVM_ABI_FOR_TEST InstructionCost
1670+
computeCost(ElementCount VF, VPCostContext &Ctx) const override;
16711671

16721672
/// Return the ID of the intrinsic.
16731673
Intrinsic::ID getVectorIntrinsicID() const { return VectorIntrinsicID; }
@@ -1687,13 +1687,13 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
16871687
/// Returns true if the intrinsic may have side-effects.
16881688
bool mayHaveSideEffects() const { return MayHaveSideEffects; }
16891689

1690-
bool usesFirstLaneOnly(const VPValue *Op) const override;
1690+
LLVM_ABI_FOR_TEST bool usesFirstLaneOnly(const VPValue *Op) const override;
16911691

16921692
protected:
16931693
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
16941694
/// Print the recipe.
1695-
void printRecipe(raw_ostream &O, const Twine &Indent,
1696-
VPSlotTracker &SlotTracker) const override;
1695+
LLVM_ABI_FOR_TEST void printRecipe(raw_ostream &O, const Twine &Indent,
1696+
VPSlotTracker &SlotTracker) const override;
16971697
#endif
16981698
};
16991699

@@ -3391,11 +3391,11 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
33913391
VPValue *getEVL() const { return getOperand(1); }
33923392

33933393
/// Generate the wide load or gather.
3394-
void execute(VPTransformState &State) override;
3394+
LLVM_ABI_FOR_TEST void execute(VPTransformState &State) override;
33953395

33963396
/// Return the cost of this VPWidenLoadEVLRecipe.
3397-
InstructionCost computeCost(ElementCount VF,
3398-
VPCostContext &Ctx) const override;
3397+
LLVM_ABI_FOR_TEST InstructionCost
3398+
computeCost(ElementCount VF, VPCostContext &Ctx) const override;
33993399

34003400
/// Returns true if the recipe only uses the first lane of operand \p Op.
34013401
bool usesFirstLaneOnly(const VPValue *Op) const override {
@@ -3409,8 +3409,8 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
34093409
protected:
34103410
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
34113411
/// Print the recipe.
3412-
void printRecipe(raw_ostream &O, const Twine &Indent,
3413-
VPSlotTracker &SlotTracker) const override;
3412+
LLVM_ABI_FOR_TEST void printRecipe(raw_ostream &O, const Twine &Indent,
3413+
VPSlotTracker &SlotTracker) const override;
34143414
#endif
34153415
};
34163416

@@ -3477,11 +3477,11 @@ struct VPWidenStoreEVLRecipe final : public VPWidenMemoryRecipe {
34773477
VPValue *getEVL() const { return getOperand(2); }
34783478

34793479
/// Generate the wide store or scatter.
3480-
void execute(VPTransformState &State) override;
3480+
LLVM_ABI_FOR_TEST void execute(VPTransformState &State) override;
34813481

34823482
/// Return the cost of this VPWidenStoreEVLRecipe.
3483-
InstructionCost computeCost(ElementCount VF,
3484-
VPCostContext &Ctx) const override;
3483+
LLVM_ABI_FOR_TEST InstructionCost
3484+
computeCost(ElementCount VF, VPCostContext &Ctx) const override;
34853485

34863486
/// Returns true if the recipe only uses the first lane of operand \p Op.
34873487
bool usesFirstLaneOnly(const VPValue *Op) const override {
@@ -3500,8 +3500,8 @@ struct VPWidenStoreEVLRecipe final : public VPWidenMemoryRecipe {
35003500
protected:
35013501
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
35023502
/// Print the recipe.
3503-
void printRecipe(raw_ostream &O, const Twine &Indent,
3504-
VPSlotTracker &SlotTracker) const override;
3503+
LLVM_ABI_FOR_TEST void printRecipe(raw_ostream &O, const Twine &Indent,
3504+
VPSlotTracker &SlotTracker) const override;
35053505
#endif
35063506
};
35073507

0 commit comments

Comments
 (0)