https://github.com/matthewelse/llambda
LLVM backend for OCaml
https://github.com/matthewelse/llambda
Last synced: about 2 months ago
JSON representation
LLVM backend for OCaml
- Host: GitHub
- URL: https://github.com/matthewelse/llambda
- Owner: matthewelse
- Created: 2021-02-07T15:17:33.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-10T19:18:29.000Z (over 5 years ago)
- Last Synced: 2025-01-27T11:49:45.601Z (over 1 year ago)
- Language: OCaml
- Size: 548 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Llambda: An LLVM backend for OCaml
This is a crazy (and unimaginative) experiment to build an LLVM backend for
OCaml. It is intended to be correct enough to satisfy my need to see the right
numbers printed to standard output. It is (probably very) buggy and certainly
doesn't generate great code.
Big hairy audacious goal: interop with the existing flambda/lambda OCaml
compilers for optimising straight-line memory-access-intensive code that could
benefit from LLVM's peephole optimisations, as well as things like vector
instructions where possible.
## Building LLVM & OCaml bindings
This is tested on macos and Linux, with OCaml 4.11.1 with and without flambda.
You may need `-DBUILD_SHARED_LIBS=On` if you don't have enough RAM to statically
link libLLVM.
### Build LLVM:
```bash
cd external/llvm/llvm-project
mkdir build
cd build
cmake -G Ninja -DLLVM_ENABLE_PROJECTS='' -DCMAKE_BUILD_TYPE=Debug \
-DLLVM_ENABLE_ASSERTIONS=On -DLLVM_TARGETS_TO_BUILD="X86" ../llvm
ninja # this is a good time to go and get some lunch
```
### Set up bindings
```bash
cd external/llvm
./setup.sh
dune build
```