Skip to content

Commit bd45b77

Browse files
committed
[NFC][IR2Vec] Exposing helpers in IR2Vec Vocabulary
1 parent 8ae8b50 commit bd45b77

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
@@ -162,6 +162,14 @@ class Vocabulary {
162162
static constexpr unsigned MaxOperandKinds =
163163
static_cast<unsigned>(OperandKind::MaxOperandKind);
164164

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

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

177-
public:
178-
Vocabulary() = default;
179-
Vocabulary(VocabVector &&Vocab);
180-
181-
bool isValid() const;
182-
unsigned getDimension() const;
183-
size_t size() const;
184-
185185
/// Accessors to get the embedding for a given entity.
186186
const ir2vec::Embedding &operator[](unsigned Opcode) const;
187187
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
@@ -501,7 +501,8 @@ IR2VecVocabAnalysis::run(Module &M, ModuleAnalysisManager &AM) {
501501
// Otherwise, try to read from the vocabulary file.
502502
if (VocabFile.empty()) {
503503
// FIXME: Use default vocabulary
504-
Ctx->emitError("IR2Vec vocabulary file path not specified");
504+
Ctx->emitError("IR2Vec vocabulary file path not specified; You may need to "
505+
"set it using --ir2vec-vocab-path");
505506
return Vocabulary(); // Return invalid result
506507
}
507508
if (auto Err = readVocabulary()) {

0 commit comments

Comments
 (0)