Skip to content

Commit 563205b

Browse files
andrurogerzkrishna2803
authored andcommitted
[llvm] annotate recently added interfaces for DLL export (llvm#152179)
## Purpose This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates symbols that were recently added to LLVM and fixes incorrectly annotated symbols. ## Background This effort is tracked in llvm#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). ## Overview 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: - Add `LLVM_EXPORT_TEMPLATE` and `LLVM_TEMPLATE_ABI` annotations to explicitly instantiated instances of `llvm::object::SFrameParser`. ## Validation On Windows 11: ``` cmake -B build -S llvm -G Ninja -DLLVM_ENABLE_PROJECTS="llvm;clang;clang-tools-extra;lldb;lld" -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_BUILD_LLVM_DYLIB_VIS=ON -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_BUILD_TESTS=ON -DCLANG_LINK_CLANG_DYLIB=OFF -DCMAKE_BUILD_TYPE=Release ninja -C build ```
1 parent df16baf commit 563205b

File tree

10 files changed

+26
-18
lines changed

10 files changed

+26
-18
lines changed

llvm/include/llvm/Analysis/DXILResource.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,8 @@ class DXILResourceBindingInfo {
649649
bool hasOverlappingBinding() const { return HasOverlappingBinding; }
650650
void setHasOverlappingBinding(bool Value) { HasOverlappingBinding = Value; }
651651

652-
LLVM_ABI std::optional<uint32_t>
653-
findAvailableBinding(dxil::ResourceClass RC, uint32_t Space, int32_t Size) {
652+
std::optional<uint32_t> findAvailableBinding(dxil::ResourceClass RC,
653+
uint32_t Space, int32_t Size) {
654654
return Bindings.findAvailableBinding(RC, Space, Size);
655655
}
656656

llvm/include/llvm/CodeGen/MachineFunction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ class LLVM_ABI MachineFunction {
523523
/// Extracts the numeric type id from the CallBase's callee_type Metadata,
524524
/// and sets CalleeTypeIds. This is used as type id for the indirect call in
525525
/// the call graph section.
526-
CallSiteInfo(const CallBase &CB);
526+
LLVM_ABI CallSiteInfo(const CallBase &CB);
527527
};
528528

529529
struct CalledGlobalInfo {

llvm/include/llvm/Frontend/HLSL/HLSLBinding.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "llvm/ADT/STLFunctionalExtras.h"
1717
#include "llvm/ADT/SmallVector.h"
18+
#include "llvm/Support/Compiler.h"
1819
#include "llvm/Support/DXILABI.h"
1920
#include "llvm/Support/ErrorHandling.h"
2021

@@ -138,7 +139,7 @@ class BindingInfoBuilder {
138139
}
139140
/// Calculate the binding info - \c ReportOverlap will be called once for each
140141
/// overlapping binding.
141-
BindingInfo calculateBindingInfo(
142+
LLVM_ABI BindingInfo calculateBindingInfo(
142143
llvm::function_ref<void(const BindingInfoBuilder &Builder,
143144
const Binding &Overlapping)>
144145
ReportOverlap);
@@ -153,7 +154,7 @@ class BindingInfoBuilder {
153154

154155
/// For use in the \c ReportOverlap callback of \c calculateBindingInfo -
155156
/// finds a binding that the \c ReportedBinding overlaps with.
156-
const Binding &findOverlapping(const Binding &ReportedBinding) const;
157+
LLVM_ABI const Binding &findOverlapping(const Binding &ReportedBinding) const;
157158
};
158159

159160
} // namespace hlsl

llvm/include/llvm/Frontend/HLSL/RootSignatureMetadata.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "llvm/Frontend/HLSL/HLSLRootSignature.h"
1919
#include "llvm/IR/Constants.h"
2020
#include "llvm/MC/DXContainerRootSignature.h"
21+
#include "llvm/Support/Compiler.h"
2122

2223
namespace llvm {
2324
class LLVMContext;
@@ -49,7 +50,7 @@ class RootSignatureValidationError
4950

5051
class GenericRSMetadataError : public ErrorInfo<GenericRSMetadataError> {
5152
public:
52-
static char ID;
53+
LLVM_ABI static char ID;
5354
StringRef Message;
5455
MDNode *MD;
5556

@@ -71,7 +72,7 @@ class GenericRSMetadataError : public ErrorInfo<GenericRSMetadataError> {
7172

7273
class InvalidRSMetadataFormat : public ErrorInfo<InvalidRSMetadataFormat> {
7374
public:
74-
static char ID;
75+
LLVM_ABI static char ID;
7576
StringRef ElementName;
7677

7778
InvalidRSMetadataFormat(StringRef ElementName) : ElementName(ElementName) {}
@@ -87,7 +88,7 @@ class InvalidRSMetadataFormat : public ErrorInfo<InvalidRSMetadataFormat> {
8788

8889
class InvalidRSMetadataValue : public ErrorInfo<InvalidRSMetadataValue> {
8990
public:
90-
static char ID;
91+
LLVM_ABI static char ID;
9192
StringRef ParamName;
9293

9394
InvalidRSMetadataValue(StringRef ParamName) : ParamName(ParamName) {}

llvm/include/llvm/Frontend/Offloading/PropertySet.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
#include "llvm/ADT/SmallVector.h"
13+
#include "llvm/Support/Compiler.h"
1314
#include "llvm/Support/Error.h"
1415

1516
#include <map>
@@ -26,8 +27,10 @@ using PropertyValue = std::variant<uint32_t, ByteArray>;
2627
using PropertySet = std::map<std::string, PropertyValue>;
2728
using PropertySetRegistry = std::map<std::string, PropertySet>;
2829

29-
void writePropertiesToJSON(const PropertySetRegistry &P, raw_ostream &O);
30-
Expected<PropertySetRegistry> readPropertiesFromJSON(MemoryBufferRef Buf);
30+
LLVM_ABI void writePropertiesToJSON(const PropertySetRegistry &P,
31+
raw_ostream &O);
32+
LLVM_ABI Expected<PropertySetRegistry>
33+
readPropertiesFromJSON(MemoryBufferRef Buf);
3134

3235
} // namespace offloading
3336
} // namespace llvm

llvm/include/llvm/IR/IRBuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2614,7 +2614,8 @@ class IRBuilderBase {
26142614
return CreateShuffleVector(V, PoisonValue::get(V->getType()), Mask, Name);
26152615
}
26162616

2617-
Value *CreateVectorInterleave(ArrayRef<Value *> Ops, const Twine &Name = "");
2617+
LLVM_ABI Value *CreateVectorInterleave(ArrayRef<Value *> Ops,
2618+
const Twine &Name = "");
26182619

26192620
Value *CreateExtractValue(Value *Agg, ArrayRef<unsigned> Idxs,
26202621
const Twine &Name = "") {

llvm/include/llvm/Object/DXContainer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ class DXContainer {
586586
}
587587
};
588588

589-
class DXContainerObjectFile : public ObjectFile {
589+
class LLVM_ABI DXContainerObjectFile : public ObjectFile {
590590
private:
591591
friend class ObjectFile;
592592
DXContainer Container;

llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class HipStdParAllocationInterpositionPass
4343

4444
class HipStdParMathFixupPass : public PassInfoMixin<HipStdParMathFixupPass> {
4545
public:
46-
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
46+
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
4747

4848
static bool isRequired() { return true; }
4949
};

llvm/include/llvm/Transforms/Utils/SplitModuleByCategory.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define LLVM_TRANSFORM_UTILS_SPLIT_MODULE_BY_CATEGORY_H
1313

1414
#include "llvm/ADT/STLFunctionalExtras.h"
15+
#include "llvm/Support/Compiler.h"
1516

1617
#include <memory>
1718
#include <optional>
@@ -54,7 +55,7 @@ class Function;
5455
///
5556
/// FIXME: For now, the algorithm assumes no recursion in the input Module. This
5657
/// will be addressed in the near future.
57-
void splitModuleTransitiveFromEntryPoints(
58+
LLVM_ABI void splitModuleTransitiveFromEntryPoints(
5859
std::unique_ptr<Module> M,
5960
function_ref<std::optional<int>(const Function &F)> EntryPointCategorizer,
6061
function_ref<void(std::unique_ptr<Module> Part)> Callback);

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ class VPIRInstruction : public VPRecipeBase {
12791279

12801280
/// Create a new VPIRPhi for \p \I, if it is a PHINode, otherwise create a
12811281
/// VPIRInstruction.
1282-
static VPIRInstruction *create(Instruction &I);
1282+
LLVM_ABI_FOR_TEST static VPIRInstruction *create(Instruction &I);
12831283

12841284
VP_CLASSOF_IMPL(VPDef::VPIRInstructionSC)
12851285

@@ -1293,8 +1293,8 @@ class VPIRInstruction : public VPRecipeBase {
12931293
void execute(VPTransformState &State) override;
12941294

12951295
/// Return the cost of this VPIRInstruction.
1296-
InstructionCost computeCost(ElementCount VF,
1297-
VPCostContext &Ctx) const override;
1296+
LLVM_ABI_FOR_TEST InstructionCost
1297+
computeCost(ElementCount VF, VPCostContext &Ctx) const override;
12981298

12991299
Instruction &getInstruction() const { return I; }
13001300

@@ -1332,7 +1332,8 @@ class VPIRInstruction : public VPRecipeBase {
13321332
/// cast/dyn_cast/isa and execute() implementation. A single VPValue operand is
13331333
/// allowed, and it is used to add a new incoming value for the single
13341334
/// predecessor VPBB.
1335-
struct VPIRPhi : public VPIRInstruction, public VPPhiAccessors {
1335+
struct LLVM_ABI_FOR_TEST VPIRPhi : public VPIRInstruction,
1336+
public VPPhiAccessors {
13361337
VPIRPhi(PHINode &PN) : VPIRInstruction(PN) {}
13371338

13381339
static inline bool classof(const VPRecipeBase *U) {

0 commit comments

Comments
 (0)