LLVM 22.0.0git
Classes | Namespaces | Macros | Typedefs | Enumerations | Variables
IR2Vec.h File Reference

This file defines the IR2Vec vocabulary analysis(IR2VecVocabAnalysis), the core ir2vec::Embedder interface for generating IR embeddings, and related utilities like the IR2VecPrinterPass. More...

#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/JSON.h"
#include <array>
#include <map>
#include "llvm/IR/Instruction.def"

Go to the source code of this file.

Classes

struct  llvm::ir2vec::Embedding
 Embedding is a datatype that wraps std::vector<double>. More...
 
class  llvm::ir2vec::Vocabulary
 Class for storing and accessing the IR2Vec vocabulary. More...
 
class  llvm::ir2vec::Embedder
 Embedder provides the interface to generate embeddings (vector representations) for instructions, basic blocks, and functions. More...
 
class  llvm::ir2vec::SymbolicEmbedder
 Class for computing the Symbolic embeddings of IR2Vec. More...
 
class  llvm::ir2vec::FlowAwareEmbedder
 Class for computing the Flow-aware embeddings of IR2Vec. More...
 
class  llvm::IR2VecVocabAnalysis
 This analysis provides the vocabulary for IR2Vec. More...
 
class  llvm::IR2VecPrinterPass
 This pass prints the IR2Vec embeddings for instructions, basic blocks, and functions. More...
 
class  llvm::IR2VecVocabPrinterPass
 This pass prints the embeddings in the vocabulary. More...
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 
namespace  llvm::ir2vec
 

Macros

#define LAST_OTHER_INST(NUM)   static constexpr unsigned MaxOpcodes = NUM;
 Vocabulary layout constants.
 

Typedefs

using llvm::ir2vec::InstEmbeddingsMap = DenseMap< const Instruction *, Embedding >
 
using llvm::ir2vec::BBEmbeddingsMap = DenseMap< const BasicBlock *, Embedding >
 

Enumerations

enum class  llvm::IR2VecKind { llvm::Symbolic , llvm::FlowAware }
 IR2Vec computes two kinds of embeddings: Symbolic and Flow-aware. More...
 

Variables

llvm::cl::OptionCategory llvm::ir2vec::IR2VecCategory
 
LLVM_ABI cl::opt< float > llvm::ir2vec::OpcWeight
 
LLVM_ABI cl::opt< float > llvm::ir2vec::TypeWeight
 
LLVM_ABI cl::opt< float > llvm::ir2vec::ArgWeight
 
LLVM_ABI cl::opt< IR2VecKind > llvm::ir2vec::IR2VecEmbeddingKind
 

Detailed Description

This file defines the IR2Vec vocabulary analysis(IR2VecVocabAnalysis), the core ir2vec::Embedder interface for generating IR embeddings, and related utilities like the IR2VecPrinterPass.

Program Embeddings are typically or derived-from a learned representation of the program. Such embeddings are used to represent the programs as input to machine learning algorithms. IR2Vec represents the LLVM IR as embeddings.

The IR2Vec algorithm is described in the following paper:

IR2Vec: LLVM IR Based Scalable Program Embeddings, S. VenkataKeerthy, Rohit Aggarwal, Shalini Jain, Maunendra Sankar Desarkar, Ramakrishna Upadrasta, and Y. N. Srikant, ACM Transactions on Architecture and Code Optimization (TACO), 2020. https://doi.org/10.1145/3418463. https://arxiv.org/abs/1909.06228

Definition in file IR2Vec.h.

Macro Definition Documentation

◆ LAST_OTHER_INST

#define LAST_OTHER_INST (   NUM)    static constexpr unsigned MaxOpcodes = NUM;

Vocabulary layout constants.

Definition at line 196 of file IR2Vec.h.