[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:14:15 PST 2025
================
@@ -249,23 +255,107 @@ class IR2VecTool {
++ArgIndex;
}
// Only update MaxRelation if there were operands
- if (ArgIndex > 0) {
+ if (ArgIndex > 0)
MaxRelation = std::max(MaxRelation, ArgRelation + ArgIndex - 1);
- }
+
PrevOpcode = Opcode;
HasPrevOpcode = true;
}
}
- return MaxRelation;
+ Result.MaxRelation = MaxRelation;
+ return Result;
}
- /// Dump entity ID to string mappings
- static void generateEntityMappings(raw_ostream &OS) {
+ TripletResult generateTriplets() const {
+ TripletResult Result;
+ Result.MaxRelation = NextRelation;
+
+ for (const Function &F : M) {
+ if (F.isDeclaration())
----------------
nishant-sachdeva wrote:
Accepted this
https://github.com/llvm/llvm-project/pull/170078
More information about the llvm-commits
mailing list