-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Add more missing LLVM_ABI annotations
#168765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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.
|
@llvm/pr-subscribers-vectorizers @llvm/pr-subscribers-llvm-analysis Author: Fabrice de Gans (Steelskin) ChangesThis patch updates various LLVM headers to properly add the This effort is tracked in #109483. Full diff: https://github.com/llvm/llvm-project/pull/168765.diff 8 Files Affected:
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 83dd1eba876e6..d6325806f940f 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -3908,31 +3908,33 @@ LLVMGetPreviousDbgRecord(LLVMDbgRecordRef DbgRecord);
*
* @see llvm::DbgRecord::getDebugLoc()
*/
-LLVMMetadataRef LLVMDbgRecordGetDebugLoc(LLVMDbgRecordRef Rec);
+LLVM_C_ABI LLVMMetadataRef LLVMDbgRecordGetDebugLoc(LLVMDbgRecordRef Rec);
-LLVMDbgRecordKind LLVMDbgRecordGetKind(LLVMDbgRecordRef Rec);
+LLVM_C_ABI LLVMDbgRecordKind LLVMDbgRecordGetKind(LLVMDbgRecordRef Rec);
/**
* Get the value of the DbgVariableRecord.
*
* @see llvm::DbgVariableRecord::getValue()
*/
-LLVMValueRef LLVMDbgVariableRecordGetValue(LLVMDbgRecordRef Rec,
- unsigned OpIdx);
+LLVM_C_ABI LLVMValueRef LLVMDbgVariableRecordGetValue(LLVMDbgRecordRef Rec,
+ unsigned OpIdx);
/**
* Get the debug info variable of the DbgVariableRecord.
*
* @see llvm::DbgVariableRecord::getVariable()
*/
-LLVMMetadataRef LLVMDbgVariableRecordGetVariable(LLVMDbgRecordRef Rec);
+LLVM_C_ABI LLVMMetadataRef
+LLVMDbgVariableRecordGetVariable(LLVMDbgRecordRef Rec);
/**
* Get the debug info expression of the DbgVariableRecord.
*
* @see llvm::DbgVariableRecord::getExpression()
*/
-LLVMMetadataRef LLVMDbgVariableRecordGetExpression(LLVMDbgRecordRef Rec);
+LLVM_C_ABI LLVMMetadataRef
+LLVMDbgVariableRecordGetExpression(LLVMDbgRecordRef Rec);
/**
* @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations
diff --git a/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h b/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h
index 28a2ec47f81ad..82d2c12e5beb3 100644
--- a/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h
+++ b/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h
@@ -14,7 +14,7 @@
namespace llvm {
-class LLVM_ABI RuntimeLibraryAnalysis
+class RuntimeLibraryAnalysis
: public AnalysisInfoMixin<RuntimeLibraryAnalysis> {
public:
using Result = RTLIB::RuntimeLibcallsInfo;
diff --git a/llvm/include/llvm/CAS/ActionCache.h b/llvm/include/llvm/CAS/ActionCache.h
index 2981fd6d18b5a..536e36f6fecd6 100644
--- a/llvm/include/llvm/CAS/ActionCache.h
+++ b/llvm/include/llvm/CAS/ActionCache.h
@@ -33,7 +33,7 @@ class CacheKey {
public:
StringRef getKey() const { return Key; }
- CacheKey(const CASID &ID);
+ LLVM_ABI CacheKey(const CASID &ID);
LLVM_ABI_FOR_TEST CacheKey(const ObjectProxy &Proxy);
CacheKey(const ObjectStore &CAS, const ObjectRef &Ref);
diff --git a/llvm/include/llvm/CAS/BuiltinUnifiedCASDatabases.h b/llvm/include/llvm/CAS/BuiltinUnifiedCASDatabases.h
index 6368fca4f7072..0ac9386f1cda1 100644
--- a/llvm/include/llvm/CAS/BuiltinUnifiedCASDatabases.h
+++ b/llvm/include/llvm/CAS/BuiltinUnifiedCASDatabases.h
@@ -51,6 +51,7 @@ enum class ValidationResult {
/// was invalid but has been cleared, \c Skipped if validation is not needed,
/// or an \c Error if validation cannot be performed or if the data is left
/// in an invalid state because \p AllowRecovery is false.
+LLVM_ABI
Expected<ValidationResult> validateOnDiskUnifiedCASDatabasesIfNeeded(
StringRef Path, bool CheckHash, bool AllowRecovery, bool ForceValidation,
std::optional<StringRef> LLVMCasBinaryPath);
diff --git a/llvm/include/llvm/CAS/ObjectStore.h b/llvm/include/llvm/CAS/ObjectStore.h
index 22562133ece93..2e5b939404e42 100644
--- a/llvm/include/llvm/CAS/ObjectStore.h
+++ b/llvm/include/llvm/CAS/ObjectStore.h
@@ -251,7 +251,8 @@ class ObjectStore {
/// Import object from another CAS. This will import the full tree from the
/// other CAS.
- Expected<ObjectRef> importObject(ObjectStore &Upstream, ObjectRef Other);
+ LLVM_ABI Expected<ObjectRef> importObject(ObjectStore &Upstream,
+ ObjectRef Other);
/// Print the ObjectStore internals for debugging purpose.
virtual void print(raw_ostream &) const {}
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index cf96547063cd0..dbbdf3bca7a6d 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -80,7 +80,7 @@ struct RuntimeLibcallsInfo {
RuntimeLibcallsInfo() = default;
- explicit RuntimeLibcallsInfo(
+ LLVM_ABI explicit RuntimeLibcallsInfo(
const Triple &TT,
ExceptionHandling ExceptionModel = ExceptionHandling::None,
FloatABI::ABIType FloatABI = FloatABI::Default,
@@ -89,8 +89,8 @@ struct RuntimeLibcallsInfo {
explicit RuntimeLibcallsInfo(const Module &M);
- bool invalidate(Module &M, const PreservedAnalyses &PA,
- ModuleAnalysisManager::Invalidator &);
+ LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
+ ModuleAnalysisManager::Invalidator &);
/// Get the libcall routine name for the specified libcall implementation.
static StringRef getLibcallImplName(RTLIB::LibcallImpl CallImpl) {
diff --git a/llvm/include/llvm/SandboxIR/Instruction.h b/llvm/include/llvm/SandboxIR/Instruction.h
index d928068f0bf27..95e59a49125c5 100644
--- a/llvm/include/llvm/SandboxIR/Instruction.h
+++ b/llvm/include/llvm/SandboxIR/Instruction.h
@@ -1901,8 +1901,8 @@ class SwitchInst : public SingleLLVMInstructionImpl<llvm::SwitchInst> {
public:
CaseHandleImpl(Context &Ctx, LLVMCaseItT LLVMCaseIt)
: Ctx(Ctx), LLVMCaseIt(LLVMCaseIt) {}
- ConstT *getCaseValue() const;
- BlockT *getCaseSuccessor() const;
+ LLVM_ABI_FOR_TEST ConstT *getCaseValue() const;
+ LLVM_ABI_FOR_TEST BlockT *getCaseSuccessor() const;
unsigned getCaseIndex() const {
const auto &LLVMCaseHandle = *LLVMCaseIt;
return LLVMCaseHandle.getCaseIndex();
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index fedbcfb6bd32a..8a91fb6f1f326 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -871,7 +871,7 @@ class VPIRFlags {
#if !defined(NDEBUG)
/// Returns true if the set flags are valid for \p Opcode.
- bool flagsValidForOpcode(unsigned Opcode) const;
+ LLVM_ABI_FOR_TEST bool flagsValidForOpcode(unsigned Opcode) const;
#endif
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
@@ -1533,11 +1533,11 @@ class VPWidenCastRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
VP_CLASSOF_IMPL(VPDef::VPWidenCastSC)
/// Produce widened copies of the cast.
- void execute(VPTransformState &State) override;
+ LLVM_ABI_FOR_TEST void execute(VPTransformState &State) override;
/// Return the cost of this VPWidenCastRecipe.
- InstructionCost computeCost(ElementCount VF,
- VPCostContext &Ctx) const override;
+ LLVM_ABI_FOR_TEST InstructionCost
+ computeCost(ElementCount VF, VPCostContext &Ctx) const override;
Instruction::CastOps getOpcode() const { return Opcode; }
@@ -1547,8 +1547,8 @@ class VPWidenCastRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
protected:
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
/// Print the recipe.
- void printRecipe(raw_ostream &O, const Twine &Indent,
- VPSlotTracker &SlotTracker) const override;
+ LLVM_ABI_FOR_TEST void printRecipe(raw_ostream &O, const Twine &Indent,
+ VPSlotTracker &SlotTracker) const override;
#endif
};
@@ -1617,11 +1617,11 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
VP_CLASSOF_IMPL(VPDef::VPWidenIntrinsicSC)
/// Produce a widened version of the vector intrinsic.
- void execute(VPTransformState &State) override;
+ LLVM_ABI_FOR_TEST void execute(VPTransformState &State) override;
/// Return the cost of this vector intrinsic.
- InstructionCost computeCost(ElementCount VF,
- VPCostContext &Ctx) const override;
+ LLVM_ABI_FOR_TEST InstructionCost
+ computeCost(ElementCount VF, VPCostContext &Ctx) const override;
/// Return the ID of the intrinsic.
Intrinsic::ID getVectorIntrinsicID() const { return VectorIntrinsicID; }
@@ -1641,13 +1641,13 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
/// Returns true if the intrinsic may have side-effects.
bool mayHaveSideEffects() const { return MayHaveSideEffects; }
- bool usesFirstLaneOnly(const VPValue *Op) const override;
+ LLVM_ABI_FOR_TEST bool usesFirstLaneOnly(const VPValue *Op) const override;
protected:
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
/// Print the recipe.
- void printRecipe(raw_ostream &O, const Twine &Indent,
- VPSlotTracker &SlotTracker) const override;
+ LLVM_ABI_FOR_TEST void printRecipe(raw_ostream &O, const Twine &Indent,
+ VPSlotTracker &SlotTracker) const override;
#endif
};
@@ -3376,11 +3376,11 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
VPValue *getEVL() const { return getOperand(1); }
/// Generate the wide load or gather.
- void execute(VPTransformState &State) override;
+ LLVM_ABI_FOR_TEST void execute(VPTransformState &State) override;
/// Return the cost of this VPWidenLoadEVLRecipe.
- InstructionCost computeCost(ElementCount VF,
- VPCostContext &Ctx) const override;
+ LLVM_ABI_FOR_TEST InstructionCost
+ computeCost(ElementCount VF, VPCostContext &Ctx) const override;
/// Returns true if the recipe only uses the first lane of operand \p Op.
bool usesFirstLaneOnly(const VPValue *Op) const override {
@@ -3394,8 +3394,8 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
protected:
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
/// Print the recipe.
- void printRecipe(raw_ostream &O, const Twine &Indent,
- VPSlotTracker &SlotTracker) const override;
+ LLVM_ABI_FOR_TEST void printRecipe(raw_ostream &O, const Twine &Indent,
+ VPSlotTracker &SlotTracker) const override;
#endif
};
@@ -3462,11 +3462,11 @@ struct VPWidenStoreEVLRecipe final : public VPWidenMemoryRecipe {
VPValue *getEVL() const { return getOperand(2); }
/// Generate the wide store or scatter.
- void execute(VPTransformState &State) override;
+ LLVM_ABI_FOR_TEST void execute(VPTransformState &State) override;
/// Return the cost of this VPWidenStoreEVLRecipe.
- InstructionCost computeCost(ElementCount VF,
- VPCostContext &Ctx) const override;
+ LLVM_ABI_FOR_TEST InstructionCost
+ computeCost(ElementCount VF, VPCostContext &Ctx) const override;
/// Returns true if the recipe only uses the first lane of operand \p Op.
bool usesFirstLaneOnly(const VPValue *Op) const override {
@@ -3485,8 +3485,8 @@ struct VPWidenStoreEVLRecipe final : public VPWidenMemoryRecipe {
protected:
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
/// Print the recipe.
- void printRecipe(raw_ostream &O, const Twine &Indent,
- VPSlotTracker &SlotTracker) const override;
+ LLVM_ABI_FOR_TEST void printRecipe(raw_ostream &O, const Twine &Indent,
+ VPSlotTracker &SlotTracker) const override;
#endif
};
|
| #if !defined(NDEBUG) | ||
| /// Returns true if the set flags are valid for \p Opcode. | ||
| bool flagsValidForOpcode(unsigned Opcode) const; | ||
| LLVM_ABI_FOR_TEST bool flagsValidForOpcode(unsigned Opcode) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? flagsValidForOpcode isn't used for llvm/unittests, I thought that LLVM_ABI_FOR_TEST was needed for function called from there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐧 Linux x64 Test Results
|
This patch updates various LLVM headers to properly add the
LLVM_ABIandLLVM_ABI_FOR_TESTannotations ot build LLVM as a DLL on Windows.This effort is tracked in #109483.