diff options
Diffstat (limited to 'llvm/include/llvm/Analysis/IR2Vec.h')
-rw-r--r-- | llvm/include/llvm/Analysis/IR2Vec.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/IR2Vec.h b/llvm/include/llvm/Analysis/IR2Vec.h index 3d7edf0..d87457c 100644 --- a/llvm/include/llvm/Analysis/IR2Vec.h +++ b/llvm/include/llvm/Analysis/IR2Vec.h @@ -170,6 +170,10 @@ public: unsigned getDimension() const; size_t size() const; + static size_t expectedSize() { + return MaxOpcodes + MaxTypeIDs + MaxOperandKinds; + } + /// Helper function to get vocabulary key for a given Opcode static StringRef getVocabKeyForOpcode(unsigned Opcode); @@ -182,6 +186,11 @@ public: /// Helper function to classify an operand into OperandKind static OperandKind getOperandKind(const Value *Op); + /// Helpers to return the IDs of a given Opcode, TypeID, or OperandKind + static unsigned getNumericID(unsigned Opcode); + static unsigned getNumericID(Type::TypeID TypeID); + static unsigned getNumericID(const Value *Op); + /// Accessors to get the embedding for a given entity. const ir2vec::Embedding &operator[](unsigned Opcode) const; const ir2vec::Embedding &operator[](Type::TypeID TypeId) const; |