Skip to content

Commit 17a6e0b

Browse files
committed
[NFC][IR2Vec] Exposing helpers in IR2Vec Vocabulary
1 parent 80c29d9 commit 17a6e0b

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

llvm/include/llvm/Analysis/IR2Vec.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ class Vocabulary {
163163
static constexpr unsigned MaxOperandKinds =
164164
static_cast<unsigned>(OperandKind::MaxOperandKind);
165165

166+
public:
167+
Vocabulary() = default;
168+
Vocabulary(VocabVector &&Vocab);
169+
170+
bool isValid() const;
171+
unsigned getDimension() const;
172+
size_t size() const;
173+
166174
/// Helper function to get vocabulary key for a given Opcode
167175
static StringRef getVocabKeyForOpcode(unsigned Opcode);
168176

@@ -175,14 +183,6 @@ class Vocabulary {
175183
/// Helper function to classify an operand into OperandKind
176184
static OperandKind getOperandKind(const Value *Op);
177185

178-
public:
179-
Vocabulary() = default;
180-
Vocabulary(VocabVector &&Vocab);
181-
182-
bool isValid() const;
183-
unsigned getDimension() const;
184-
size_t size() const;
185-
186186
/// Accessors to get the embedding for a given entity.
187187
const ir2vec::Embedding &operator[](unsigned Opcode) const;
188188
const ir2vec::Embedding &operator[](Type::TypeID TypeId) const;

llvm/lib/Analysis/IR2Vec.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,8 @@ IR2VecVocabAnalysis::run(Module &M, ModuleAnalysisManager &AM) {
518518
// Otherwise, try to read from the vocabulary file.
519519
if (VocabFile.empty()) {
520520
// FIXME: Use default vocabulary
521-
Ctx->emitError("IR2Vec vocabulary file path not specified");
521+
Ctx->emitError("IR2Vec vocabulary file path not specified; You may need to "
522+
"set it using --ir2vec-vocab-path");
522523
return Vocabulary(); // Return invalid result
523524
}
524525
if (auto Err = readVocabulary()) {

0 commit comments

Comments
 (0)