LLVM 22.0.0git
llvm::mir2vec::MIRVocabulary Class Reference

Class for storing and accessing the MIR2Vec vocabulary. More...

#include "llvm/CodeGen/MIR2Vec.h"

Public Types

using const_iterator = ir2vec::VocabStorage::const_iterator

Public Member Functions

unsigned getCanonicalIndexForBaseName (StringRef BaseName) const
 Get canonical index for base name (public for testing)
std::string getStringKey (unsigned Pos) const
 Get the string key for a vocabulary entry at the given position.
 MIRVocabulary ()=delete
 MIRVocabulary (VocabMap &&Entries, const TargetInstrInfo *TII)
 MIRVocabulary (ir2vec::VocabStorage &&Storage, const TargetInstrInfo &TII)
bool isValid () const
unsigned getDimension () const
const Embeddingoperator[] (unsigned Opcode) const
const_iterator begin () const
const_iterator end () const
size_t getCanonicalSize () const
 Total number of entries in the vocabulary.

Static Public Member Functions

static std::string extractBaseOpcodeName (StringRef InstrName)
 Static method for extracting base opcode names (public for testing)

Friends

class llvm::MIR2VecVocabLegacyAnalysis

Detailed Description

Class for storing and accessing the MIR2Vec vocabulary.

The MIRVocabulary class manages seed embeddings for LLVM Machine IR

Definition at line 62 of file MIR2Vec.h.

Member Typedef Documentation

◆ const_iterator

Constructor & Destructor Documentation

◆ MIRVocabulary() [1/3]

llvm::mir2vec::MIRVocabulary::MIRVocabulary ( )
delete

◆ MIRVocabulary() [2/3]

MIRVocabulary::MIRVocabulary ( VocabMap && Entries,
const TargetInstrInfo * TII )

Definition at line 51 of file MIR2Vec.cpp.

References assert().

◆ MIRVocabulary() [3/3]

llvm::mir2vec::MIRVocabulary::MIRVocabulary ( ir2vec::VocabStorage && Storage,
const TargetInstrInfo & TII )
inline

Definition at line 97 of file MIR2Vec.h.

References llvm::move().

Member Function Documentation

◆ begin()

const_iterator llvm::mir2vec::MIRVocabulary::begin ( ) const
inline

Definition at line 120 of file MIR2Vec.h.

References assert(), and isValid().

◆ end()

const_iterator llvm::mir2vec::MIRVocabulary::end ( ) const
inline

Definition at line 125 of file MIR2Vec.h.

References assert(), and isValid().

◆ extractBaseOpcodeName()

std::string MIRVocabulary::extractBaseOpcodeName ( StringRef InstrName)
static

Static method for extracting base opcode names (public for testing)

Definition at line 70 of file MIR2Vec.cpp.

References assert(), llvm::StringRef::back(), llvm::StringRef::drop_back(), llvm::StringRef::empty(), llvm::Regex::match(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::StringRef::str().

◆ getCanonicalIndexForBaseName()

unsigned MIRVocabulary::getCanonicalIndexForBaseName ( StringRef BaseName) const

Get canonical index for base name (public for testing)

Definition at line 100 of file MIR2Vec.cpp.

References assert(), and llvm::StringRef::str().

◆ getCanonicalSize()

size_t llvm::mir2vec::MIRVocabulary::getCanonicalSize ( ) const
inline

Total number of entries in the vocabulary.

Definition at line 131 of file MIR2Vec.h.

References assert(), and isValid().

◆ getDimension()

unsigned llvm::mir2vec::MIRVocabulary::getDimension ( ) const
inline

Definition at line 105 of file MIR2Vec.h.

References isValid().

◆ getStringKey()

std::string MIRVocabulary::getStringKey ( unsigned Pos) const

Get the string key for a vocabulary entry at the given position.

Definition at line 115 of file MIR2Vec.cpp.

References assert(), isValid(), and llvm_unreachable.

◆ isValid()

bool llvm::mir2vec::MIRVocabulary::isValid ( ) const
inline

Definition at line 100 of file MIR2Vec.h.

Referenced by begin(), end(), getCanonicalSize(), getDimension(), getStringKey(), and operator[]().

◆ operator[]()

const Embedding & llvm::mir2vec::MIRVocabulary::operator[] ( unsigned Opcode) const
inline

Definition at line 112 of file MIR2Vec.h.

References assert(), and isValid().

◆ llvm::MIR2VecVocabLegacyAnalysis

friend class llvm::MIR2VecVocabLegacyAnalysis
friend

Definition at line 63 of file MIR2Vec.h.

Member Data Documentation

◆ OpcodeBase

size_t llvm::mir2vec::MIRVocabulary::OpcodeBase = 0

Definition at line 69 of file MIR2Vec.h.

◆ OperandBase

size_t llvm::mir2vec::MIRVocabulary::OperandBase = 0

Definition at line 70 of file MIR2Vec.h.

◆ TotalEntries

size_t llvm::mir2vec::MIRVocabulary::TotalEntries = 0

Definition at line 71 of file MIR2Vec.h.


The documentation for this class was generated from the following files: