Skip to content

[llvm] annotate recently added interfaces for DLL export #150101

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

Merged
merged 3 commits into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions llvm/include/llvm/Analysis/IR2Vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,37 +164,37 @@ class Vocabulary {

public:
Vocabulary() = default;
Vocabulary(VocabVector &&Vocab);
LLVM_ABI Vocabulary(VocabVector &&Vocab);

bool isValid() const;
unsigned getDimension() const;
size_t size() const;
LLVM_ABI bool isValid() const;
LLVM_ABI unsigned getDimension() const;
LLVM_ABI size_t size() const;

static size_t expectedSize() {
return MaxOpcodes + MaxTypeIDs + MaxOperandKinds;
}

/// Helper function to get vocabulary key for a given Opcode
static StringRef getVocabKeyForOpcode(unsigned Opcode);
LLVM_ABI static StringRef getVocabKeyForOpcode(unsigned Opcode);

/// Helper function to get vocabulary key for a given TypeID
static StringRef getVocabKeyForTypeID(Type::TypeID TypeID);
LLVM_ABI static StringRef getVocabKeyForTypeID(Type::TypeID TypeID);

/// Helper function to get vocabulary key for a given OperandKind
static StringRef getVocabKeyForOperandKind(OperandKind Kind);
LLVM_ABI static StringRef getVocabKeyForOperandKind(OperandKind Kind);

/// Helper function to classify an operand into OperandKind
static OperandKind getOperandKind(const Value *Op);
LLVM_ABI static OperandKind getOperandKind(const Value *Op);

/// Helpers to return the IDs of a given Opcode, TypeID, or OperandKind
static unsigned getNumericID(unsigned Opcode);
static unsigned getNumericID(Type::TypeID TypeID);
static unsigned getNumericID(const Value *Op);
LLVM_ABI static unsigned getNumericID(unsigned Opcode);
LLVM_ABI static unsigned getNumericID(Type::TypeID TypeID);
LLVM_ABI static unsigned getNumericID(const Value *Op);

/// Accessors to get the embedding for a given entity.
const ir2vec::Embedding &operator[](unsigned Opcode) const;
const ir2vec::Embedding &operator[](Type::TypeID TypeId) const;
const ir2vec::Embedding &operator[](const Value *Arg) const;
LLVM_ABI const ir2vec::Embedding &operator[](unsigned Opcode) const;
LLVM_ABI const ir2vec::Embedding &operator[](Type::TypeID TypeId) const;
LLVM_ABI const ir2vec::Embedding &operator[](const Value *Arg) const;

/// Const Iterator type aliases
using const_iterator = VocabVector::const_iterator;
Expand All @@ -221,13 +221,13 @@ class Vocabulary {
/// Returns the string key for a given index position in the vocabulary.
/// This is useful for debugging or printing the vocabulary. Do not use this
/// for embedding generation as string based lookups are inefficient.
static StringRef getStringKey(unsigned Pos);
LLVM_ABI static StringRef getStringKey(unsigned Pos);

/// Create a dummy vocabulary for testing purposes.
static VocabVector createDummyVocabForTest(unsigned Dim = 1);
LLVM_ABI static VocabVector createDummyVocabForTest(unsigned Dim = 1);

bool invalidate(Module &M, const PreservedAnalyses &PA,
ModuleAnalysisManager::Invalidator &Inv) const;
LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
ModuleAnalysisManager::Invalidator &Inv) const;
};

/// Embedder provides the interface to generate embeddings (vector
Expand Down
7 changes: 4 additions & 3 deletions llvm/include/llvm/BinaryFormat/SFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Endian.h"

Expand Down Expand Up @@ -163,9 +164,9 @@ template <endianness E> using FrameRowEntryAddr1 = FrameRowEntry<uint8_t, E>;
template <endianness E> using FrameRowEntryAddr2 = FrameRowEntry<uint16_t, E>;
template <endianness E> using FrameRowEntryAddr4 = FrameRowEntry<uint32_t, E>;

