LLVM 22.0.0git
llvm::ir2vec::FlowAwareEmbedder Class Reference

Class for computing the Flow-aware embeddings of IR2Vec. More...

#include "llvm/Analysis/IR2Vec.h"

Inheritance diagram for llvm::ir2vec::FlowAwareEmbedder:
[legend]

Public Member Functions

 FlowAwareEmbedder (const Function &F, const Vocabulary &Vocab)
void invalidateEmbeddings () override
 Invalidate embeddings if cached.
Public Member Functions inherited from llvm::ir2vec::Embedder
virtual ~Embedder ()=default
LLVM_ABI Embedding getInstVector (const Instruction &I) const
 Computes and returns the embedding for a given instruction in the function F.
LLVM_ABI Embedding getBBVector (const BasicBlock &BB) const
 Computes and returns the embedding for a given basic block in the function F.
LLVM_ABI Embedding getFunctionVector () const
 Computes and returns the embedding for the current function.

Additional Inherited Members

Static Public Member Functions inherited from llvm::ir2vec::Embedder
static LLVM_ABI std::unique_ptr< Embeddercreate (IR2VecKind Mode, const Function &F, const Vocabulary &Vocab)
 Factory method to create an Embedder object.
Protected Member Functions inherited from llvm::ir2vec::Embedder
LLVM_ABI Embedder (const Function &F, const Vocabulary &Vocab)
Embedding computeEmbeddings () const
 Function to compute embeddings.
Embedding computeEmbeddings (const BasicBlock &BB) const
 Function to compute the embedding for a given basic block.
Protected Attributes inherited from llvm::ir2vec::Embedder
const FunctionF
const VocabularyVocab
const unsigned Dimension
 Dimension of the vector representation; captured from the input vocabulary.
const float OpcWeight
 Weights for different entities (like opcode, arguments, types) in the IR instructions to generate the vector representation.
const float TypeWeight
const float ArgWeight

Detailed Description

Class for computing the Flow-aware embeddings of IR2Vec.

Flow-aware embeddings build on the vocabulary, just like Symbolic embeddings, and additionally capture the flow information in the IR.

Definition at line 596 of file IR2Vec.h.

Constructor & Destructor Documentation

◆ FlowAwareEmbedder()

llvm::ir2vec::FlowAwareEmbedder::FlowAwareEmbedder ( const Function & F,
const Vocabulary & Vocab )
inline

Member Function Documentation

◆ invalidateEmbeddings()

void llvm::ir2vec::FlowAwareEmbedder::invalidateEmbeddings ( )
inlineoverridevirtual

Invalidate embeddings if cached.

The embeddings may not be relevant anymore when the IR changes due to transformations. In such cases, the cached embeddings should be invalidated to ensure correctness/recomputation. This is a no-op for SymbolicEmbedder but removes all the cached entries in FlowAwareEmbedder.

Reimplemented from llvm::ir2vec::Embedder.

Definition at line 606 of file IR2Vec.h.


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