Re:Bitey: Import LLVM bitcode directly into Python
by zoobert on Friday August 10, 2012 @03:49AM
(#4365313)
It seems cool but why would you use it instead of having a c lib (or c obj file) interfaced with ctypes or swig ... ? Maybe I miss what LLVM brings ?
Thanks
[ Parent
| on HN ]
Re:Bitey: Import LLVM bitcode directly into Python
by wzdd on Friday August 10, 2012 @08:04AM
(#4365803)
I addition to cdavid's comment: LLVM IR is system independent. So if you had a deployment over heterogeneous machines you could write the extension code once and have it run everywhere without recompilation.
Re:Bitey: Import LLVM bitcode directly into Python
by horsetail on Friday August 10, 2012 @12:10PM
(#4366781)
LLVM IR is not system independent.
http://llvm.org/docs/FAQ.html#can-i-compile-c-or-c-code-to-p...
Re:Bitey: Import LLVM bitcode directly into Python
by wzdd on Friday August 10, 2012 @01:11PM
(#4367115)
Fair enough, that was too strong a claim. But it is more portable than an extension module compiled with the system compiler.
Re:Bitey: Import LLVM bitcode directly into Python
by tungstentim on Friday August 10, 2012 @02:00PM
(#4367354)
It's not portable enough to let me take IR generated for my x86 laptop and run it on my arm board, in general, even though both platforms are ILP32, little-endian, and running the same OS.
Re:Bitey: Import LLVM bitcode directly into Python
by wzdd on Saturday August 11, 2012 @10:47AM
(#4370187)
Yes, but this is a problem with the source language and/or the host system libraries, not with LLVM IR itself. There is a broad domain of applications for which it is portable.
Re:Bitey: Import LLVM bitcode directly into Python
by radarsat1 on Friday August 10, 2012 @09:26AM
(#4366032)
I was confused about this too, but I think the idea is that it's easier to infer type information from the bitcode than from raw object code.
Re:Bitey: Import LLVM bitcode directly into Python
by jnazario on Friday August 10, 2012 @09:35AM
(#4366058)
more closely related to ctypes than swig.
swig requires glue code (.i files) to be written and generated, then compiled. ctypes can take a system native library (.so or .dll) and access it.
bitey, on the other hand, uses platform-neutral llvm bytecode. imagine ctypes but platform neutral. that's bitey.
pretty darned cool.