ArrayRef<EnumEntry<Version>> getVersions();
ArrayRef<EnumEntry<Flags>> getFlags();
ArrayRef<EnumEntry<ABI>> getABIs();
LLVM_ABI ArrayRef<EnumEntry<Version>> getVersions();
LLVM_ABI ArrayRef<EnumEntry<Flags>> getFlags();
LLVM_ABI ArrayRef<EnumEntry<ABI>> getABIs();

} // namespace sframe
} // namespace llvm
Expand Down
28 changes: 14 additions & 14 deletions llvm/include/llvm/CodeGen/GCMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ class GCFunctionInfo {
// are live per safe point (1.5% on 64-bit hosts).

public:
GCFunctionInfo(const Function &F, GCStrategy &S);
~GCFunctionInfo();
LLVM_ABI GCFunctionInfo(const Function &F, GCStrategy &S);
LLVM_ABI ~GCFunctionInfo();

/// Handle invalidation explicitly.
bool invalidate(Function &F, const PreservedAnalyses &PA,
FunctionAnalysisManager::Invalidator &Inv);
LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA,
FunctionAnalysisManager::Invalidator &Inv);

/// getFunction - Return the function to which this metadata applies.
const Function &getFunction() const { return F; }
Expand Down Expand Up @@ -163,8 +163,8 @@ class GCStrategyMap {
GCStrategyMap(GCStrategyMap &&) = default;

/// Handle invalidation explicitly.
bool invalidate(Module &M, const PreservedAnalyses &PA,
ModuleAnalysisManager::Invalidator &Inv);
LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
ModuleAnalysisManager::Invalidator &Inv);

using iterator = MapT::iterator;
using const_iterator = MapT::const_iterator;
Expand Down Expand Up @@ -205,7 +205,7 @@ class CollectorMetadataAnalysis

public:
using Result = GCStrategyMap;
Result run(Module &M, ModuleAnalysisManager &MAM);
LLVM_ABI Result run(Module &M, ModuleAnalysisManager &MAM);
};

/// An analysis pass which caches information about the Function.
Expand All @@ -217,7 +217,7 @@ class GCFunctionAnalysis : public AnalysisInfoMixin<GCFunctionAnalysis> {

public:
using Result = GCFunctionInfo;
Result run(Function &F, FunctionAnalysisManager &FAM);
LLVM_ABI Result run(Function &F, FunctionAnalysisManager &FAM);
};

/// LowerIntrinsics - This pass rewrites calls to the llvm.gcread or
Expand All @@ -228,7 +228,7 @@ class GCFunctionAnalysis : public AnalysisInfoMixin<GCFunctionAnalysis> {
/// This pass requires `CollectorMetadataAnalysis`.
class GCLoweringPass : public PassInfoMixin<GCLoweringPass> {
public:
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
};

/// An analysis pass which caches information about the entire Module.
Expand All @@ -244,7 +244,7 @@ class GCModuleInfo : public ImmutablePass {
/// Lookup the GCStrategy object associated with the given gc name.
/// Objects are owned internally; No caller should attempt to delete the
/// returned objects.
GCStrategy *getGCStrategy(const StringRef Name);
LLVM_ABI GCStrategy *getGCStrategy(const StringRef Name);

/// List of per function info objects. In theory, Each of these
/// may be associated with a different GC.
Expand All @@ -265,14 +265,14 @@ class GCModuleInfo : public ImmutablePass {
public:
using iterator = SmallVector<std::unique_ptr<GCStrategy>, 1>::const_iterator;

static char ID;
LLVM_ABI static char ID;

GCModuleInfo();
LLVM_ABI GCModuleInfo();

/// clear - Resets the pass. Any pass, which uses GCModuleInfo, should
/// call it in doFinalization().
///
void clear();
LLVM_ABI void clear();

/// begin/end - Iterators for used strategies.
///
Expand All @@ -282,7 +282,7 @@ class GCModuleInfo : public ImmutablePass {
/// get - Look up function metadata. This is currently assumed
/// have the side effect of initializing the associated GCStrategy. That
/// will soon change.
GCFunctionInfo &getFunctionInfo(const Function &F);
LLVM_ABI GCFunctionInfo &getFunctionInfo(const Function &F);
};

} // end namespace llvm
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MachineFunctionAnalysis

class FreeMachineFunctionPass : public PassInfoMixin<FreeMachineFunctionPass> {
public:
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
};

} // namespace llvm
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/CodeGen/MachineInstrBundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ LLVM_ABI PhysRegInfo AnalyzePhysRegInBundle(const MachineInstr &MI,

class FinalizeBundleTestPass : public PassInfoMixin<FinalizeBundleTestPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
};

} // End llvm namespace
Expand Down
19 changes: 10 additions & 9 deletions llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
#include "llvm/ExecutionEngine/Orc/IndirectionUtils.h"
#include "llvm/ExecutionEngine/Orc/LazyReexports.h"
#include "llvm/Support/Compiler.h"

