#llvm #assembly #compiler #machine-code

sys hllvm-sys

FFI wrapper around the LLVM C++ library

4 releases

Uses old Rust 2015

0.1.3 Jul 2, 2017
0.1.2 Jun 25, 2017
0.1.1 Dec 21, 2016
0.1.0 Dec 20, 2016

#123 in #llvm

Used in hllvm

MIT license


LLVM C FFI library



The project attempts to closely follow the LLVM C++ header structure.

If there is an upstream llvm/IR/Value.h header, we will define the following files here:

  • ir/value.cpp - The actual FFI function definitions.
  • ir/value.rs - FFI declarations for that file.

Each .cpp file should have an associated .rs file.

All FFI functions declared in Rust should be glob imported into the crate root.


All functions will be prefixed with LLVMRust and will be exported as functions with the C ABI and no name mangling.

Constructor/destructor functions

These should be named like LLVMRustCreate<ClassName> or LLVMRustDestroy<ClassName>.


  • LLVMRustCreateContext
  • LLVMRustDestroyContext
  • LLVMRustCreateValue

Methods and static functions

If we have a get function on Value, the FFI function should look like


Static functions are not capitalized differently than standard methods.

Overloaded functions

When there is an overloaded method, and the additional overloads are solely for convienence, only implement the most general method.


~120K SLoC