llvm2py 0.2.0b0
pip install llvm2py
Released:
A library for analyzing LLVM IR in Python
Navigation
Verified details
These details have been verified by PyPIProject links
GitHub Statistics
Maintainers
Unverified details
These details have not been verified by PyPIMeta
- License: MIT License (MIT)
- Author: Papr1ka
- Tags llvm, analysis, ir, intermediate, presentation, representation, compiler, parser
- Requires: Python >=3.10
Classifiers
- Development Status
- Intended Audience
- License
- Natural Language
- Operating System
- Programming Language
- Topic
Project description
|PyPI| |Actions Status| |Release|
llvm2py #######
A fairly large proportion of programs are written in C/C++.
Let's imagine that you need to analyze programs in a given language, to search for vulnerabilities, to detect patterns or for optimization purposes. To solve such a problem, it is necessary to have the code in a slightly more convenient form than the source code of the program - an intermediate representation.
You might come up with the idea of building your own compiler, which is quite difficult, or you might decide to use intermediate representations of GCC or LLVM, but in that case you have to deal with the C/C++ API, which is something you don't want when you have elegant solutions in Python.
llvm2py allows you to analyze C/C++ programs in the LLVM IR representation in Python.
.. note::
The library is in beta, so in case of problems, feel free to create issues.
Usage example
The following example will build a control flow graph for the following function factorial.c, factorial.ll.
.. code-block:: cpp
int factorial_req(int n)
{
if (n == 1)
{
return 1;
}
return factorial_req(n - 1) * n;
}
.. code-block:: python
from llvm2py import parse_assembly
from llvm2py.ir import *
from graphviz import Digraph
with open("../test_files/factorial.ll") as file:
source = file.read()
mod = parse_assembly(source)
g = Digraph()
node_attributes = {"shape": "record", "style": "filled"}
def name_label(label):
return label.replace("%", "\\%")
def name_block(block):
name = block.value.val
return name_label(name)
for block in mod.funcs["factorial_req"].blocks.values():
color = "#f59c7d70" # Default block color
last_instruction = block.instrs[-1]
match last_instruction:
case Br(None, Value(label)):
g.edge(name_block(block), name_label(label))
case Br(_, Value(label_false), Value(label_true)):
g.edge(name_block(block), name_label(label_true), label="True")
g.edge(name_block(block), name_label(label_false), label="False")
if len(block.pred_blocks) >= 2:
color = "#b70d2870" # merge-type block
g.node(name_block(block), **node_attributes, color=color)
g.save("cfg.dot")
.. |PyPI| image:: https://img.shields.io/pypi/v/llvm2py.svg :target: https://pypi.python.org/pypi/llvm2py
.. |Actions status| image:: https://github.com/Papr1ka/llvm2py/actions/workflows/main.yml/badge.svg?branch=main :target: https://github.com/Papr1ka/llvm2py/actions/workflows/main.yml
.. |Release| image:: https://img.shields.io/github/v/release/Papr1ka/llvm2py.svg?label=release :target: https://github.com/Papr1ka/llvm2py/releases
Project details
Verified details
These details have been verified by PyPIProject links
GitHub Statistics
Maintainers
Unverified details
These details have not been verified by PyPIMeta
- License: MIT License (MIT)
- Author: Papr1ka
- Tags llvm, analysis, ir, intermediate, presentation, representation, compiler, parser
- Requires: Python >=3.10
Classifiers
- Development Status
- Intended Audience
- License
- Natural Language
- Operating System
- Programming Language
- Topic
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Uploaded
CPython 3.13
Windows x86-64
Uploaded
CPython 3.13
manylinux: glibc 2.28+ x86-64
Uploaded
CPython 3.12
Windows x86-64
Uploaded
CPython 3.12
manylinux: glibc 2.28+ x86-64
Uploaded
CPython 3.11
Windows x86-64
Uploaded
CPython 3.11
manylinux: glibc 2.28+ x86-64
Uploaded
CPython 3.10
Windows x86-64
Uploaded
CPython 3.10
manylinux: glibc 2.28+ x86-64
File details
Details for the file llvm2py-0.2.0b0.tar.gz
.
File metadata
- Download URL: llvm2py-0.2.0b0.tar.gz
- Upload date:
- Size: 36.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ef07f53a664cd66c00b70db0f075b1ed01ecce9c577748cba052384ea07af66 |
|
MD5 | 13a5f79a3b7776d23cf8e25daf00d34a |
|
BLAKE2b-256 | d9a8c5113f562bcc6aa68f0bed05a303f18cf8f03779cdbb8901c21247d4a0ae |
Provenance
The following attestation bundles were made for llvm2py-0.2.0b0.tar.gz
:
Publisher:
main.yml
on Papr1ka/llvm2py
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
llvm2py-0.2.0b0.tar.gz
- Subject digest:
9ef07f53a664cd66c00b70db0f075b1ed01ecce9c577748cba052384ea07af66
- Sigstore transparency entry: 179483674
- Sigstore integration time:
- Permalink:
Papr1ka/llvm2py@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Branch / Tag:
refs/heads/dev
- Owner: https://github.com/Papr1ka
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
main.yml@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file llvm2py-0.2.0b0-cp313-cp313-win_amd64.whl
.
File metadata
- Download URL: llvm2py-0.2.0b0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c672220133b33cef60e459268da72b68e15e2f610b9be5911bd95a06f61dd87c |
|
MD5 | 26ae1d927deee219e74861e8cf59cf3b |
|
BLAKE2b-256 | f2382d149b21360968bc48a7226ed2c3b286db8fc9987bd4621cd81e0401654d |
Provenance
The following attestation bundles were made for llvm2py-0.2.0b0-cp313-cp313-win_amd64.whl
:
Publisher:
main.yml
on Papr1ka/llvm2py
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
llvm2py-0.2.0b0-cp313-cp313-win_amd64.whl
- Subject digest:
c672220133b33cef60e459268da72b68e15e2f610b9be5911bd95a06f61dd87c
- Sigstore transparency entry: 179483683
- Sigstore integration time:
- Permalink:
Papr1ka/llvm2py@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Branch / Tag:
refs/heads/dev
- Owner: https://github.com/Papr1ka
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
main.yml@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file llvm2py-0.2.0b0-cp313-cp313-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: llvm2py-0.2.0b0-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca8595389184251aacefb4505a2019864a5c92197d160feeff75929a944f370d |
|
MD5 | 74aec38fc2e9a5e643eecab32ba1e027 |
|
BLAKE2b-256 | 07a8d803872bf7b315a96843da7558b98aecec85f8b470dccd594a9059c706fd |
Provenance
The following attestation bundles were made for llvm2py-0.2.0b0-cp313-cp313-manylinux_2_28_x86_64.whl
:
Publisher:
main.yml
on Papr1ka/llvm2py
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
llvm2py-0.2.0b0-cp313-cp313-manylinux_2_28_x86_64.whl
- Subject digest:
ca8595389184251aacefb4505a2019864a5c92197d160feeff75929a944f370d
- Sigstore transparency entry: 179483682
- Sigstore integration time:
- Permalink:
Papr1ka/llvm2py@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Branch / Tag:
refs/heads/dev
- Owner: https://github.com/Papr1ka
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
main.yml@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file llvm2py-0.2.0b0-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: llvm2py-0.2.0b0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 504cc87a4b4604742a59537d7ed7907f70c02c77a96785612aaf3a3bcc1222f8 |
|
MD5 | dff86ec23648e0942c0cd70db394bd33 |
|
BLAKE2b-256 | 21662d3790d7b06c221873626c385ccbc077edb876191c4a8722430246416b52 |
Provenance
The following attestation bundles were made for llvm2py-0.2.0b0-cp312-cp312-win_amd64.whl
:
Publisher:
main.yml
on Papr1ka/llvm2py
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
llvm2py-0.2.0b0-cp312-cp312-win_amd64.whl
- Subject digest:
504cc87a4b4604742a59537d7ed7907f70c02c77a96785612aaf3a3bcc1222f8
- Sigstore transparency entry: 179483676
- Sigstore integration time:
- Permalink:
Papr1ka/llvm2py@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Branch / Tag:
refs/heads/dev
- Owner: https://github.com/Papr1ka
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
main.yml@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file llvm2py-0.2.0b0-cp312-cp312-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: llvm2py-0.2.0b0-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45fa6a1ec1d40592c4c3a3d26cc858c627c6583cab170ecdb3207fb1a8c0c659 |
|
MD5 | 8153ac71db6dccec4ad396f36783fe97 |
|
BLAKE2b-256 | 41f1c8bb90dfa9c300cb4339130183854385a48ac5880ee027a538575ece8959 |
Provenance
The following attestation bundles were made for llvm2py-0.2.0b0-cp312-cp312-manylinux_2_28_x86_64.whl
:
Publisher:
main.yml
on Papr1ka/llvm2py
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
llvm2py-0.2.0b0-cp312-cp312-manylinux_2_28_x86_64.whl
- Subject digest:
45fa6a1ec1d40592c4c3a3d26cc858c627c6583cab170ecdb3207fb1a8c0c659
- Sigstore transparency entry: 179483679
- Sigstore integration time:
- Permalink:
Papr1ka/llvm2py@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Branch / Tag:
refs/heads/dev
- Owner: https://github.com/Papr1ka
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
main.yml@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file llvm2py-0.2.0b0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: llvm2py-0.2.0b0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a42036f37db369261c90b724a262d6526a6e13f982a00a144de744e4f0aa0628 |
|
MD5 | 01152d05373a0d0ac9e7db7ac49b9be2 |
|
BLAKE2b-256 | 5b3c79639725a6c5ae4eddf0f4a9727dc4159ee76ebff440642facb353d61da8 |
Provenance
The following attestation bundles were made for llvm2py-0.2.0b0-cp311-cp311-win_amd64.whl
:
Publisher:
main.yml
on Papr1ka/llvm2py
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
llvm2py-0.2.0b0-cp311-cp311-win_amd64.whl
- Subject digest:
a42036f37db369261c90b724a262d6526a6e13f982a00a144de744e4f0aa0628
- Sigstore transparency entry: 179483677
- Sigstore integration time:
- Permalink:
Papr1ka/llvm2py@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Branch / Tag:
refs/heads/dev
- Owner: https://github.com/Papr1ka
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
main.yml@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file llvm2py-0.2.0b0-cp311-cp311-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: llvm2py-0.2.0b0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83a6e17149a62c7019681560e9f6edcb28a449da1c2ea664c7fb9aa411fec607 |
|
MD5 | ea7f95891bde4ab9fcc96682698ef919 |
|
BLAKE2b-256 | 5d918706770400e6809aafe53d31e5df63554c860c95bf01981e1753149fbd6e |
Provenance
The following attestation bundles were made for llvm2py-0.2.0b0-cp311-cp311-manylinux_2_28_x86_64.whl
:
Publisher:
main.yml
on Papr1ka/llvm2py
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
llvm2py-0.2.0b0-cp311-cp311-manylinux_2_28_x86_64.whl
- Subject digest:
83a6e17149a62c7019681560e9f6edcb28a449da1c2ea664c7fb9aa411fec607
- Sigstore transparency entry: 179483681
- Sigstore integration time:
- Permalink:
Papr1ka/llvm2py@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Branch / Tag:
refs/heads/dev
- Owner: https://github.com/Papr1ka
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
main.yml@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file llvm2py-0.2.0b0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: llvm2py-0.2.0b0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a6c9d6bc9ad337fc005abe3b9cdf9bd04d22c37734aed0f0d462c0b5ad6184a |
|
MD5 | 56abd6ad0046be7d29c9cdbd014547f9 |
|
BLAKE2b-256 | 70b6034759dcaf65d725b847744059bc4776efbf2b7c353deafd8e28cb72947a |
Provenance
The following attestation bundles were made for llvm2py-0.2.0b0-cp310-cp310-win_amd64.whl
:
Publisher:
main.yml
on Papr1ka/llvm2py
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
llvm2py-0.2.0b0-cp310-cp310-win_amd64.whl
- Subject digest:
9a6c9d6bc9ad337fc005abe3b9cdf9bd04d22c37734aed0f0d462c0b5ad6184a
- Sigstore transparency entry: 179483675
- Sigstore integration time:
- Permalink:
Papr1ka/llvm2py@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Branch / Tag:
refs/heads/dev
- Owner: https://github.com/Papr1ka
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
main.yml@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file llvm2py-0.2.0b0-cp310-cp310-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: llvm2py-0.2.0b0-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b800f5ce5bbc8fbf015a0df664226b55fef0ee4e7dae7fd59c9b88c1aad75fcb |
|
MD5 | 7543b903526c79e05a9e7209bbf47a92 |
|
BLAKE2b-256 | d733330297a918d0f0a5696c8eefb567da9a6ab91369c92b3bcc15f0b454ac95 |
Provenance
The following attestation bundles were made for llvm2py-0.2.0b0-cp310-cp310-manylinux_2_28_x86_64.whl
:
Publisher:
main.yml
on Papr1ka/llvm2py
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
llvm2py-0.2.0b0-cp310-cp310-manylinux_2_28_x86_64.whl
- Subject digest:
b800f5ce5bbc8fbf015a0df664226b55fef0ee4e7dae7fd59c9b88c1aad75fcb
- Sigstore transparency entry: 179483680
- Sigstore integration time:
- Permalink:
Papr1ka/llvm2py@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Branch / Tag:
refs/heads/dev
- Owner: https://github.com/Papr1ka
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
main.yml@5ae5c84d9920a8b62e59f9af9f80be85a4dfdef0
- Trigger Event:
workflow_dispatch
- Statement type: