News for hackers. Stuff that matters.
Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by bmh100 on Friday December 16, 2016 @09:26PM (#13198797)
Please forgive my ignorance, but how would this be useful? I am not familiar with compilers or what having bindings in Python to a compiler would help.
Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by thomaslee on Friday December 16, 2016 @09:32PM (#13198817)
You could, for example, write a compiler in Python that generated native code (or LLVM bitcode to be passed to llc or whatever) via the LLVM API. Writing a compiler in Python vs. C/C++ would be a lot easier in a number of ways.

I'm not aware of any "production grade" compilers that do this, but no hard reason why not, I guess. Seems like it'd be nice for prototyping etc. if nothing else.

Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by grej on Friday December 16, 2016 @10:50PM (#13199074)
Check out numba. It does this for a subset of Python.
Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by Tempest1981 on Friday December 16, 2016 @10:50PM (#13199073)
More on what Thomas said:

http://www.llvmpy.org/

Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by bootload on Saturday December 17, 2016 @12:14AM (#13199351)
"This project has been deprecated and is no longer being actively developed. We strongly suggest migrating to llvmlite. "

try http://llvmlite.pydata.org/en/latest/ explanation why http://llvmlite.pydata.org/en/latest/intro/index.html

Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by bmh100 on Saturday December 17, 2016 @02:11AM (#13199704)
So could I use this to conveniently optimize frequently called or inner loop functions?
Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by m_mueller on Saturday December 17, 2016 @06:49AM (#13200331)
Want to make an obscure (your own?) language faster or extend it for your usecase? Write a frontend in python and let llvm do the hard parts.
Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by exDM69 on Saturday December 17, 2016 @10:11AM (#13200967)
Two big use cases are building your own compiler in Python and doing some JIT compilation (E.g. regex matcher or similar) to gain some perf.

LLVM is fantastic but not everyone wants or can use C++ in their project.

I've been doing prototype compilers in Haskell, but Python might also be a nice choice.

Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by yjftsjthsd-h on Friday December 16, 2016 @10:27PM (#13199015)
Didn't see in the readme: why "final"? I could see it being considered complete or failed, but it's unclear.
Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by connerbryan on Friday December 16, 2016 @11:45PM (#13199257)
I believe it's because llvmlite is now suggested.

The llvmpy page mentions:

> Warning

> This project has been deprecated and is no longer being actively developed. We strongly suggest migrating to llvmlite.

http://llvmlite.pydata.org/en/latest/

Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by jholman on Saturday December 17, 2016 @05:14AM (#13200072)
Why is this relevant? Are llvmpy and llvmcpy related?
Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by connerbryan on Saturday December 17, 2016 @03:34PM (#13202388)
Oh, my bad. You're right, I got my links mixed up.

aleclm has responded with the correct answer, ignore mine.

Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by aleclm on Saturday December 17, 2016 @12:56AM (#13199492)
Final in the sense that hopefully we won't need a fourth one. It should provide the best performance (since the IR is not re-encoded in Python) and I've tried to make it flexible and future proof. llvmlite currently only supports LLVM 3.8, while I quickly tested llvmcpy with 3.4, 3.8 and 3.9 and works flawlessly.

Still quite alpha, though.

Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by witty_username on Saturday December 17, 2016 @01:19AM (#13199563)
How does this compare to llvmlite?

Is this going to support a larger portion of the LLVM API?

Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by eliben on Saturday December 17, 2016 @08:30AM (#13200630)
It looks to be a less complete solution, since it only relies on the LLVM C API which is incomplete. llvmlite digs into the C++ API as well, so while it has more work to do to keep up with changes in LLVM, it's more more feature-complete
Re:Llvmcpy – Python bindings for LLVM auto-generated from th... by aleclm on Saturday December 17, 2016 @11:54AM (#13201331)
The LLVM-C API is quite powerful, and I'm planning to upstream some patch to expose additional stuff. On the other hand, llvmlite doesn't even parse existing IR, it's basically write-only. Plus, representing the IR in Python makes it less memory efficient than using the native representation.