Python-LLVM bindings updated

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Python-LLVM bindings updated

js.nospam
Hi,

I've updated the Python LLVM bindings for LLVM 1.5 (attached).  I also
thought of setting up a CVS repository for this, but before I do that
I thought I'd ask if you want to take the Python bindings to the main
LLVM CVS?  I noticed that the C language bindings would be maintained
there.

Changes in Python-LLVM:
- Updated to match LLVM 1.5 API
- Added Windows build support (created MSVC++ project file)
- Added bindings for LLVM Transforms API

Systems built on:
- Linux 2.6.10 i686 (GCC 3.3.5)
- Windows XP Home SP2 (MSVC++ 7.1)

As before, you'll need Boost.Python and Python to build the bindings.
If you're interested, a previous version of the Python bindings was
also sent to llvm-dev:
http://mail.cs.uiuc.edu/pipermail/llvmdev/2005-February/003463.html

Cheers, Jarno

--
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse für Mail, Message, More +++

Python-LLVM.tgz (60K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Python-LLVM bindings updated

Reid Spencer
Hi Jarno,

This is great! We would absolutely love to have python bindings for
LLVM.

From the look of your patch, I think we want this to become an LLVM
project since it has configuration and compiler support that is new to
the main LLVM repository. We don't want the main LLVM libraries to be
dependent on Boost or Python.  So, there's a couple things we need to
have you do before this patch is accepted.

1. Please place it in a directory named something like "llvm-py", not
   in "lib"
2. Make this "llvm-py" directory look like an llvm project. You can
   find a sample project at llvm/projects/sample and a more full
   blown example in llvm/projects/Stacker. Please also make sure you  
   read http://llvm.cs.uiuc.edu/docs/Projects.html which will help you
   set up a project. You might also find the Projects section
   of http://llvm.cs.uiuc.edu/docs/MakefileGuide.html useful.
3. Fix your Makefile to build a shared library properly. You have set
   TOOLNAME which is for building an executable tool not a shared
   library. You need to set LIBRARYNAME=..., not TOOLNAME=...
4. Fix the name of your project. It currently builds "llvm.so" which
   is not correct by our naming standards. It should result to something
   like "libLLVMpy.so" which will be obtained if you set LIBRARYNAME
   to "LLVMpy"
5. Consider waiting for or modifying this python interface latter to
   either directly use the (forthcoming) C interface or design the
   interface to have a similar structure and naming convention.
6. I looked (briefly) for a test suite but didn't find much. Could
   you please create a "test" directory that mimics the LLVM test
   directory so that "make check" will test out a few python programs
   that use the python interface to build working LLVM code.
7. Please submit gzipped, tar'd files with a ".tgz" suffix so that
   tar and gunzip can work on them without having to modify the
   file name (yes, this is a nit!)

Once you've got the above accomplished, we can create a repository for
the python interface and (with Oversight Group approval) give you cvs
write access to it. That will allow you to make changes and maintain the
python interface as LLVM grows without significant difficulty or burden.

We look forward to adding Python to LLVM!

Rei

On Sun, 2005-05-22 at 11:45 +0200, [hidden email] wrote:

> Hi,
>
> I've updated the Python LLVM bindings for LLVM 1.5 (attached).  I also
> thought of setting up a CVS repository for this, but before I do that
> I thought I'd ask if you want to take the Python bindings to the main
> LLVM CVS?  I noticed that the C language bindings would be maintained
> there.
>
> Changes in Python-LLVM:
> - Updated to match LLVM 1.5 API
> - Added Windows build support (created MSVC++ project file)
> - Added bindings for LLVM Transforms API
>
> Systems built on:
> - Linux 2.6.10 i686 (GCC 3.3.5)
> - Windows XP Home SP2 (MSVC++ 7.1)
>
> As before, you'll need Boost.Python and Python to build the bindings.
> If you're interested, a previous version of the Python bindings was
> also sent to llvm-dev:
> http://mail.cs.uiuc.edu/pipermail/llvmdev/2005-February/003463.html
>
> Cheers, Jarno
>
> --
> 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
> +++ GMX - die erste Adresse fr Mail, Message, More +++
> _______________________________________________ LLVM Developers mailing list [hidden email] http://llvm.cs.uiuc.edu http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Python-LLVM bindings updated

js.nospam
Hi,

some discussion below.

Reid wrote:

> 3. Fix your Makefile to build a shared library properly. You have set
>    TOOLNAME which is for building an executable tool not a shared
>    library. You need to set LIBRARYNAME=..., not TOOLNAME=...

I remember having failed to build a functioning Python extension module with
LIBRARYNAME and SHARED_LIBRARY flags.  Anyway, I cannot remember the details
now so will try again.

> 4. Fix the name of your project. It currently builds "llvm.so" which
>    is not correct by our naming standards. It should result to something
>    like "libLLVMpy.so" which will be obtained if you set LIBRARYNAME
>    to "LLVMpy"

I'd like to challenge the usefulness of the naming standard here.  I see its
value in case of system-wide C/C++ libraries (going to /usr/lib/*), but the
Python modules go into a Python-specific directory
(/usr/lib/python2.4/site-packages/*), so the name must be unique within
Python extensions only.

> 5. Consider waiting for or modifying this python interface latter to
>    either directly use the (forthcoming) C interface or design the
>    interface to have a similar structure and naming convention.

The Python interface represents the C++ interface, so I don't understand the
motivation to use C in the middle?  In my view the Python and C bindings are
independent of each other.

> Once you've got the above accomplished, we can create a repository for
> the python interface and (with Oversight Group approval) give you cvs
> write access to it. That will allow you to make changes and maintain the
> python interface as LLVM grows without significant difficulty or burden.

OK, so I'll get back when I have news about the directory and Makefile
restructuring.

Regards,
Jarno


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

RE: Python-LLVM bindings updated

Reid Spencer
On Mon, 2005-05-23 at 22:18 +0300, Jarno Seppänen wrote:

> Hi,
>
> some discussion below.
>
> Reid wrote:
>
> > 3. Fix your Makefile to build a shared library properly. You have set
> >    TOOLNAME which is for building an executable tool not a shared
> >    library. You need to set LIBRARYNAME=..., not TOOLNAME=...
>
> I remember having failed to build a functioning Python extension module with
> LIBRARYNAME and SHARED_LIBRARY flags.  Anyway, I cannot remember the details
> now so will try again.
Okay. Let me know if you run into any further challenges. This should be
pretty straight forward.

>
> > 4. Fix the name of your project. It currently builds "llvm.so" which
> >    is not correct by our naming standards. It should result to something
> >    like "libLLVMpy.so" which will be obtained if you set LIBRARYNAME
> >    to "LLVMpy"
>
> I'd like to challenge the usefulness of the naming standard here.  I see its
> value in case of system-wide C/C++ libraries (going to /usr/lib/*), but the
> Python modules go into a Python-specific directory
> (/usr/lib/python2.4/site-packages/*), so the name must be unique within
> Python extensions only.
Okay, that makes sense. However, you will have bypass the LLVM Makefile
system to do this. I.e. if you use LIBRARYNAME and SHARED_LIBRARY
keywords in your makefile then the name *must* follow our standards
because it *will* get installed to a place where naming conflicts must
be avoided. So, you need to, at the very least, override the rules for
installing llvm.so into the python packages directory. Your
configuration script should also automate the finding of the python
packages directory and also have a --with-python-packages=... option so
the user can override where these files are placed. Let me know if you
need help with setting that up.

>
> > 5. Consider waiting for or modifying this python interface latter to
> >    either directly use the (forthcoming) C interface or design the
> >    interface to have a similar structure and naming convention.
>
> The Python interface represents the C++ interface, so I don't understand the
> motivation to use C in the middle?  In my view the Python and C bindings are
> independent of each other.

Okay, my mistake .. guess I didn't look at the patch closely enough. If
you're creating a 1-to-1 mappings between the LLVM core IR classes
(Module, Function, BasicBlock, Instruction, etc), then you're doing the
right thing and should ignore the C interface.
>
> > Once you've got the above accomplished, we can create a repository for
> > the python interface and (with Oversight Group approval) give you cvs
> > write access to it. That will allow you to make changes and maintain the
> > python interface as LLVM grows without significant difficulty or burden.
>
> OK, so I'll get back when I have news about the directory and Makefile
> restructuring.

Great! We look forward to adding this to the llvm repository. I'm sure
others will find it very useful to start programming with LLVM via
Python!

One final note: please be aware that our current policy for submissions
such as this is that you must acknowledge (an email is fine) assignment
of copyright to the University of Illinois at Urbana Champaign and that
the code is licensed under the U of I license. For details, see
http://llvm.cs.uiuc.edu/releases/1.5/LICENSE.TXT. The license is OSI
approved and similar to a 3-clause BSD license. I.e., it basically says
anyone can use the software as long as they retain the copyright notice,
reproduce that notice it in binaries, and don't use anyone's name in
conjunction with a product.

Regardless of copyright and license, your submission will always be
attributed to you in our CREDITS.TXT file and elsewhere.

Best Regards,

Reid.

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Python-LLVM bindings updated

Paolo Invernizzi
In reply to this post by js.nospam
Hi all,

There's a place where I can find an updated version of the bindings  
versus the actual CVS?
There's a CVS store for them?

I cannot contact Jarno (wrong mail address...)

Thanks in advance!

---
Paolo


On May 22, 2005, at 11:45 AM, [hidden email] wrote:

> Hi,
>
> I've updated the Python LLVM bindings for LLVM 1.5 (attached).


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Python-LLVM bindings updated

Chris Lattner
On Thu, 4 Aug 2005, Paolo Invernizzi wrote:
> There's a place where I can find an updated version of the bindings versus
> the actual CVS?
> There's a CVS store for them?
> I cannot contact Jarno (wrong mail address...)

I don't know what the status of the bindings are.  Unfortunately, I never
got a chance to play with them. :(

-Chris

> On May 22, 2005, at 11:45 AM, [hidden email] wrote:
>
>> Hi,
>>
>> I've updated the Python LLVM bindings for LLVM 1.5 (attached).
>
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-Chris

--
http://nondot.org/sabre/
http://llvm.org/

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev