Rust bindings for LLVM-CBE
(HALTED)
LLVM-CBE
is a C-backend for LLVM
, i.e. a tool that turns LLVM bitcode 1 into C.
LLVM-CBE
requires to be built near LLVM, which was found to be so heavy dependency that shipping it as Cargo crate would be absurd.
The goal that the authors had in mind was combining LLVM-CBE
with SWIG
for the purpose of facilitation cross-language code reuse. SWIG
is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages: (1) C# (Mono and MS .NET), (2) D, (3) Go, (4) Guile, (5) Java, (6) JavaScript (Node.js, V8, and WebKit), (7) Lua, (8) MzScheme/Racket, (9) OCaml, (10) Octave, (11) Perl, (12) PHP, (13) Python, (14) R, (15) Ruby, (16) Scilab, and (17) Tcl/Tk. For every of the earlier mentioned target languages, SWIG
can generate wrappers around C libraries that were planned to be generated by LLVM-CBE
.
Generation of these libraries-wrappers from LLVM bitcode would be possible for all programming languages whose build tools offer LLVM IR generation: (1) Rust, (2) ActionScript, (3) Ada, (4) C#, (5) Common Lisp, (6) PicoLisp, (7) Crystal, (8) CUDA, (9) D, (10) Delphi, (11) Dylan, (12) Forth, (13) Fortran, (14) Free Basic, (15) Free Pascal, (16) Graphical G, (17) Halide, (18) Haskell, (19) Java bytecode, (20) Julia, (21) Kotlin, (22) Lua, (23) Objective-C, (24) OpenCL, (25) PostreSQL and PLpgSQL, (26) Ruby, (27) Scala, (28) Swift, (29) XC, (30) Xojo, and (31) Zig.2
At the time of writing, rustc
- the standard compiler for the Rust programming language - relies on LLVM compiler infrastructure for machine code generation and optimization. For that, rustc
internally, after transforming the Rust source code through a series of other Intermediate Representations (IRs), eventually produces so-called LLVM IR that then gets handled by LLVM infrastructure. You can learn more about LLVM IR and LLVM Bitcode File Format here.
Thus, this combination when applied for Rust would be not just on par with cbindgen
but would also be considerably better.
- Q: What does
*-sys
mean? A:*-sys
is a naming convention for crates that help Rust programs useC
("system") libraries, e.g.libz-sys
,kernel32-sys
,lcms2-sys
.3
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Footnotes
-
There is no typo. Bitcode, as the maintainers admit, sometimes indeed is anachronistically called bytecode. ↩