[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
Mon Dec 1 22:42:35 PST 2025


================
@@ -182,32 +206,14 @@ class IR2VecTool {
     return Vocab->isValid();
   }
 
-  /// Generate triplets for the module
-  /// Output format: MAX_RELATION=N header followed by relationships
-  void generateTriplets(raw_ostream &OS) const {
-    unsigned MaxRelation = NextRelation; // Track maximum relation ID
-    std::string Relationships;
-    raw_string_ostream RelOS(Relationships);
+  TripletResult getTriplets(const Function &F) const {
----------------
svkeerthy wrote:

Why change `generateTriplets` to `getTriplets`? AFAIU, it still generates triplets, only that it returns a struct instead of `raw_ostream`.

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


More information about the llvm-commits mailing list