Skip to content

Commit 1abe1aa

Browse files
authored
[llvm] annotate remaining Analysis library interfaces for DLL export (#145359)
1 parent d9a7b16 commit 1abe1aa

File tree

4 files changed

+32
-29
lines changed

4 files changed

+32
-29
lines changed

llvm/include/llvm/Analysis/DXILResource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace dxil {
3434

3535
// Returns the resource name from dx_resource_handlefrombinding or
3636
// dx_resource_handlefromimplicitbinding call
37-
StringRef getResourceNameFromBindingCall(CallInst *CI);
37+
LLVM_ABI StringRef getResourceNameFromBindingCall(CallInst *CI);
3838

3939
/// The dx.RawBuffer target extension type
4040
///

llvm/include/llvm/Analysis/IR2Vec.h

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "llvm/ADT/DenseMap.h"
3333
#include "llvm/IR/PassManager.h"
3434
#include "llvm/Support/CommandLine.h"
35+
#include "llvm/Support/Compiler.h"
3536
#include "llvm/Support/ErrorOr.h"
3637
#include "llvm/Support/JSON.h"
3738
#include <map>
@@ -57,9 +58,9 @@ enum class IR2VecKind { Symbolic };
5758

5859
namespace ir2vec {
5960

60-
extern cl::opt<float> OpcWeight;
61-
extern cl::opt<float> TypeWeight;
62-
extern cl::opt<float> ArgWeight;
61+
LLVM_ABI extern cl::opt<float> OpcWeight;
62+
LLVM_ABI extern cl::opt<float> TypeWeight;
63+
LLVM_ABI extern cl::opt<float> ArgWeight;
6364

6465
/// Embedding is a datatype that wraps std::vector<double>. It provides
6566
/// additional functionality for arithmetic and comparison operations.
@@ -106,16 +107,17 @@ struct Embedding {
106107
const std::vector<double> &getData() const { return Data; }
107108

108109
/// Arithmetic operators
109-
Embedding &operator+=(const Embedding &RHS);
110-
Embedding &operator-=(const Embedding &RHS);
110+
LLVM_ABI Embedding &operator+=(const Embedding &RHS);
111+
LLVM_ABI Embedding &operator-=(const Embedding &RHS);
111112

112113
/// Adds Src Embedding scaled by Factor with the called Embedding.
113114
/// Called_Embedding += Src * Factor
114-
Embedding &scaleAndAdd(const Embedding &Src, float Factor);
115+
LLVM_ABI Embedding &scaleAndAdd(const Embedding &Src, float Factor);
115116

116117
/// Returns true if the embedding is approximately equal to the RHS embedding
117118
/// within the specified tolerance.
118-
bool approximatelyEquals(const Embedding &RHS, double Tolerance = 1e-6) const;
119+
LLVM_ABI bool approximatelyEquals(const Embedding &RHS,
120+
double Tolerance = 1e-6) const;
119121
};
120122

121123
using InstEmbeddingsMap = DenseMap<const Instruction *, Embedding>;
@@ -148,7 +150,7 @@ class Embedder {
148150
mutable BBEmbeddingsMap BBVecMap;
149151
mutable InstEmbeddingsMap InstVecMap;
150152

151-
Embedder(const Function &F, const Vocab &Vocabulary);
153+
LLVM_ABI Embedder(const Function &F, const Vocab &Vocabulary);
152154

153155
/// Helper function to compute embeddings. It generates embeddings for all
154156
/// the instructions and basic blocks in the function F. Logic of computing
@@ -161,38 +163,38 @@ class Embedder {
161163

162164
/// Lookup vocabulary for a given Key. If the key is not found, it returns a
163165
/// zero vector.
164-
Embedding lookupVocab(const std::string &Key) const;
166+
LLVM_ABI Embedding lookupVocab(const std::string &Key) const;
165167

166168
public:
167169
virtual ~Embedder() = default;
168170

169171
/// Factory method to create an Embedder object.
170-
static Expected<std::unique_ptr<Embedder>>
172+
LLVM_ABI static Expected<std::unique_ptr<Embedder>>
171173
create(IR2VecKind Mode, const Function &F, const Vocab &Vocabulary);
172174

173175
/// Returns a map containing instructions and the corresponding embeddings for
174176
/// the function F if it has been computed. If not, it computes the embeddings
175177
/// for the function and returns the map.
176-
const InstEmbeddingsMap &getInstVecMap() const;
178+
LLVM_ABI const InstEmbeddingsMap &getInstVecMap() const;
177179

178180
/// Returns a map containing basic block and the corresponding embeddings for
179181
/// the function F if it has been computed. If not, it computes the embeddings
180182
/// for the function and returns the map.
181-
const BBEmbeddingsMap &getBBVecMap() const;
183+
LLVM_ABI const BBEmbeddingsMap &getBBVecMap() const;
182184

183185
/// Returns the embedding for a given basic block in the function F if it has
184186
/// been computed. If not, it computes the embedding for the basic block and
185187
/// returns it.
186-
const Embedding &getBBVector(const BasicBlock &BB) const;
188+
LLVM_ABI const Embedding &getBBVector(const BasicBlock &BB) const;
187189

188190
/// Computes and returns the embedding for the current function.
189-
const Embedding &getFunctionVector() const;
191+
LLVM_ABI const Embedding &getFunctionVector() const;
190192
};
191193

192194
/// Class for computing the Symbolic embeddings of IR2Vec.
193195
/// Symbolic embeddings are constructed based on the entity-level
194196
/// representations obtained from the Vocabulary.
195-
class SymbolicEmbedder : public Embedder {
197+
class LLVM_ABI SymbolicEmbedder : public Embedder {
196198
private:
197199
/// Utility function to compute the embedding for a given type.
198200
Embedding getTypeEmbedding(const Type *Ty) const;
@@ -219,13 +221,13 @@ class IR2VecVocabResult {
219221

220222
public:
221223
IR2VecVocabResult() = default;
222-
IR2VecVocabResult(ir2vec::Vocab &&Vocabulary);
224+
LLVM_ABI IR2VecVocabResult(ir2vec::Vocab &&Vocabulary);
223225

224226
bool isValid() const { return Valid; }
225-
const ir2vec::Vocab &getVocabulary() const;
226-
unsigned getDimension() const;
227-
bool invalidate(Module &M, const PreservedAnalyses &PA,
228-
ModuleAnalysisManager::Invalidator &Inv) const;
227+
LLVM_ABI const ir2vec::Vocab &getVocabulary() const;
228+
LLVM_ABI unsigned getDimension() const;
229+
LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
230+
ModuleAnalysisManager::Invalidator &Inv) const;
229231
};
230232

231233
/// This analysis provides the vocabulary for IR2Vec. The vocabulary provides a
@@ -237,12 +239,12 @@ class IR2VecVocabAnalysis : public AnalysisInfoMixin<IR2VecVocabAnalysis> {
237239
void emitError(Error Err, LLVMContext &Ctx);
238240

239241
public:
240-
static AnalysisKey Key;
242+
LLVM_ABI static AnalysisKey Key;
241243
IR2VecVocabAnalysis() = default;
242-
explicit IR2VecVocabAnalysis(const ir2vec::Vocab &Vocab);
243-
explicit IR2VecVocabAnalysis(ir2vec::Vocab &&Vocab);
244+
LLVM_ABI explicit IR2VecVocabAnalysis(const ir2vec::Vocab &Vocab);
245+
LLVM_ABI explicit IR2VecVocabAnalysis(ir2vec::Vocab &&Vocab);
244246
using Result = IR2VecVocabResult;
245-
Result run(Module &M, ModuleAnalysisManager &MAM);
247+
LLVM_ABI Result run(Module &M, ModuleAnalysisManager &MAM);
246248
};
247249

248250
/// This pass prints the IR2Vec embeddings for instructions, basic blocks, and
@@ -253,7 +255,7 @@ class IR2VecPrinterPass : public PassInfoMixin<IR2VecPrinterPass> {
253255

254256
public:
255257
explicit IR2VecPrinterPass(raw_ostream &OS) : OS(OS) {}
256-
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
258+
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
257259
static bool isRequired() { return true; }
258260
};
259261

llvm/include/llvm/Analysis/ValueTracking.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,11 @@ LLVM_ABI std::optional<bool> computeKnownFPSignBit(const Value *V,
311311

312312
/// Return true if the sign bit of the FP value can be ignored by the user when
313313
/// the value is zero.
314-
bool canIgnoreSignBitOfZero(const Use &U);
314+
LLVM_ABI bool canIgnoreSignBitOfZero(const Use &U);
315315

316316
/// Return true if the sign bit of the FP value can be ignored by the user when
317317
/// the value is NaN.
318-
bool canIgnoreSignBitOfNaN(const Use &U);
318+
LLVM_ABI bool canIgnoreSignBitOfNaN(const Use &U);
319319

320320
/// If the specified value can be set by repeating the same byte in memory,
321321
/// return the i8 value that it is represented with. This is true for all i8

llvm/unittests/Analysis/MemoryProfileInfoTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "llvm/IR/Module.h"
1515
#include "llvm/IR/ModuleSummaryIndex.h"
1616
#include "llvm/Support/CommandLine.h"
17+
#include "llvm/Support/Compiler.h"
1718
#include "llvm/Support/SourceMgr.h"
1819
#include "gmock/gmock.h"
1920
#include "gtest/gtest.h"
@@ -23,7 +24,7 @@
2324
using namespace llvm;
2425
using namespace llvm::memprof;
2526

26-
extern cl::opt<bool> MemProfKeepAllNotColdContexts;
27+
LLVM_ABI extern cl::opt<bool> MemProfKeepAllNotColdContexts;
2728

2829
namespace {
2930

0 commit comments

Comments
 (0)