|
9 | 9 | #include "IR2Vec.h" |
10 | 10 | #include "utils.h" |
11 | 11 | #include "version.h" |
12 | | - |
13 | 12 | #include <Python.h> |
14 | 13 | #include <cstring> |
15 | 14 | #include <fstream> |
@@ -58,14 +57,6 @@ static PyObject *getIR2VecVersion(PyObject *self, PyObject *args) { |
58 | 57 | NULL); |
59 | 58 | } |
60 | 59 |
|
61 | | -PyObject *setSeedEmbeddingPath(PyObject *self, PyObject *args) { |
62 | | - const char *vocab_path2 = ""; |
63 | | - if (PyArg_ParseTuple(args, "s", &vocab_path2)) { |
64 | | - seed_emb_path = string(vocab_path2); |
65 | | - } |
66 | | - return PyUnicode_FromString("Seed Embedding Path is Set"); |
67 | | -} |
68 | | - |
69 | 60 | bool fileNotValid(const char *filename) { |
70 | 61 | ifstream temp; |
71 | 62 | temp.open(filename, ios_base::in); |
@@ -169,21 +160,18 @@ class IR2VecHandler { |
169 | 160 | // The scope of this Module object is extremely crucial |
170 | 161 | std::unique_ptr<llvm::Module> Module; |
171 | 162 | Module = IR2Vec::getLLVMIR(); |
172 | | - std::string vocab_path = seed_emb_path + "/seedEmbeddingVocab.txt"; |
173 | 163 |
|
174 | 164 | IR2Vec::Embeddings *emb = new IR2Vec::Embeddings(); |
175 | 165 | // if output file is provided |
176 | 166 | if (this->outputFile != "") { |
177 | 167 | string outFile = this->outputFile; |
178 | 168 | ofstream output; |
179 | 169 | output.open(outFile, ios_base::app); |
180 | | - emb = std::move(new IR2Vec::Embeddings(*Module, ir2vecMode, vocab_path, |
181 | | - (this->level)[0], &output, |
182 | | - funcName)); |
| 170 | + emb = std::move(new IR2Vec::Embeddings( |
| 171 | + *Module, ir2vecMode, (this->level)[0], &output, funcName)); |
183 | 172 | } else { |
184 | | - emb = std::move(new IR2Vec::Embeddings(*Module, ir2vecMode, vocab_path, |
185 | | - (this->level)[0], nullptr, |
186 | | - funcName)); |
| 173 | + emb = std::move(new IR2Vec::Embeddings( |
| 174 | + *Module, ir2vecMode, (this->level)[0], nullptr, funcName)); |
187 | 175 | } |
188 | 176 |
|
189 | 177 | if (!emb) { |
@@ -381,8 +369,6 @@ PyMethodDef IR2Vec_core_Methods[] = { |
381 | 369 | "Get Program Vector"}, |
382 | 370 | {"getFunctionVectors", (PyCFunction)getFunctionVectors, METH_VARARGS, |
383 | 371 | "Get Function Vectors"}, |
384 | | - {"setSeedEmbdPath", (PyCFunction)setSeedEmbeddingPath, METH_VARARGS, |
385 | | - "Set Seed Embedding Path"}, |
386 | 372 | {"getVersion", getIR2VecVersion, METH_VARARGS, "Get IR2Vec Version"}, |
387 | 373 | {NULL, NULL, 0, NULL} /* Sentinel */ |
388 | 374 | }; |
|
0 commit comments