#include <mutex>

Expand All @@ -33,7 +34,7 @@ class EPCIndirectionUtils {
public:
/// ABI support base class. Used to write resolver, stub, and trampoline
/// blocks.
class ABISupport {
class LLVM_ABI ABISupport {
protected:
ABISupport(unsigned PointerSize, unsigned TrampolineSize, unsigned StubSize,
unsigned StubToPointerMaxDisplacement, unsigned ResolverCodeSize)
Expand Down Expand Up @@ -81,7 +82,7 @@ class EPCIndirectionUtils {
CreateWithABI(ExecutorProcessControl &EPC);

/// Create based on the ExecutorProcessControl triple.
static Expected<std::unique_ptr<EPCIndirectionUtils>>
LLVM_ABI static Expected<std::unique_ptr<EPCIndirectionUtils>>
Create(ExecutorProcessControl &EPC);

/// Create based on the ExecutorProcessControl triple.
Expand All @@ -98,27 +99,27 @@ class EPCIndirectionUtils {

/// Release memory for resources held by this instance. This *must* be called
/// prior to destruction of the class.
Error cleanup();
LLVM_ABI Error cleanup();

/// Write resolver code to the executor process and return its address.
/// This must be called before any call to createTrampolinePool or
/// createLazyCallThroughManager.
Expected<ExecutorAddr> writeResolverBlock(ExecutorAddr ReentryFnAddr,
ExecutorAddr ReentryCtxAddr);
LLVM_ABI Expected<ExecutorAddr>
writeResolverBlock(ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr);

/// Returns the address of the Resolver block. Returns zero if the
/// writeResolverBlock method has not previously been called.
ExecutorAddr getResolverBlockAddress() const { return ResolverBlockAddr; }

/// Create an IndirectStubsManager for the executor process.
std::unique_ptr<IndirectStubsManager> createIndirectStubsManager();
LLVM_ABI std::unique_ptr<IndirectStubsManager> createIndirectStubsManager();

/// Create a TrampolinePool for the executor process.
TrampolinePool &getTrampolinePool();
LLVM_ABI TrampolinePool &getTrampolinePool();

/// Create a LazyCallThroughManager.
/// This function should only be called once.
LazyCallThroughManager &
LLVM_ABI LazyCallThroughManager &
createLazyCallThroughManager(ExecutionSession &ES,
ExecutorAddr ErrorHandlerAddr);

Expand Down Expand Up @@ -170,7 +171,7 @@ class EPCIndirectionUtils {
/// called.
///
/// This function is experimental and likely subject to revision.
Error setUpInProcessLCTMReentryViaEPCIU(EPCIndirectionUtils &EPCIU);
LLVM_ABI Error setUpInProcessLCTMReentryViaEPCIU(EPCIndirectionUtils &EPCIU);

namespace detail {

Expand Down
9 changes: 5 additions & 4 deletions llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/ExecutionEngine/Orc/Core.h"
#include "llvm/ExecutionEngine/Orc/Speculation.h"
#include "llvm/Support/Compiler.h"

namespace llvm {

Expand All @@ -24,8 +25,8 @@ namespace orc {
// Provides common code.
class SpeculateQuery {
protected:
void findCalles(const BasicBlock *, DenseSet<StringRef> &);
bool isStraightLine(const Function &F);
LLVM_ABI void findCalles(const BasicBlock *, DenseSet<StringRef> &);
LLVM_ABI bool isStraightLine(const Function &F);

public:
using ResultTy = std::optional<DenseMap<StringRef, DenseSet<StringRef>>>;
Expand All @@ -37,7 +38,7 @@ class BlockFreqQuery : public SpeculateQuery {

public:
// Find likely next executables based on IR Block Frequency
ResultTy operator()(Function &F);
LLVM_ABI ResultTy operator()(Function &F);
};

// This Query generates a sequence of basic blocks which follows the order of
Expand Down Expand Up @@ -73,7 +74,7 @@ class SequenceBBQuery : public SpeculateQuery {
VisitedBlocksInfoTy &);

public:
ResultTy operator()(Function &F);
LLVM_ABI ResultTy operator()(Function &F);
};

} // namespace orc
Expand Down
5 changes: 3 additions & 2 deletions llvm/include/llvm/IR/GCStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#ifndef LLVM_IR_GCSTRATEGY_H
#define LLVM_IR_GCSTRATEGY_H

#include "llvm/Support/Compiler.h"
#include "llvm/Support/Registry.h"
#include <optional>
#include <string>
Expand Down Expand Up @@ -81,7 +82,7 @@ class GCStrategy {
bool UsesMetadata = false; ///< If set, backend must emit metadata tables.

public:
GCStrategy();
LLVM_ABI GCStrategy();
virtual ~GCStrategy() = default;

/// Return the name of the GC strategy. This is the value of the collector
Expand Down Expand Up @@ -145,7 +146,7 @@ using GCRegistry = Registry<GCStrategy>;
extern template class LLVM_TEMPLATE_ABI Registry<GCStrategy>;

/// Lookup the GCStrategy object associated with the given gc name.
std::unique_ptr<GCStrategy> getGCStrategy(const StringRef Name);
LLVM_ABI std::unique_ptr<GCStrategy> getGCStrategy(const StringRef Name);

} // end namespace llvm

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/IR/RuntimeLibcalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ struct RuntimeLibcallsInfo {

/// Check if this is valid libcall for the current module, otherwise
/// RTLIB::Unsupported.
RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const;
LLVM_ABI RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const;

private:
static const RTLIB::LibcallImpl
Expand Down
5 changes: 3 additions & 2 deletions llvm/include/llvm/MC/DXContainerRootSignature.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define LLVM_MC_DXCONTAINERROOTSIGNATURE_H

#include "llvm/BinaryFormat/DXContainer.h"
#include "llvm/Support/Compiler.h"
#include <cstdint>
#include <limits>

Expand Down Expand Up @@ -113,9 +114,9 @@ struct RootSignatureDesc {
mcdxbc::RootParametersContainer ParametersContainer;
SmallVector<dxbc::RTS0::v1::StaticSampler> StaticSamplers;

void write(raw_ostream &OS) const;
LLVM_ABI void write(raw_ostream &OS) const;

size_t getSize() const;
LLVM_ABI size_t getSize() const;
};
} // namespace mcdxbc
} // namespace llvm
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/MC/MCAssembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class MCAssembler {

LLVM_ABI bool registerSection(MCSection &Section);
LLVM_ABI bool registerSymbol(const MCSymbol &Symbol);
void addRelocDirective(RelocDirective RD);
LLVM_ABI void addRelocDirective(RelocDirective RD);

LLVM_ABI void reportError(SMLoc L, const Twine &Msg) const;
// Record pending errors during layout iteration, as they may go away once the
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/MC/MCSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class MCFragment {
MutableArrayRef<char> getContents();
ArrayRef<char> getContents() const;

void setVarContents(ArrayRef<char> Contents);
LLVM_ABI void setVarContents(ArrayRef<char> Contents);
void clearVarContents() { setVarContents({}); }
MutableArrayRef<char> getVarContents();
ArrayRef<char> getVarContents() const;
Expand All @@ -241,7 +241,7 @@ class MCFragment {

// Source fixup offsets are relative to the variable part's start.
// Stored fixup offsets are relative to the fixed part's start.
void setVarFixups(ArrayRef<MCFixup> Fixups);
LLVM_ABI void setVarFixups(ArrayRef<MCFixup> Fixups);
void clearVarFixups() { setVarFixups({}); }
MutableArrayRef<MCFixup> getVarFixups();
ArrayRef<MCFixup> getVarFixups() const;
Expand Down
Loading