summaryrefslogtreecommitdiffstats
path: root/llvm/bindings/python
Commit message (Collapse)AuthorAgeFilesLines
* [python] Fix getting section contents.Anders Waldenborg2014-04-252-2/+12
| | | | | | | | | | | The returnvalue was handled as c_char_p which ment that ctypes handled it as a NUL-terminated string making it cut the contents at first NUL (or even worse - overrunning the buffer if it doesn't contain a NUL). Differential Revision: http://reviews.llvm.org/D3474 llvm-svn: 207199
* [python] Fix python bindings testsAnders Waldenborg2014-04-231-1/+0
| | | | | | | Broke after the changes related to the LLVMGetSymbolFileOffset removal in r206750 llvm-svn: 207018
* Convert getFileOffset to getOffset and move it to its only user.Rafael Espindola2014-04-211-12/+0
| | | | | | | | | | | | | We normally don't drop functions from the C API's, but in this case I think we can: * The old implementation of getFileOffset was fairly broken * The introduction of LLVMGetSymbolFileOffset was itself a C api breaking change as it removed LLVMGetSymbolOffset. * It is an incredibly specialized use case. The only reason MCJIT needs it is because of its odd position of being a dynamic linker of .o files. llvm-svn: 206750
* [python-bindings] Remove some cruft that snuck in.Michael Gottesman2014-02-231-4/+2
| | | | llvm-svn: 201966
* [python-bindings] Added OpCode like support for all enumerations with unittests.Michael Gottesman2014-02-222-37/+139
| | | | | | Also fixed some trailing whitespace issues. llvm-svn: 201929
* Fix documentation typosAlp Toker2013-12-201-2/+2
| | | | llvm-svn: 197757
* python: Fix check for disasm creation failureAnders Waldenborg2013-11-172-1/+5
| | | | | | | | | | | | Check should be for pointer being NULL, not what it points to. Also adds a test for this case. Reviewed By: indygreg Differential Revision: http://llvm-reviews.chandlerc.com/D1878 llvm-svn: 194965
* python: Properly initialize before trying to create disasmAnders Waldenborg2013-11-171-0/+26
| | | | | | | | | | | | | | | | | As the "LLVMInitializeAll*" functions are not available as symbols in the shared library they can't be used, and as a workaround a list of the targets is kept and the individual symbols tried. As soon as the "All"-functions are changed to proper symbols (as opposed to static inlines in the headers) this hack will be replace with simple calls to the corresponding "LLVMInitializeAll*" functions. Reviewed By: indygreg CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1879 llvm-svn: 194964
* [python-bindings] Added support for getting/setting operands of values and ↵Michael Gottesman2013-09-112-3/+39
| | | | | | | | getting the number of operands of a value. Also in the process did some cleanups for BasicBlock. llvm-svn: 190477
* [python-bindings] Added support for iterating over a basic blocks ↵Michael Gottesman2013-09-112-0/+99
| | | | | | | | instructions, getting their name/dumping them, f/b iteration. Tests are included. llvm-svn: 190475
* [python-bindings] Added support for iterating over a function's basic ↵Michael Gottesman2013-09-112-0/+105
| | | | | | | | blocks, dumping/getting names of those bb, f/w iteration. Tests are included. llvm-svn: 190473
* [python-bindings] Added support for getting a module's functions, iterating ↵Michael Gottesman2013-09-112-0/+101
| | | | | | | | f/b over said functions, dumping/print name of functions. Tests are included as well. llvm-svn: 190471
* [python-bindings] Export OpCode from core.py.Michael Gottesman2013-09-111-0/+1
| | | | llvm-svn: 190468
* [python-bindings] Added test for reading a module from bitcode.Michael Gottesman2013-09-111-0/+15
| | | | llvm-svn: 190467
* [python-bindings] Fixed 3 test failures caused by typos.Michael Gottesman2013-09-112-4/+6
| | | | llvm-svn: 190465
* Fixed typo.Michael Gottesman2013-09-111-3/+3
| | | | llvm-svn: 190459
* [python-bindings] Added code for loading a module from bitcode, getset its ↵Michael Gottesman2013-09-115-0/+128
| | | | | | datalayout, getset its target, dump it, print it to a file. llvm-svn: 190458
* [python-bindings] Added bindings for LLVMContextRef and a test for creating ↵Michael Gottesman2013-09-112-0/+29
| | | | | | a new context or getting the global context. llvm-svn: 190457
* [python-bindings] Implemented the PassRegistry class and the calls to ↵Michael Gottesman2013-09-112-0/+72
| | | | | | initialize/shutdown llvm. Also included an initialize_llvm declaration. llvm-svn: 190456
* [python-bindings] Removed unused import byref from llvm/disassembler.py.Michael Gottesman2013-09-111-1/+0
| | | | llvm-svn: 190455
* [python-bindings] Changed test_memory_buffer_create_from_file to just use ↵Michael Gottesman2013-09-101-1/+1
| | | | | | the generic provided test_file instead of a binary. llvm-svn: 190389
* [python bindings] Added code to get the length of a memory buffer. Tests are ↵Michael Gottesman2013-09-104-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | included. This is a part of a series of patches that have been sitting fallow on a personal branch that I have been messing with for a bit. The patches start to flesh out the python llvm-c wrapper to the point where you can: 1. Load Modules from Bitcode/Dump/Print them. 2. Iterate over Functions from those modules/get their names/dump them. 3. Iterate over the BasicBlocks from said function/get the BB's name/dump it. 4. Iterate over the Instructions in said BasicBlocks/get the instructions name/dump the instruction. My main interest in developing this was to be able to gather statistics about LLVM IR using python scripts to speed up statistical profiling of different IR level transformations (hence the focus on printing/dumping/getting names). This is a gift from me to the LLVM community = ). I am going to be committing the patches slowly over the next bit as I have time to prepare the patches. The overall organization follows the c-api like the bindings that are already implemented. llvm-svn: 190388
* We're in 3.4 land now.Bill Wendling2013-05-071-1/+1
| | | | llvm-svn: 181350
* [python] Add markup option to disassemblerGregory Szorc2012-12-012-1/+23
| | | | | | Patch contributed by Wladimir J. van der Laan <laanwj@gmail.com> llvm-svn: 169102
* [python] fix get_library()Anders Waldenborg2012-11-201-15/+35
| | | | | | | | | | | | | | | | | | | | | Before this fix, the LLVM Python bindings on SVN trunk always fail with: Exception: LLVM shared library not found! since it's still looking for a library named "LLVM-3.1svn". Besides updating the LLVM version in the library name, this patch also changes llvm.get_library() to make it possible to run the unit tests without installing the LLVM shared library into a default linker search path. e.g. after this patch, running the llvm/python unit tests with: LD_LIBRARY_PATH=../build/Debug+Asserts/lib nosetests -v bindings/python/llvm/tests/ would work on Linux. Patch from Scott Tsai (with some minor modifications) Patch also acked by Gregory Szorc llvm-svn: 168390
* [python] Add negative MemoryBuffer testcaseAnders Waldenborg2012-03-221-0/+5
| | | | llvm-svn: 153248
* [python] Add some paths where to find test binaryAnders Waldenborg2012-03-211-0/+2
| | | | | | | Adds /usr/lib/debug early to list, as some systems (debian) have unstripped libs in there Adds /lib/i386-linux-gnu for systems that does multiarch (debian) llvm-svn: 153174
* [python] Mark get_test_binary as not being a testAnders Waldenborg2012-03-211-0/+1
| | | | | | | get_test_binary is a helper method, not a test, make sure nosetests doesn't pick it up as a test. llvm-svn: 153173
* [llvm.py] Implement disassembler interfaceGregory Szorc2012-03-112-0/+162
| | | | | | | It doesn't currently support the op info and symbol lookup callbacks, but it is better than nothing. llvm-svn: 152527
* Revert "[llvm.py] Implement interface to enhanced disassembler"Gregory Szorc2012-03-102-626/+0
| | | | | | | Chris Lattner says the edis interface is going away. It doesn't make sense to land something that will go away in the near future. llvm-svn: 152508
* [llvm.py] Implement interface to enhanced disassemblerGregory Szorc2012-03-102-0/+626
| | | | | | | | | | | This requires a C++ change to EDDisassembler's ctor to function properly (the llvm::InitializeAll* functions aren't being called currently and there is no way to call them from Python). Code is partially tested and works well enough for initial commit. There are probably many small bugs. llvm-svn: 152506
* [llvm.py] Make LLVMObject.__del__ work if called during __init__Gregory Szorc2012-03-101-0/+3
| | | | llvm-svn: 152505
* [llvm.py] Define enumerations from Core.h; add OpCode classGregory Szorc2012-03-103-2/+265
| | | | llvm-svn: 152483
* [llvm.py] Implement interface to object filesGregory Szorc2012-03-1010-144/+620
| | | | | | | It is now possible to load object files and scan over sections, symbols, and relocations! Includes test code with partial coverage. llvm-svn: 152482
* [llvm.py] Make ObjectFile destructor workGregory Szorc2012-03-093-17/+33
| | | | | | Previous code had a double free in MemoryBuffer. The tests now pass. llvm-svn: 152422
* [llvm.py] Initial skeleton for Python LLVM bindingsGregory Szorc2012-03-097-0/+361
This contains a semi-functional skeleton for the implementation of the LLVM bindings for Python. The API for the Object.h interface is roughly designed but not implemented. MemoryBufferRef is implemented and actually appears to work! The ObjectFile unit test fails with a segmentation fault because the LLVM library isn't being properly initialized. The build system doesn't know about this code yet, so no alerts should fire. llvm-svn: 152397
OpenPOWER on IntegriCloud