Skip to content

Commit ab107a5

Browse files
committed
[llvm] auto-annotate remaining Analysis lib interface with IDS
1 parent 98e8ef2 commit ab107a5

File tree

3 files changed

+28
-27
lines changed

3 files changed

+28
-27
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: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#ifndef LLVM_ANALYSIS_IR2VEC_H
3030
#define LLVM_ANALYSIS_IR2VEC_H
3131

32+
#include "llvm/Support/Compiler.h"
3233
#include "llvm/ADT/DenseMap.h"
3334
#include "llvm/IR/PassManager.h"
3435
#include "llvm/Support/CommandLine.h"
@@ -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,16 @@ 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, double Tolerance = 1e-6) const;
119120
};
120121

121122
using InstEmbeddingsMap = DenseMap<const Instruction *, Embedding>;
@@ -148,7 +149,7 @@ class Embedder {
148149
mutable BBEmbeddingsMap BBVecMap;
149150
mutable InstEmbeddingsMap InstVecMap;
150151

151-
Embedder(const Function &F, const Vocab &Vocabulary);
152+
LLVM_ABI Embedder(const Function &F, const Vocab &Vocabulary);
152153

153154
/// Helper function to compute embeddings. It generates embeddings for all
154155
/// the instructions and basic blocks in the function F. Logic of computing
@@ -161,38 +162,38 @@ class Embedder {
161162

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

166167
public:
167168
virtual ~Embedder() = default;
168169

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

173174
/// Returns a map containing instructions and the corresponding embeddings for
174175
/// the function F if it has been computed. If not, it computes the embeddings
175176
/// for the function and returns the map.
176-
const InstEmbeddingsMap &getInstVecMap() const;
177+
LLVM_ABI const InstEmbeddingsMap &getInstVecMap() const;
177178

178179
/// Returns a map containing basic block and the corresponding embeddings for
179180
/// the function F if it has been computed. If not, it computes the embeddings
180181
/// for the function and returns the map.
181-
const BBEmbeddingsMap &getBBVecMap() const;
182+
LLVM_ABI const BBEmbeddingsMap &getBBVecMap() const;
182183

183184
/// Returns the embedding for a given basic block in the function F if it has
184185
/// been computed. If not, it computes the embedding for the basic block and
185186
/// returns it.
186-
const Embedding &getBBVector(const BasicBlock &BB) const;
187+
LLVM_ABI const Embedding &getBBVector(const BasicBlock &BB) const;
187188

188189
/// Computes and returns the embedding for the current function.
189-
const Embedding &getFunctionVector() const;
190+
LLVM_ABI const Embedding &getFunctionVector() const;
190191
};
191192

192193
/// Class for computing the Symbolic embeddings of IR2Vec.
193194
/// Symbolic embeddings are constructed based on the entity-level
194195
/// representations obtained from the Vocabulary.
195-
class SymbolicEmbedder : public Embedder {
196+
class LLVM_ABI SymbolicEmbedder : public Embedder {
196197
private:
197198
/// Utility function to compute the embedding for a given type.
198199
Embedding getTypeEmbedding(const Type *Ty) const;
@@ -219,12 +220,12 @@ class IR2VecVocabResult {
219220

220221
public:
221222
IR2VecVocabResult() = default;
222-
IR2VecVocabResult(ir2vec::Vocab &&Vocabulary);
223+
LLVM_ABI IR2VecVocabResult(ir2vec::Vocab &&Vocabulary);
223224

224225
bool isValid() const { return Valid; }
225-
const ir2vec::Vocab &getVocabulary() const;
226-
unsigned getDimension() const;
227-
bool invalidate(Module &M, const PreservedAnalyses &PA,
226+
LLVM_ABI const ir2vec::Vocab &getVocabulary() const;
227+
LLVM_ABI unsigned getDimension() const;
228+
LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
228229
ModuleAnalysisManager::Invalidator &Inv) const;
229230
};
230231

@@ -237,12 +238,12 @@ class IR2VecVocabAnalysis : public AnalysisInfoMixin<IR2VecVocabAnalysis> {
237238
void emitError(Error Err, LLVMContext &Ctx);
238239

239240
public:
240-
static AnalysisKey Key;
241+
LLVM_ABI static AnalysisKey Key;
241242
IR2VecVocabAnalysis() = default;
242-
explicit IR2VecVocabAnalysis(const ir2vec::Vocab &Vocab);
243-
explicit IR2VecVocabAnalysis(ir2vec::Vocab &&Vocab);
243+
LLVM_ABI explicit IR2VecVocabAnalysis(const ir2vec::Vocab &Vocab);
244+
LLVM_ABI explicit IR2VecVocabAnalysis(ir2vec::Vocab &&Vocab);
244245
using Result = IR2VecVocabResult;
245-
Result run(Module &M, ModuleAnalysisManager &MAM);
246+
LLVM_ABI Result run(Module &M, ModuleAnalysisManager &MAM);
246247
};
247248

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

254255
public:
255256
explicit IR2VecPrinterPass(raw_ostream &OS) : OS(OS) {}
256-
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
257+
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
257258
static bool isRequired() { return true; }
258259
};
259260

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

0 commit comments

Comments
 (0)