[llvm-branch-commits] [llvm] [IR2Vec] Add embeddings mode to llvm-ir2vec tool (PR #147844)
Aiden Grossman via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jul 10 08:50:04 PDT 2025
================
@@ -117,11 +270,21 @@ int main(int argc, char **argv) {
cl::HideUnrelatedOptions(IR2VecToolCategory);
cl::ParseCommandLineOptions(
argc, argv,
- "IR2Vec - Triplet Generation Tool\n"
- "Generates triplets for vocabulary training from LLVM IR.\n"
- "Future updates will support embedding generation.\n\n"
+ "IR2Vec - Embedding Generation Tool\n"
+ "Generates embeddings for a given LLVM IR and "
+ "supports triplet generation for vocabulary "
+ "training and embedding generation.\n\n"
"Usage:\n"
- " llvm-ir2vec input.bc -o triplets.txt\n");
+ " Triplet mode: llvm-ir2vec --mode=triplets input.bc\n"
+ " Embedding mode: llvm-ir2vec --mode=embeddings "
+ "--ir2vec-vocab-path=vocab.json --level=func input.bc\n"
+ " Levels: --level=inst (instructions), --level=bb (basic blocks), "
+ "--level=func (functions)\n");
+
+ // Validate command line options
+ if (Mode == TripletMode && Level != FunctionLevel) {
----------------
boomanaiden154 wrote:
This might be a bit confusing if the user explicitly requests function level triplet mode. I think there's a way to see if the user has actually passed a flag with `cl::opt`, but I'm not sure.
https://github.com/llvm/llvm-project/pull/147844
More information about the llvm-branch-commits
mailing list