|
LLVM 22.0.0git
|
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 indices from opcode or operand names. | |
| unsigned | getCanonicalIndexForOperandName (StringRef OperandName) const |
| unsigned | getCanonicalIndexForRegisterClass (StringRef RegName, bool IsPhysical=true) const |
| std::string | getStringKey (unsigned Pos) const |
| Get the string key for a vocabulary entry at the given position. | |
| unsigned | getDimension () const |
| unsigned | getEntityIDForOpcode (unsigned Opcode) const |
| Get entity ID (flat index) for an opcode This is used for triplet generation. | |
| unsigned | getEntityIDForMachineOperand (const MachineOperand &MO) const |
| Get entity ID (flat index) for a machine operand This is used for triplet generation. | |
| const Embedding & | operator[] (unsigned Opcode) const |
| const Embedding & | operator[] (MachineOperand Operand) const |
| const_iterator | begin () const |
| const_iterator | end () const |
| MIRVocabulary ()=delete | |
| 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) | |
| static Expected< MIRVocabulary > | create (VocabMap &&OpcMap, VocabMap &&CommonOperandsMap, VocabMap &&PhyRegMap, VocabMap &&VirtRegMap, const TargetInstrInfo &TII, const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI) |
| Factory method to create MIRVocabulary from vocabulary map. | |
| static Expected< MIRVocabulary > | createDummyVocabForTest (const TargetInstrInfo &TII, const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI, unsigned Dim=1) |
| Create a dummy vocabulary for testing purposes. | |
Friends | |
| class | llvm::MIR2VecVocabLegacyAnalysis |
Class for storing and accessing the MIR2Vec vocabulary.
The MIRVocabulary class manages seed embeddings for LLVM Machine IR
|
delete |
Referenced by create().
|
inline |
|
static |
Factory method to create MIRVocabulary from vocabulary map.
Definition at line 93 of file MIR2Vec.cpp.
References llvm::createStringError(), llvm::ir2vec::VocabStorage::getDimension(), llvm::invalid_argument, llvm::ir2vec::VocabStorage::isValid(), and MIRVocabulary().
Referenced by createDummyVocabForTest(), and llvm::MIR2VecVocabProvider::getVocabulary().
|
static |
Create a dummy vocabulary for testing purposes.
Definition at line 377 of file MIR2Vec.cpp.
References assert(), create(), and extractBaseOpcodeName().
|
inline |
|
static |
Static method for extracting base opcode names (public for testing)
Definition at line 114 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().
Referenced by createDummyVocabForTest().
Get indices from opcode or operand names.
These are public for testing. String based lookups are inefficient and should be avoided in general.
Definition at line 144 of file MIR2Vec.cpp.
References assert(), and llvm::StringRef::str().
Definition at line 159 of file MIR2Vec.cpp.
References assert().
| unsigned MIRVocabulary::getCanonicalIndexForRegisterClass | ( | StringRef | RegName, |
| bool | IsPhysical = true ) const |
Definition at line 169 of file MIR2Vec.cpp.
|
inline |
|
inline |
|
inline |
Get entity ID (flat index) for a machine operand This is used for triplet generation.
Definition at line 236 of file MIR2Vec.h.
References llvm::MachineOperand::getReg(), llvm::MachineOperand::getType(), and llvm::MachineOperand::MO_Register.
| std::string MIRVocabulary::getStringKey | ( | unsigned | Pos | ) | const |
Get the string key for a vocabulary entry at the given position.
Definition at line 179 of file MIR2Vec.cpp.
References assert().
|
inline |
Definition at line 248 of file MIR2Vec.h.
References llvm::MachineOperand::getReg(), llvm::MachineOperand::getType(), and llvm::MachineOperand::MO_Register.
|
friend |
| size_t llvm::mir2vec::MIRVocabulary::CommonOperandBase = 0 |