LLVM: llvm::ir2vec::Embedder Class Reference (original) (raw)

Embedder provides the interface to generate embeddings (vector representations) for instructions, basic blocks, and functions. More...

#include "[llvm/Analysis/IR2Vec.h](IR2Vec%5F8h%5Fsource.html)"

Public Member Functions
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.
virtual void invalidateEmbeddings ()
Invalidate embeddings if cached.
Protected Member Functions
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.
virtual Embedding computeEmbeddings (const Instruction &I) const =0
Function to compute the embedding for a given instruction.
Protected Attributes
const Function & F
const Vocabulary & Vocab
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

Embedder provides the interface to generate embeddings (vector representations) for instructions, basic blocks, and functions.

The vector representations are generated using IR2Vec algorithms.

The Embedder class is an abstract class and it is intended to be subclassed for different IR2Vec algorithms like Symbolic and Flow-aware.

Definition at line 524 of file IR2Vec.h.

~Embedder()

virtual llvm::ir2vec::Embedder::~Embedder ( ) virtualdefault

computeEmbeddings() [1/3]

Embedding Embedder::computeEmbeddings ( ) const protected

computeEmbeddings() [2/3]

computeEmbeddings() [3/3]

Function to compute the embedding for a given instruction.

Specific to the kind of embeddings being computed.

References I.

create()

getBBVector()

getFunctionVector()

getInstVector()

invalidateEmbeddings()

virtual void llvm::ir2vec::Embedder::invalidateEmbeddings ( ) inlinevirtual

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 in llvm::ir2vec::FlowAwareEmbedder.

Definition at line 578 of file IR2Vec.h.

ArgWeight

Dimension

F

OpcWeight

Weights for different entities (like opcode, arguments, types) in the IR instructions to generate the vector representation.

Definition at line 534 of file IR2Vec.h.

Referenced by Embedder().

TypeWeight

Vocab


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