~cypheon/rapid

LLVM Backend and Native Runtime for Idris2
3b698363 — Johann Rudloff 4 days ago
Directly generate object files instead of going through assembly
703dc8d3 — Johann Rudloff 5 days ago
Fix missed CONSTCASE recursion when traversing VMDef to find all `Name`s
0906a2be — Johann Rudloff 5 days ago
Remove compile-time dependency of RTS on BDW GC header

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 (work in progress) backend to generate native executables from Idris code, using the LLVM compiler infrastructure. Code is generated via LLVM IR.

The source folder rts/ contains a primitive runtime system with a relocating semi-space garbage collector.

#Prerequisites

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

$ opt --version
LLVM (http://llvm.org/):
  LLVM version 11.1.0

  Optimized build.
  Default target: x86_64-pc-linux-gnu
  Host CPU: znver2

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

#Compiling

$ make
$ make test

#Using

# compile the included "Hello world" example
./build/exec/rapidc --cg llvm -o hello samples/Hello.idr
# run the compiled binary
./build/exec/hello

#Limitations

Differences from mainline Idris 2:

  • Int is 63-bits only and overflow is handled differently

Currently not implemented:

  • Unicode Strings (strings containing codepoints > U+007F will be garbled, lengths and offsets will be incorrect)
  • FFI (the FFI functions from prelude and base are hardcoded & handwritten specifically for the RTS)
  • Concurrency
  • Network primitives are stubbed and not functional
  • Some support functions are completely missing