Commit Graph

17 Commits

Author SHA1 Message Date
Michael Gottesman
ea06d9762c [python-bindings] Remove some cruft that snuck in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201966 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-23 04:43:26 +00:00
Michael Gottesman
0ee9a84cac [python-bindings] Added OpCode like support for all enumerations with unittests.
Also fixed some trailing whitespace issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201929 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-22 05:39:35 +00:00
Michael Gottesman
abaa85d88d [python-bindings] Added support for getting/setting operands of values and getting the number of operands of a value.
Also in the process did some cleanups for BasicBlock.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190477 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 01:38:12 +00:00
Michael Gottesman
73c382f7fd [python-bindings] Added support for iterating over a basic blocks instructions, getting their name/dumping them, f/b iteration.
Tests are included.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190475 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 01:17:38 +00:00
Michael Gottesman
e23fa984f5 [python-bindings] Added support for iterating over a function's basic blocks, dumping/getting names of those bb, f/w iteration.
Tests are included.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190473 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 01:01:40 +00:00
Michael Gottesman
7dfa4bc471 [python-bindings] Added support for getting a module's functions, iterating f/b over said functions, dumping/print name of functions.
Tests are included as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190471 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 00:52:47 +00:00
Michael Gottesman
f532d44830 [python-bindings] Export OpCode from core.py.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190468 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 00:41:07 +00:00
Michael Gottesman
7400a858be [python-bindings] Fixed 3 test failures caused by typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190465 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 00:41:02 +00:00
Michael Gottesman
f495a26792 Fixed typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190459 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 00:27:23 +00:00
Michael Gottesman
37a8807323 [python-bindings] Added code for loading a module from bitcode, getset its datalayout, getset its target, dump it, print it to a file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190458 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 00:23:14 +00:00
Michael Gottesman
6a63cd1281 [python-bindings] Added bindings for LLVMContextRef and a test for creating a new context or getting the global context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190457 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 00:23:10 +00:00
Michael Gottesman
8184ca673b [python-bindings] Implemented the PassRegistry class and the calls to initialize/shutdown llvm. Also included an initialize_llvm declaration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190456 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11 00:23:08 +00:00
Michael Gottesman
653212fdd1 [python bindings] Added code to get the length of a memory buffer. Tests are 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190388 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-10 06:57:57 +00:00
Gregory Szorc
b7487d4edc [llvm.py] Define enumerations from Core.h; add OpCode class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152483 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 05:50:56 +00:00
Gregory Szorc
61e22cd85c [llvm.py] Implement interface to object files
It is now possible to load object files and scan over sections, symbols,
and relocations! Includes test code with partial coverage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152482 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 04:41:24 +00:00
Gregory Szorc
07c32218f4 [llvm.py] Make ObjectFile destructor work
Previous code had a double free in MemoryBuffer. The tests now pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152422 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 18:56:33 +00:00
Gregory Szorc
5ae04279e0 [llvm.py] Initial skeleton for Python LLVM bindings
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152397 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 09:07:35 +00:00