[LLVMdev] RFC: ErLLVM - An LLVM backend for Erlang

Yiannis Tsiouris gtsiour at softlab.ntua.gr
Tue Apr 24 06:29:38 PDT 2012


Hi,

Following Chris' advice, I will rebase the patches and break them in 3 distinct
emails (one at a time) in order to be easier for a reviewer to
approve/comments. Please note that the three patches while being code-wise
independent, they 're strongly-connected *semantically*, meaning that including
just a subset of these patches to LLVM's code base is quite weak if the others
are not included also.


Best regards,
Yiannis Tsiouris (as part of the ErLLVM team)

On Sat, Apr 14, 2012 at 11:49:41PM +0300, Yiannis Tsiouris wrote:
> Hi,
>
> We 've been working on an LLVM backend for High Performance Erlang (HiPE) [1],
> the native code compiler of Erlang/OTP [2]. ErLLVM [3] 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 [4]).
>
> Touches:
> - include/llvm/CallingConv.h
> - lib/Target/X86/X86CallingConv.td
> - lib/Target/X86/X86ISelLowering.cpp
> - lib/Target/X86/X86RegisterInfo.cpp
> &&
> - lib/Target/X86/X86RegisterInfo.td
>
> 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).
>
> Touches/Adds:
> - include/llvm/Target/TargetOptions.h
> - tools/llc/llc.cpp
> &&
> - include/llvm/Erlang.h
> - include/llvm/Target/TargetFrameLowering.h
> - lib/CodeGen/PrologEpilogInserter.cpp
> - lib/Target/X86/X86FrameLowering.cpp
> - lib/Target/X86/X86FrameLowering.h
>
> 3) A GC plugin to support precise Garbage Collection (with the problems
> explained in a previous mail [5]).
>
> Touches/Adds:
> - include/llvm/ErlangGC/ErlangGCPrinter.h
> - lib/ErlangGC/ErlangGC.cpp
> - lib/ErlangGC/ErlangGCPrinter.cpp
> - lib/ErlangGC/Makefile
> - lib/Makefile
>
> 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.
>
> Best regards,
> The ErLLVM team
>
> [1]: http://www.it.uu.se/research/group/hipe
> [2]: http://www.erlang.org
> [3]: http://erllvm.softlab.ntua.gr
> [4]: http://nondot.org/sabre/LLVMNotes/GlobalRegisterVariables.txt
> [5]: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-April/048685.html

--
Yiannis Tsiouris
Ph.D. student,
Software Engineering Laboratory,
National Technical University of Athens
WWW: http://www.softlab.ntua.gr/~gtsiour



More information about the llvm-dev mailing list