[llvm] Refactoring llvm-ir2vec.cpp for better separation of concerns in the Tooling classes (PR #170078)

S. VenkataKeerthy via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 7 22:14:18 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>>;
----------------
svkeerthy wrote:

Can we use a map instead? Perhaps `ir2vec::InstEmbeddingsMap` and `ir2vec::BBEmbeddingsMap` can be used directly?

(Same for mir2vec)

https://github.com/llvm/llvm-project/pull/170078


More information about the llvm-commits mailing list