{ "info": { "author": "Alessandro Di Federico", "author_email": "ale+llvmcpy@clearmind.me", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "****\nGoal\n****\n\nThe main goal of `llvmcpy` is to provide Python bindings for the LLVM project\nthat are fast and require the lowest possible maintainance effort. To achive\nthis, we use CFFI to parse the (slightly adapted) header files for the `LLVM-C\nAPI`_ and automatically generate a set of classes and functions to interact with\nthem in a Pythonic way.\n\nThis project is in an early stage, but allows you to run the following code::\n\n import sys\n from llvmcpy.llvm import *\n\n buffer = create_memory_buffer_with_contents_of_file(sys.argv[1])\n context = get_global_context()\n module = context.parse_ir(buffer)\n for function in module.iter_functions():\n for bb in function.iter_basic_blocks():\n for instruction in bb.iter_instructions():\n instruction.dump()\n\nIt has been tested with LLVM 3.4, 3.8 and 3.9. Supporting older and newer\nversions of the `LLVM-C API`_ should be basically effortless.\n\nTo try it out install LLVM and get `llvmcpy` using `pip`::\n\n sudo apt-get install llvm\n pip install llvmcpy\n\n*****************************************\nNaming of the generated classes/functions\n*****************************************\n\nThe basic idea behind this project is to take the `LLVM-C API`_ function, create\na class for each data type and create a method for that class for each function\nin the API taking an argument of that data type as first argument.\n\nThis means that the following functions::\n\n LLVMModuleRef LLVMCloneModule (LLVMModuleRef M)\n\nWill become::\n\n class Module(object):\n def clone(self):\n # ...\n\nNote the change in the case. Use ``help(Module.clone)`` to see which `LLVM-C\nAPI`_ function a certain method is using.\n\nEach class in `llvmcpy` is basically a wrapper around a pointer to an LLVM\nobject.\n\nIf an API function doesn't take an LLVM object as a first argument, it will be\npart of the `llvm` module. Moreover, we also have some also generated properties\nand generators for certain well known patterns in the API.\n\n:Properties: For each function starting with `LLVMGet` or `LLVMSet` in the\n `LLVM-C API`_, we generate a property. For example, consider the\n following two functions::\n\n void LLVMSetValueName (LLVMValueRef Val, const char *Name)\n const char* LLVMGetValueName(LLVMValueRef Val)\n\n In `llvmcpy` the `Get`/`Set` prefixes disappear, along with `Value`\n (the name of the class) and you can use them as properties of the\n `Value` class, e.g.::\n\n my_value.name = \"sum\"\n print my_value.name\n\n:Generators: The `LLVM-C API`_ has a recurrent pattern which allows you to\n navigate through the hierarchy of its class hierarchy, i.e. the\n pair of `LLVMGetSomething` and `LLVMGetNextSomething`\n functions. `Something` can be `Function`, `BasicBlock` and so\n on. `llvmcpy` identifies these patterns and produces a generator\n method which allows you to iterate over these objects in a Pythonic\n way::\n\n for function in module.iter_functions():\n for bb in function.iter_basic_blocks():\n for instruction in bb.iter_instructions():\n # ...\n\n**********************\nWhere are my bindings?\n**********************\n\nBindings are automatically generated in a lazy way. Multiple installations of\nLLVM are supported, just set the `LLVM_CONFIG` environment variable to the\n`llvm-config` program in the `bin/` directory of your LLVM installation and\neverything should work fine.\n\nThe bindings are generated in a Python script which is stored in\n``$XDG_CACHE_DIR/llvmcpy/`` (typically ``~/.cache/``) in a directory whose name\nis obtained by hashing the full path of the output of ``llvm-config --prefix``\nconcatenated with the LLVM version number. For example, for LLVM 3.9.0 installed\nin `/usr` you'll find the API bindings in\n``~/.cache/llvmcpy/7fea08f2e9d5108688f692e686c8528b914eda563e7069b25ef18c49ba96d7f2-3.9.0``.\n\nTo generate the bindings a working C preprocessor must be available in the\nsystem. By default `cpp` (the C preprocessor part of GCC) is used. If it's not\navailable we check if `clang` is available in the LLVM installation and use it.\n\n*******************\nLicense and credits\n*******************\n\nThis project is developed and maintained by Alessandro Di Federico\n(ale+llvmcpy@clearmind.me) as a part of the `rev.ng`_ project, and it's released\nunder the MIT license.\n\n.. _rev.ng: https://rev.ng/\n.. _LLVM-C API: http://llvm.org/docs/doxygen/html/group__LLVMC.html", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://rev.ng/llvmcpy", "keywords": "llvm", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "llvmcpy", "package_url": "https://pypi.org/project/llvmcpy/", "platform": "", "project_url": "https://pypi.org/project/llvmcpy/", "project_urls": { "Homepage": "https://rev.ng/llvmcpy" }, "release_url": "https://pypi.org/project/llvmcpy/0.1.5/", "requires_dist": null, "requires_python": "", "summary": "Python bindings for LLVM auto-generated from the LLVM-C API", "version": "0.1.5" }, "last_serial": 5843756, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "bc9ebb156eecbcf07cef34173219a936", "sha256": "9457fc74219c387deac26d25202678b0bae1e71974ca75c3ce61e6bb1c8ee947" }, "downloads": -1, "filename": "llvmcpy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "bc9ebb156eecbcf07cef34173219a936", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9716, "upload_time": "2016-12-16T22:27:57", "url": "https://files.pythonhosted.org/packages/42/b8/761abb8a56eacc57af9cb04afb04691945e50734a873c287ba2d2e3d0132/llvmcpy-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "ea60141ded13d8960e4b5243a92fb955", "sha256": "593d79701fc85761e2cb186c450da9884f6c54b0ee896a3e8defd92b05810b4c" }, "downloads": -1, "filename": "llvmcpy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ea60141ded13d8960e4b5243a92fb955", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10195, "upload_time": "2017-01-11T11:27:25", "url": "https://files.pythonhosted.org/packages/73/7d/05176082206e5871c45ff974f8d47e9cf57d798c2973ac9dbf543ff0f057/llvmcpy-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "4e200f60d2f0a7044b0b50fd51a08e2f", "sha256": "943ec599a6e94f840e4788cc9443911e2a1284d850ca5c7ba8eb5ac7f389ed82" }, "downloads": -1, "filename": "llvmcpy-0.1.2.tar.gz", "has_sig": false, "md5_digest": "4e200f60d2f0a7044b0b50fd51a08e2f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12580, "upload_time": "2018-02-12T21:59:40", "url": "https://files.pythonhosted.org/packages/5d/a0/ec329c450e80d4d133223a0f02359f1380bdfb06d7f35262adbd83f477b4/llvmcpy-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "98e5b4228761bf06448d160b1bf683c2", "sha256": "5d04215b586e3f0b9f3d0e1923589531fc69a7ba0423d215aa1c2f0f0f7b77f1" }, "downloads": -1, "filename": "llvmcpy-0.1.3.tar.gz", "has_sig": false, "md5_digest": "98e5b4228761bf06448d160b1bf683c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13038, "upload_time": "2018-04-17T09:47:35", "url": "https://files.pythonhosted.org/packages/de/f0/6bde1658bd482f311ad5c2734952d641c98abb29264727e7569ae46e4871/llvmcpy-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "ad93f5c6d9166649e9e66e370585a635", "sha256": "96bf5573b362d611739862896356f84c629f0a81c4bb126abd07001635b04071" }, "downloads": -1, "filename": "llvmcpy-0.1.4.tar.gz", "has_sig": false, "md5_digest": "ad93f5c6d9166649e9e66e370585a635", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14123, "upload_time": "2019-07-19T07:15:42", "url": "https://files.pythonhosted.org/packages/56/19/5360dade3562826d570c93a2b566e6655ec0500df08cc1a01c2eb990eec6/llvmcpy-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "ea5d36528b5e624a941d30fac8f6ac5b", "sha256": "906bd8b64547a93334d574a75ecf4a06a5e469f421900a18afe936bc27618157" }, "downloads": -1, "filename": "llvmcpy-0.1.5.tar.gz", "has_sig": false, "md5_digest": "ea5d36528b5e624a941d30fac8f6ac5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14083, "upload_time": "2019-09-17T19:52:30", "url": "https://files.pythonhosted.org/packages/be/0e/ee0df5621be81512cd1117ee5f2d8c41912c1bf1ade569ec92f5649332ea/llvmcpy-0.1.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ea5d36528b5e624a941d30fac8f6ac5b", "sha256": "906bd8b64547a93334d574a75ecf4a06a5e469f421900a18afe936bc27618157" }, "downloads": -1, "filename": "llvmcpy-0.1.5.tar.gz", "has_sig": false, "md5_digest": "ea5d36528b5e624a941d30fac8f6ac5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14083, "upload_time": "2019-09-17T19:52:30", "url": "https://files.pythonhosted.org/packages/be/0e/ee0df5621be81512cd1117ee5f2d8c41912c1bf1ade569ec92f5649332ea/llvmcpy-0.1.5.tar.gz" } ] }