~cypheon/rapid

LLVM Backend and Native Runtime for Idris2
d2dae0ad — Johann Rudloff 9 hours ago
Add support for AArch64
ad00cba8 — Johann Rudloff 9 hours ago
Better handling of strerror_r errors
c8da1d49 — Johann Rudloff 10 hours ago
Define more compatible _DEFAULT_SOURCE as feature test macro

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~cypheon/rapid
read/write
git@git.sr.ht:~cypheon/rapid

You can also use your local clone with git send-email.

builds.sr.ht status builds.sr.ht status

#LLVM codegen and native runtime for Idris 2

This is a backend to generate native executables from Idris code, machine code is generated via LLVM IR. Rapid is still in active development , but can already compile itself successfully (and reproducibly).

The source folder rts/ contains the runtime system with a relocating generational garbage collector.

#Prerequisites

LLVM 16 needs to be installed and the binaries available in your $PATH. To check if that is the case, try the following command:

$ opt --version
Debian LLVM version 16.0.6
  Optimized build.
  Default target: x86_64-pc-linux-gnu
  Host CPU: znver2

GMP needs to be installed (libgmp-dev on Debian).

You need CMake (>= 3.20) and Ninja, building with make is not supported.

For details regarding build time dependencies, please check the CI scripts in .builds/cmake.yml.

#Compilation

Compile:

cmake -G Ninja .
ninja

Run tests:

ninja test

#Usage

The "support files" (precompiled platform code and runtime system) need to be available in a directory in the $IDRIS2_DATA path. You can achieve that by running (from within the source dir):

export IDRIS2_DATA=$PWD/build/support:$PWD/support

Then you can compile the included "Hello world" example:

./build/rapidc/exec/rapidc -o hello samples/Hello.idr

And run the compiled binary:

./build/exec/hello

#Limitations

Differences from the default Chez Scheme backend:

  • Int width is 63-bits instead of 64-bits

Currently not implemented:

  • Generic FFI (the FFI functions from prelude and base are hardcoded & handwritten specifically for the RTS)
  • Concurrency
  • Network primitives are stubbed and not functional
  • Some other support functions are still missing