[llvm] [llvm] annotate interfaces in llvm/Transforms for DLL export (PR #143413)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 14:13:47 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Andrew Rogers (andrurogerz)
<details>
<summary>Changes</summary>
## Purpose
This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm/Transforms` library. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build.
## Background
This effort is tracked in #<!-- -->109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst).
The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`.
The following manual adjustments were also applied after running IDS on Linux:
- Removed a redundant `operator<<` from Attributor.h. IDS only auto-annotates the 1st declaration, and the 2nd declaration being un-annotated resulted in an "inconsistent linkage" error on Windows when building LLVM as a DLL.
- `#include` the `VirtualFileSystem.h` in PGOInstrumentation.h and remove the local declaration of the `vfs::FileSystem` class. This is required because exporting the `PGOInstrumentationUse` constructor requires the class be fully defined because it is used by an argument.
- Add #include "llvm/Support/Compiler.h" to files where it was not auto-added by IDS due to no pre-existing block of include statements.
- Add `LLVM_TEMPLATE_ABI` and `LLVM_EXPORT_TEMPLATE` to exported instantiated templates.
## Validation
Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:
- Windows with MSVC
- Windows with Clang
- Linux with GCC
- Linux with Clang
- Darwin with Clang
---
Patch is 449.44 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/143413.diff
110 Files Affected:
- (modified) llvm/include/llvm/Transforms/Coroutines/ABI.h (+5-4)
- (modified) llvm/include/llvm/Transforms/Coroutines/CoroInstr.h (+5-4)
- (modified) llvm/include/llvm/Transforms/Coroutines/CoroShape.h (+16-11)
- (modified) llvm/include/llvm/Transforms/Coroutines/CoroSplit.h (+9-5)
- (modified) llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h (+5-3)
- (modified) llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h (+6-3)
- (modified) llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h (+3-2)
- (modified) llvm/include/llvm/Transforms/IPO.h (+5-5)
- (modified) llvm/include/llvm/Transforms/IPO/AlwaysInliner.h (+3-3)
- (modified) llvm/include/llvm/Transforms/IPO/Attributor.h (+334-290)
- (modified) llvm/include/llvm/Transforms/IPO/BlockExtractor.h (+3-1)
- (modified) llvm/include/llvm/Transforms/IPO/EmbedBitcodePass.h (+2-1)
- (modified) llvm/include/llvm/Transforms/IPO/ExtractGV.h (+4-3)
- (modified) llvm/include/llvm/Transforms/IPO/FunctionAttrs.h (+11-7)
- (modified) llvm/include/llvm/Transforms/IPO/FunctionImport.h (+25-22)
- (modified) llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h (+6-5)
- (modified) llvm/include/llvm/Transforms/IPO/GlobalDCE.h (+5-3)
- (modified) llvm/include/llvm/Transforms/IPO/Inliner.h (+12-8)
- (modified) llvm/include/llvm/Transforms/IPO/Internalize.h (+4-3)
- (modified) llvm/include/llvm/Transforms/IPO/LowerTypeTests.h (+10-9)
- (modified) llvm/include/llvm/Transforms/IPO/MergeFunctions.h (+4-3)
- (modified) llvm/include/llvm/Transforms/IPO/ModuleInliner.h (+2-1)
- (modified) llvm/include/llvm/Transforms/IPO/SampleContextTracker.h (+46-40)
- (modified) llvm/include/llvm/Transforms/IPO/SampleProfile.h (+9-8)
- (modified) llvm/include/llvm/Transforms/IPO/SampleProfileProbe.h (+8-7)
- (modified) llvm/include/llvm/Transforms/IPO/StripDeadPrototypes.h (+2-1)
- (modified) llvm/include/llvm/Transforms/IPO/StripSymbols.h (+6-5)
- (modified) llvm/include/llvm/Transforms/IPO/ThinLTOBitcodeWriter.h (+2-1)
- (modified) llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h (+20-18)
- (modified) llvm/include/llvm/Transforms/InstCombine/InstCombine.h (+8-6)
- (modified) llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h (+9-5)
- (modified) llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h (+5-3)
- (modified) llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h (+2-1)
- (modified) llvm/include/llvm/Transforms/Instrumentation/GCOVProfiler.h (+2-1)
- (modified) llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h (+5-3)
- (modified) llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h (+2-1)
- (modified) llvm/include/llvm/Transforms/Instrumentation/KCFI.h (+2-1)
- (modified) llvm/include/llvm/Transforms/Instrumentation/LowerAllowCheckPass.h (+6-4)
- (modified) llvm/include/llvm/Transforms/Instrumentation/MemProfInstrumentation.h (+5-4)
- (modified) llvm/include/llvm/Transforms/Instrumentation/MemProfUse.h (+7-5)
- (modified) llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h (+7-5)
- (modified) llvm/include/llvm/Transforms/Instrumentation/NumericalStabilitySanitizer.h (+2-1)
- (modified) llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h (+13-13)
- (modified) llvm/include/llvm/Transforms/Instrumentation/RealtimeSanitizer.h (+2-1)
- (modified) llvm/include/llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h (+3-2)
- (modified) llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h (+2-1)
- (modified) llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h (+3-2)
- (modified) llvm/include/llvm/Transforms/Instrumentation/TypeSanitizer.h (+2-1)
- (modified) llvm/include/llvm/Transforms/ObjCARC.h (+7-6)
- (modified) llvm/include/llvm/Transforms/Scalar.h (+35-32)
- (modified) llvm/include/llvm/Transforms/Scalar/EarlyCSE.h (+5-3)
- (modified) llvm/include/llvm/Transforms/Scalar/GVN.h (+37-34)
- (modified) llvm/include/llvm/Transforms/Scalar/JumpThreading.h (+54-46)
- (modified) llvm/include/llvm/Transforms/Scalar/LoopPassManager.h (+22-18)
- (modified) llvm/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h (+2-1)
- (modified) llvm/include/llvm/Transforms/Scalar/SCCP.h (+2-1)
- (modified) llvm/include/llvm/Transforms/Scalar/Scalarizer.h (+3-2)
- (modified) llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h (+7-5)
- (modified) llvm/include/llvm/Transforms/Utils.h (+19-17)
- (modified) llvm/include/llvm/Transforms/Utils/AMDGPUEmitPrintf.h (+3-2)
- (modified) llvm/include/llvm/Transforms/Utils/ASanStackFrameLayout.h (+5-4)
- (modified) llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h (+15-14)
- (modified) llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h (+118-117)
- (modified) llvm/include/llvm/Transforms/Utils/BuildLibCalls.h (+138-113)
- (modified) llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h (+6-5)
- (modified) llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h (+16-14)
- (modified) llvm/include/llvm/Transforms/Utils/Cloning.h (+91-90)
- (modified) llvm/include/llvm/Transforms/Utils/CodeExtractor.h (+23-18)
- (modified) llvm/include/llvm/Transforms/Utils/CodeLayout.h (+11-9)
- (modified) llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h (+35-28)
- (modified) llvm/include/llvm/Transforms/Utils/Debugify.h (+27-22)
- (modified) llvm/include/llvm/Transforms/Utils/FunctionComparator.h (+19-16)
- (modified) llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h (+7-5)
- (modified) llvm/include/llvm/Transforms/Utils/Instrumentation.h (+16-14)
- (modified) llvm/include/llvm/Transforms/Utils/IntegerDivision.h (+34-32)
- (modified) llvm/include/llvm/Transforms/Utils/LCSSA.h (+2-1)
- (modified) llvm/include/llvm/Transforms/Utils/Local.h (+149-122)
- (modified) llvm/include/llvm/Transforms/Utils/LoopRotationUtils.h (+8-5)
- (modified) llvm/include/llvm/Transforms/Utils/LoopSimplify.h (+5-4)
- (modified) llvm/include/llvm/Transforms/Utils/LoopUtils.h (+143-117)
- (modified) llvm/include/llvm/Transforms/Utils/LowerMemIntrinsics.h (+13-10)
- (modified) llvm/include/llvm/Transforms/Utils/ModuleUtils.h (+35-28)
- (modified) llvm/include/llvm/Transforms/Utils/PredicateInfo.h (+9-8)
- (modified) llvm/include/llvm/Transforms/Utils/PromoteMemToReg.h (+3-3)
- (modified) llvm/include/llvm/Transforms/Utils/SCCPSolver.h (+53-46)
- (modified) llvm/include/llvm/Transforms/Utils/SSAUpdaterBulk.h (+7-5)
- (modified) llvm/include/llvm/Transforms/Utils/SanitizerStats.h (+4-3)
- (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h (+45-37)
- (modified) llvm/include/llvm/Transforms/Utils/SizeOpts.h (+18-15)
- (modified) llvm/include/llvm/Transforms/Utils/SplitModule.h (+5-4)
- (modified) llvm/include/llvm/Transforms/Utils/SymbolRewriter.h (+6-4)
- (modified) llvm/include/llvm/Transforms/Utils/UnrollLoop.h (+42-42)
- (modified) llvm/include/llvm/Transforms/Utils/ValueMapper.h (+38-34)
- (modified) llvm/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h (+3-3)
- (modified) llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h (+13-11)
- (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h (+22-19)
- (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h (+4)
- (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Legality.h (+4-3)
- (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.h (+5-4)
- (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Scheduler.h (+8-6)
- (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h (+12-5)
- (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h (+2-1)
- (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+1)
- (modified) llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp (+2-1)
- (modified) llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (+3-1)
- (modified) llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp (+2-1)
- (modified) llvm/lib/Transforms/Utils/Local.cpp (+1)
- (modified) llvm/lib/Transforms/Utils/LoopUtils.cpp (+4-2)
- (modified) llvm/lib/Transforms/Vectorize/SandboxVectorizer/Interval.cpp (+3-2)
- (modified) llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp (+4-2)
``````````diff
diff --git a/llvm/include/llvm/Transforms/Coroutines/ABI.h b/llvm/include/llvm/Transforms/Coroutines/ABI.h
index 0b2d405f3caec..30d0e214d6195 100644
--- a/llvm/include/llvm/Transforms/Coroutines/ABI.h
+++ b/llvm/include/llvm/Transforms/Coroutines/ABI.h
@@ -16,6 +16,7 @@
#define LLVM_TRANSFORMS_COROUTINES_ABI_H
#include "llvm/Analysis/TargetTransformInfo.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Transforms/Coroutines/CoroShape.h"
#include "llvm/Transforms/Coroutines/MaterializationUtils.h"
#include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h"
@@ -37,7 +38,7 @@ namespace coro {
// index of an ABI generator for the custom ABI object in a SmallVector passed
// to CoroSplitPass ctor.
-class BaseABI {
+class LLVM_ABI BaseABI {
public:
BaseABI(Function &F, coro::Shape &S,
std::function<bool(Instruction &)> IsMaterializable)
@@ -63,7 +64,7 @@ class BaseABI {
std::function<bool(Instruction &I)> IsMaterializable;
};
-class SwitchABI : public BaseABI {
+class LLVM_ABI SwitchABI : public BaseABI {
public:
SwitchABI(Function &F, coro::Shape &S,
std::function<bool(Instruction &)> IsMaterializable)
@@ -76,7 +77,7 @@ class SwitchABI : public BaseABI {
TargetTransformInfo &TTI) override;
};
-class AsyncABI : public BaseABI {
+class LLVM_ABI AsyncABI : public BaseABI {
public:
AsyncABI(Function &F, coro::Shape &S,
std::function<bool(Instruction &)> IsMaterializable)
@@ -89,7 +90,7 @@ class AsyncABI : public BaseABI {
TargetTransformInfo &TTI) override;
};
-class AnyRetconABI : public BaseABI {
+class LLVM_ABI AnyRetconABI : public BaseABI {
public:
AnyRetconABI(Function &F, coro::Shape &S,
std::function<bool(Instruction &)> IsMaterializable)
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
index b8c846596c994..0688068167ae6 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
@@ -27,6 +27,7 @@
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IntrinsicInst.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
@@ -237,7 +238,7 @@ class AnyCoroIdRetconInst : public AnyCoroIdInst {
enum { SizeArg, AlignArg, StorageArg, PrototypeArg, AllocArg, DeallocArg };
public:
- void checkWellFormed() const;
+ LLVM_ABI void checkWellFormed() const;
uint64_t getStorageSize() const {
return cast<ConstantInt>(getArgOperand(SizeArg))->getZExtValue();
@@ -306,7 +307,7 @@ class CoroIdAsyncInst : public AnyCoroIdInst {
enum { SizeArg, AlignArg, StorageArg, AsyncFuncPtrArg };
public:
- void checkWellFormed() const;
+ LLVM_ABI void checkWellFormed() const;
/// The initial async function context size. The fields of which are reserved
/// for use by the frontend. The frame will be allocated as a tail of this
@@ -568,7 +569,7 @@ class CoroSuspendAsyncInst : public AnyCoroSuspendInst {
MustTailCallFuncArg
};
- void checkWellFormed() const;
+ LLVM_ABI void checkWellFormed() const;
unsigned getStorageArgumentIndex() const {
auto *Arg = cast<ConstantInt>(getArgOperand(StorageArgNoArg));
@@ -722,7 +723,7 @@ class CoroAsyncEndInst : public AnyCoroEndInst {
enum { FrameArg, UnwindArg, MustTailCallFuncArg };
public:
- void checkWellFormed() const;
+ LLVM_ABI void checkWellFormed() const;
Function *getMustTailCallFunction() const {
if (arg_size() < 3)
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroShape.h b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
index 891774b446571..c54081de2d9da 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
@@ -14,6 +14,7 @@
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Transforms/Coroutines/CoroInstr.h"
namespace llvm {
@@ -78,18 +79,20 @@ struct Shape {
}
// Scan the function and collect the above intrinsics for later processing
- void analyze(Function &F, SmallVectorImpl<CoroFrameInst *> &CoroFrames,
- SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
- CoroPromiseInst *&CoroPromise);
+ LLVM_ABI void analyze(Function &F,
+ SmallVectorImpl<CoroFrameInst *> &CoroFrames,
+ SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
+ CoroPromiseInst *&CoroPromise);
// If for some reason, we were not able to find coro.begin, bailout.
- void invalidateCoroutine(Function &F,
- SmallVectorImpl<CoroFrameInst *> &CoroFrames);
+ LLVM_ABI void
+ invalidateCoroutine(Function &F,
+ SmallVectorImpl<CoroFrameInst *> &CoroFrames);
// Perform ABI related initial transformation
- void initABI();
+ LLVM_ABI void initABI();
// Remove orphaned and unnecessary intrinsics
- void cleanCoroutine(SmallVectorImpl<CoroFrameInst *> &CoroFrames,
- SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
- CoroPromiseInst *CoroPromise);
+ LLVM_ABI void cleanCoroutine(SmallVectorImpl<CoroFrameInst *> &CoroFrames,
+ SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
+ CoroPromiseInst *CoroPromise);
// Field indexes for special fields in the switch lowering.
struct SwitchFieldIndex {
@@ -256,12 +259,14 @@ struct Shape {
/// Allocate memory according to the rules of the active lowering.
///
/// \param CG - if non-null, will be updated for the new call
- Value *emitAlloc(IRBuilder<> &Builder, Value *Size, CallGraph *CG) const;
+ LLVM_ABI Value *emitAlloc(IRBuilder<> &Builder, Value *Size,
+ CallGraph *CG) const;
/// Deallocate memory according to the rules of the active lowering.
///
/// \param CG - if non-null, will be updated for the new call
- void emitDealloc(IRBuilder<> &Builder, Value *Ptr, CallGraph *CG) const;
+ LLVM_ABI void emitDealloc(IRBuilder<> &Builder, Value *Ptr,
+ CallGraph *CG) const;
Shape() = default;
explicit Shape(Function &F) {
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h b/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
index 6c6a982e82805..f7cc6f29879f9 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
@@ -18,6 +18,7 @@
#include "llvm/Analysis/CGSCCPassManager.h"
#include "llvm/Analysis/LazyCallGraph.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Transforms/Coroutines/ABI.h"
namespace llvm {
@@ -31,20 +32,23 @@ struct CoroSplitPass : PassInfoMixin<CoroSplitPass> {
using BaseABITy =
std::function<std::unique_ptr<coro::BaseABI>(Function &, coro::Shape &)>;
- CoroSplitPass(bool OptimizeFrame = false);
+ LLVM_ABI CoroSplitPass(bool OptimizeFrame = false);
- CoroSplitPass(SmallVector<BaseABITy> GenCustomABIs,
- bool OptimizeFrame = false);
+ LLVM_ABI CoroSplitPass(SmallVector<BaseABITy> GenCustomABIs,
+ bool OptimizeFrame = false);
+ LLVM_ABI
CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
bool OptimizeFrame = false);
+ LLVM_ABI
CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
SmallVector<BaseABITy> GenCustomABIs,
bool OptimizeFrame = false);
- PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
- LazyCallGraph &CG, CGSCCUpdateResult &UR);
+ LLVM_ABI PreservedAnalyses run(LazyCallGraph::SCC &C,
+ CGSCCAnalysisManager &AM, LazyCallGraph &CG,
+ CGSCCUpdateResult &UR);
static bool isRequired() { return true; }
diff --git a/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h b/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h
index d8fc0c86a6fb5..558984fed0300 100644
--- a/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h
+++ b/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/Support/Compiler.h"
#include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h"
#ifndef LLVM_TRANSFORMS_COROUTINES_MATERIALIZATIONUTILS_H
@@ -16,11 +17,12 @@ namespace llvm {
namespace coro {
// True if I is trivially rematerialzable, e.g. InsertElementInst
-bool isTriviallyMaterializable(Instruction &I);
+LLVM_ABI bool isTriviallyMaterializable(Instruction &I);
// Performs rematerialization, invoked from buildCoroutineFrame.
-void doRematerializations(Function &F, SuspendCrossingInfo &Checker,
- std::function<bool(Instruction &)> IsMaterializable);
+LLVM_ABI void
+doRematerializations(Function &F, SuspendCrossingInfo &Checker,
+ std::function<bool(Instruction &)> IsMaterializable);
} // namespace coro
diff --git a/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h b/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h
index 88cbf88acc4cd..1e04f09ddc275 100644
--- a/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h
+++ b/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h
@@ -21,6 +21,7 @@
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instruction.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Transforms/Coroutines/CoroInstr.h"
namespace llvm {
@@ -102,19 +103,21 @@ class SuspendCrossingInfo {
ModuleSlotTracker &MST) const;
#endif
+ LLVM_ABI
SuspendCrossingInfo(Function &F,
const SmallVectorImpl<AnyCoroSuspendInst *> &CoroSuspends,
const SmallVectorImpl<AnyCoroEndInst *> &CoroEnds);
/// Returns true if there is a path from \p From to \p To crossing a suspend
/// point without crossing \p From a 2nd time.
- bool hasPathCrossingSuspendPoint(BasicBlock *From, BasicBlock *To) const;
+ LLVM_ABI bool hasPathCrossingSuspendPoint(BasicBlock *From,
+ BasicBlock *To) const;
/// Returns true if there is a path from \p From to \p To crossing a suspend
/// point without crossing \p From a 2nd time. If \p From is the same as \p To
/// this will also check if there is a looping path crossing a suspend point.
- bool hasPathOrLoopCrossingSuspendPoint(BasicBlock *From,
- BasicBlock *To) const;
+ LLVM_ABI bool hasPathOrLoopCrossingSuspendPoint(BasicBlock *From,
+ BasicBlock *To) const;
bool isDefinitionAcrossSuspend(BasicBlock *DefBB, User *U) const {
auto *I = cast<Instruction>(U);
diff --git a/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h b/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
index 5ff38bdf04812..20850ba4c02d2 100644
--- a/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
+++ b/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
@@ -19,6 +19,7 @@
#define LLVM_TRANSFORMS_HIPSTDPAR_HIPSTDPAR_H
#include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -27,7 +28,7 @@ class Module;
class HipStdParAcceleratorCodeSelectionPass
: public PassInfoMixin<HipStdParAcceleratorCodeSelectionPass> {
public:
- PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+ LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
static bool isRequired() { return true; }
};
@@ -35,7 +36,7 @@ class HipStdParAcceleratorCodeSelectionPass
class HipStdParAllocationInterpositionPass
: public PassInfoMixin<HipStdParAllocationInterpositionPass> {
public:
- PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+ LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
static bool isRequired() { return true; }
};
diff --git a/llvm/include/llvm/Transforms/IPO.h b/llvm/include/llvm/Transforms/IPO.h
index ee0e35aa61832..56b30968ffd77 100644
--- a/llvm/include/llvm/Transforms/IPO.h
+++ b/llvm/include/llvm/Transforms/IPO.h
@@ -24,29 +24,29 @@ class raw_ostream;
/// createDeadArgEliminationPass - This pass removes arguments from functions
/// which are not used by the body of the function.
///
-ModulePass *createDeadArgEliminationPass();
+LLVM_ABI ModulePass *createDeadArgEliminationPass();
/// DeadArgHacking pass - Same as DAE, but delete arguments of external
/// functions as well. This is definitely not safe, and should only be used by
/// bugpoint.
-ModulePass *createDeadArgHackingPass();
+LLVM_ABI ModulePass *createDeadArgHackingPass();
//===----------------------------------------------------------------------===//
//
/// createLoopExtractorPass - This pass extracts all natural loops from the
/// program into a function if it can.
///
-Pass *createLoopExtractorPass();
+LLVM_ABI Pass *createLoopExtractorPass();
/// createSingleLoopExtractorPass - This pass extracts one natural loop from the
/// program into a function if it can. This is used by bugpoint.
///
-Pass *createSingleLoopExtractorPass();
+LLVM_ABI Pass *createSingleLoopExtractorPass();
//===----------------------------------------------------------------------===//
/// createBarrierNoopPass - This pass is purely a module pass barrier in a pass
/// manager.
-ModulePass *createBarrierNoopPass();
+LLVM_ABI ModulePass *createBarrierNoopPass();
/// What to do with the summary when running passes that operate on it.
enum class PassSummaryAction {
diff --git a/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h b/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
index 252cfd4dc5f37..679126b011d8e 100644
--- a/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
+++ b/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
@@ -15,6 +15,7 @@
#define LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
#include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -36,14 +37,13 @@ class AlwaysInlinerPass : public PassInfoMixin<AlwaysInlinerPass> {
AlwaysInlinerPass(bool InsertLifetime = true)
: InsertLifetime(InsertLifetime) {}
- PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
+ LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
static bool isRequired() { return true; }
};
/// Create a legacy pass manager instance of a pass to inline and remove
/// functions marked as "always_inline".
-Pass *createAlwaysInlinerLegacyPass(bool InsertLifetime = true);
-
+LLVM_ABI Pass *createAlwaysInlinerLegacyPass(bool InsertLifetime = true);
}
#endif // LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index c628bbb007230..e6eb756df987d 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -129,6 +129,7 @@
#include "llvm/Support/Alignment.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DOTGraphTraits.h"
#include "llvm/Support/DebugCounter.h"
#include "llvm/Support/ErrorHandling.h"
@@ -172,7 +173,7 @@ enum class GPUAddressSpace : unsigned {
};
/// Return true iff \p M target a GPU (and we can use GPU AS reasoning).
-bool isGPU(const Module &M);
+LLVM_ABI bool isGPU(const Module &M);
/// Flags to distinguish intra-procedural queries from *potentially*
/// inter-procedural queries. Not that information can be valid for both and
@@ -195,30 +196,32 @@ struct ValueAndContext : public std::pair<Value *, const Instruction *> {
/// Return true if \p I is a `nosync` instruction. Use generic reasoning and
/// potentially the corresponding AANoSync.
-bool isNoSyncInst(Attributor &A, const Instruction &I,
- const AbstractAttribute &QueryingAA);
+LLVM_ABI bool isNoSyncInst(Attributor &A, const Instruction &I,
+ const AbstractAttribute &QueryingAA);
/// Return true if \p V is dynamically unique, that is, there are no two
/// "instances" of \p V at runtime with different values.
/// Note: If \p ForAnalysisOnly is set we only check that the Attributor will
/// never use \p V to represent two "instances" not that \p V could not
/// technically represent them.
-bool isDynamicallyUnique(Attributor &A, const AbstractAttribute &QueryingAA,
- const Value &V, bool ForAnalysisOnly = true);
+LLVM_ABI bool isDynamicallyUnique(Attributor &A,
+ const AbstractAttribute &QueryingAA,
+ const Value &V, bool ForAnalysisOnly = true);
/// Return true if \p V is a valid value in \p Scope, that is a constant or an
/// instruction/argument of \p Scope.
-bool isValidInScope(const Value &V, const Function *Scope);
+LLVM_ABI bool isValidInScope(const Value &V, const Function *Scope);
/// Return true if the value of \p VAC is a valid at the position of \p VAC,
/// that is a constant, an argument of the same function, or an instruction in
/// that function that dominates the position.
-bool isValidAtPosition(const ValueAndContext &VAC, InformationCache &InfoCache);
+LLVM_ABI bool isValidAtPosition(const ValueAndContext &VAC,
+ InformationCache &InfoCache);
/// Try to convert \p V to type \p Ty without introducing new instructions. If
/// this is not possible return `nullptr`. Note: this function basically knows
/// how to cast various constants.
-Value *getWithType(Value &V, Type &Ty);
+LLVM_ABI Value *getWithType(Value &V, Type &Ty);
/// Return the combination of \p A and \p B such that the result is a possible
/// value of both. \p B is potentially casted to match the type \p Ty or the
@@ -228,7 +231,7 @@ Value *getWithType(Value &V, Type &Ty);
/// X + none => X
/// not_none + undef => not_none
/// V1 + V2 => nullptr
-std::optional<Value *>
+LLVM_ABI std::optional<Value *>
combineOptionalValuesInAAValueLatice(const std::optional<Value *> &A,
const std::optional<Value *> &B, Type *Ty);
@@ -328,11 +331,10 @@ inline bool operator==(const RangeTy &A, const RangeTy &B) {
inline bool operator!=(const RangeTy &A, const RangeTy &B) { return !(A == B); }
/// Return the initial value of \p Obj with type \p Ty if that is a constant.
-Constant *getInitialValueForObj(Attributor &A,
- const AbstractAttribute &QueryingAA, Value &Obj,
- Type &Ty, const TargetLibraryInfo *TLI,
- const DataLayout &DL,
- RangeTy *RangePtr = nullptr);
+LLVM_ABI Constant *
+getInitialValueForObj(Attributor &A, const AbstractAttribute &QueryingAA,
+ Value &Obj, Type &Ty, const TargetLibraryInfo *TLI,
+ const DataLayout &DL, RangeTy *RangePtr = nullptr);
/// Collect all potential values \p LI could read into \p PotentialValues. That
/// is, the only values read by \p LI are assumed to be known and all are in
@@ -345,7 +347,7 @@ Constant *getInitialValueForObj(Attributor &A,
/// \returns True if the assumed potential copies are all in \p PotentialValues,
/// false if something went wrong and the copies could not be
/// determined.
-bool getPotentiallyLoadedValues(
+LLVM_ABI bool getPotentiallyLoadedValues(
Attributor &A, LoadInst &LI, SmallSetVector<Value *, 4> &PotentialValues,
SmallSetVector<Instruction *, 4> &PotentialValueOrigins,
const AbstractAttribute &QueryingAA, bool &UsedAssumedInformation,
@@ -360,20 +362,22 @@ bool getPotentiallyLoadedValues(
/// \returns True if the assumed potential copies are all in \p PotentialCopies,
/// false if something went wrong and the copies could not be
/// determined.
-bool getPotentialCopiesOfStoredValue(
+LLVM_ABI bool getPotentialCopiesOfStoredValue(
Attributor &A, StoreInst &SI, SmallSetVector<Value *, 4> &PotentialCopies,
const AbstractAttribute &QueryingAA, bool &UsedAssumedInformati...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/143413
More information about the llvm-commits
mailing list