@@ -41,6 +41,18 @@ static cl::opt<std::string>
4141 VocabFile (" ir2vec-vocab-path" , cl::Optional,
4242 cl::desc (" Path to the vocabulary file for IR2Vec" ), cl::init(" " ),
4343 cl::cat(IR2VecCategory));
44+ static cl::opt<float > OpcWeight (" ir2vec-opc-weight" , cl::Optional,
45+ cl::init (1.0 ),
46+ cl::desc(" Weight for opcode embeddings" ),
47+ cl::cat(IR2VecCategory));
48+ static cl::opt<float > TypeWeight (" ir2vec-type-weight" , cl::Optional,
49+ cl::init (0.5 ),
50+ cl::desc(" Weight for type embeddings" ),
51+ cl::cat(IR2VecCategory));
52+ static cl::opt<float > ArgWeight (" ir2vec-arg-weight" , cl::Optional,
53+ cl::init (0.2 ),
54+ cl::desc(" Weight for argument embeddings" ),
55+ cl::cat(IR2VecCategory));
4456
4557AnalysisKey IR2VecVocabAnalysis::Key;
4658
@@ -54,7 +66,8 @@ AnalysisKey IR2VecVocabAnalysis::Key;
5466
5567Embedder::Embedder (const Function &F, const Vocab &Vocabulary,
5668 unsigned Dimension)
57- : F(F), Vocabulary(Vocabulary), Dimension(Dimension) {}
69+ : F(F), Vocabulary(Vocabulary), Dimension(Dimension), OpcWeight(OpcWeight),
70+ TypeWeight(TypeWeight), ArgWeight(ArgWeight) {}
5871
5972ErrorOr<std::unique_ptr<Embedder>> Embedder::create (IR2VecKind Mode,
6073 const Function &F,
0 commit comments