We 've been working on an LLVM backend for High Performance Erlang (HiPE) ,
the native code compiler of Erlang/OTP . ErLLVM  targets the X86 and AMD64
architectures for now but there is some ongoing work from a team on the Uppsala
University to also support ARM. In our implementation, we have paid special
attention on retaining ABI-compatibility with the Erlang Runtime System in order
to support loading both HiPE- and ErLLVM-generated code at the same time.
Currently, our work is supported by the Erlang/OTP team and it has reached a
complete and robust state. Thus, we would like to submit some patches to the
LLVM project to support our work on ErLLVM.
Our patches (applied on current Git ToT as of: "5e5c5f8 Rename 'fpaccuracy'
metadata to the more generic 'fpmath'...") involve:
1) A new calling convention (& register pinning as explained in ).
2) A pass to add custom prologue when needed (that performs a stack check and
inserts a call to a BIF, named "inc_stack_0", from the HiPE Runtime to increase
the available stack of a function frame).
3) A GC plugin to support precise Garbage Collection (with the problems
explained in a previous mail ).
The commit messages and the comments in the code should explain a lot; however,
feel free to ask anything that doesn't make any sense for you!
We 're looking forward to any feedback for the above patches as we would love to
get this included in LLVM so that we don't need to carry around our own version
of LLVM. We are aware that some of the patches might not adhere to the "LLVM
way" of handling things or even include some coding style violations. As Tom
Stellard indicated in his R600 mail too, we didn't want to spend a lot of time
on coding style changes prior to the initial review in case big changes to the
code are needed.
The ErLLVM team
: High-Performance Erlang