Skip to content

percontation/ocaml_of_llvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project is a transpiler from LLVM bitcode to OCaml source code (not from OCaml to LLVM). This is largely useless, but pretty amusing.

It exists because I wanted to try to use js_of_ocaml on an project with a non-trivial dependency on a C library. By 'compiling' the C library to OCaml and modifying the project to use that, I'd be able to turn the project into a 'pure' OCaml project. This currently should work for small-ish C libraries.

The included scripts "build" an example binary from Intel's XED in this manner.

There's still missing llvm opcodes, and I/O is mostly unimplemented, and there's probably lots of bugs. But, the XED example binary works (at least for me; if your clang generates different bitcode, then it may contain an unimplemented/buggy opcode).

Requirements

Works with LLVM 8; will almost certainly have minor issues with other versions of the IR.

Works with OCaml 4.08.0; it should work with older versions if you deal with the renamed standard library functions.

About

LLVM to OCaml transpiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors