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.
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.
 MIRVocabulary ()=delete

Static Public Member Functions

static std::string extractBaseOpcodeName (StringRef InstrName)
 Static method for extracting base opcode names (public for testing)
static Expected< MIRVocabularycreate (VocabMap &&Entries, const TargetInstrInfo &TII)
 Factory method to create MIRVocabulary from vocabulary map.

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 63 of file MIR2Vec.h.

Member Typedef Documentation

◆ const_iterator

Constructor & Destructor Documentation

◆ MIRVocabulary()

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

Referenced by create().

Member Function Documentation

◆ begin()

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

Definition at line 106 of file MIR2Vec.h.

◆ create()

Expected< MIRVocabulary > MIRVocabulary::create ( VocabMap && Entries,
const TargetInstrInfo & TII )
static

Factory method to create MIRVocabulary from vocabulary map.

Definition at line 64 of file MIR2Vec.cpp.

References llvm::createStringError(), llvm::invalid_argument, and MIRVocabulary().

Referenced by llvm::MIR2VecVocabLegacyAnalysis::getMIR2VecVocabulary().

◆ end()

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

Definition at line 108 of file MIR2Vec.h.

◆ extractBaseOpcodeName()

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

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

Definition at line 73 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 103 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 111 of file MIR2Vec.h.

◆ getDimension()

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

Definition at line 96 of file MIR2Vec.h.

◆ getStringKey()

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

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

Definition at line 117 of file MIR2Vec.cpp.

References assert(), and llvm_unreachable.

◆ operator[]()

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

Definition at line 99 of file MIR2Vec.h.

◆ llvm::MIR2VecVocabLegacyAnalysis

friend class llvm::MIR2VecVocabLegacyAnalysis
friend

Definition at line 64 of file MIR2Vec.h.

Member Data Documentation

◆ OpcodeBase

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

Definition at line 70 of file MIR2Vec.h.

◆ OperandBase

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

Definition at line 71 of file MIR2Vec.h.

◆ TotalEntries

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

Definition at line 72 of file MIR2Vec.h.


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