[llvm] Refactoring llvm-ir2vec.cpp for better separation of concerns in the Tooling classes (PR #170078)
Nishant Sachdeva via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 8 03:21:53 PST 2025
================
@@ -151,7 +152,30 @@ static cl::opt<EmbeddingLevel>
cl::init(FunctionLevel), cl::sub(EmbeddingsSubCmd),
cl::cat(CommonCategory));
+struct Triplet {
+ unsigned Head;
+ unsigned Tail;
+ unsigned Relation;
+};
+
+struct TripletResult {
+ unsigned MaxRelation;
+ std::vector<Triplet> Triplets;
+};
+
namespace ir2vec {
+/// Entity mappings: [entity_name]
+using EntityList = std::vector<std::string>;
+
+/// Basic block embeddings: [{bb_ptr, Embedding}]
+using BBVecList = std::vector<std::pair<const BasicBlock *, ir2vec::Embedding>>;
+
+/// Instruction embeddings: [{instruction_ptr, Embedding}]
+using InstVecList =
+ std::vector<std::pair<const Instruction *, ir2vec::Embedding>>;
+
+/// Function embeddings: [Embedding]
+using FuncVecList = std::vector<ir2vec::Embedding>;
----------------
nishant-sachdeva wrote:
Accepted this.
This is going to be useful with the upcoming Python bindings. Removing this for now
https://github.com/llvm/llvm-project/pull/170078
More information about the llvm-commits
mailing list