Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Modified the description for python example
  • Loading branch information
Sangameshdavey authored Jan 9, 2024
1 parent 8886f89 commit 187aa59
Showing 1 changed file with 73 additions and 11 deletions.
84 changes: 73 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,79 @@ for (auto val : pgmVec)
```
## Using Python package (IR2Vec-Wheels)
- Input:
- .ll/.bc file for which embeddings are needed
- `fa` -> Flow-Aware Encoddings; `sym` -> Symbolic Encodings
- `p` -> program level; `f` -> function level
- Output:
- A dictionary containing:
- `Instruction_Dict`: Key: Instruction[String]; Value : Embedding Vector
- `Function_Dict`: Key: Function name[String]; Value : Embedding Vector
- `Program_List`: Program/Module Name[String]; Embedding Vector
- `Message`: [String] Appropriate debug message.
- `Status`: [Bool] True if everything went fine else False
### Initialization -ir2vec.initEmbedding
**Description:** Initialize IR2Vec embedding for an LLVM IR file.
**Parameters:**
* `file_path`: str - Path to the `.ll` or `.bc` file.
* `encoding_type`: str - Choose `fa` (Flow-Aware) or `sym` (Symbolic).
* `level`: str - Choose `p` for program-level or `f` for function-level.
**Returns:**
* `IR2VecObject`: Initialized object for accessing embeddings.
**Example:**
```python
import ir2vec
initObj = ir2vec.initEmbedding("/path/to/file.ll", "fa", "p")
```

### getProgramVector

**Description:** Gets the program-level vector representation.

**Parameters:** optional

**Returns:**

- `progVector`: ndarray - The program-level embedding vector.

**Example:**

```python
# Getting the program-level vector
progVector = initObj.getProgramVector()
```
### getFunctionVectors

**Description:** Gets function-level vectors for all functions in the LLVM IR file.

**Parameters:** optional

**Returns:**

- `functionVectorMap`: dict - A dictionary where keys are function names and values are ndarrays containing function-level embedding vectors.

**Example:**

```python
# Getting function-level vectors
functionVectorMap = initObj.getFunctionVectors()
```

### getInstructionVectors

**Description:** Gets instruction-level vectors for all instructions in the LLVM IR file.

**Parameters:** optional

**Returns:**

- `instructionVectorsList`: list - A list of list where each list contains instruction corresponding embedding vectors as values.

**Example:**

```python

# Getting instruction-level vectors
instructionVectorsList = initObj.getInstructionVectors()
```
## Example
- The following code snippet contains an example to demonstrate the usage of the package.

```python
Expand Down

0 comments on commit 187aa59

Please sign in to comment.