Git Product home page Git Product logo

llvm-min-caml's Introduction

This is a modern fork of the `llvm-min-camll` project.

My immediate goals are to explore and document this archived project.

Forking this project made me feel like an archeologist, stumbling upon a
long-dormant relic of the past. I have beginner level knowledge of OCAML
and have not yet taken a compilers class. I have never touched LLVM IR.


ALL OF THE INFORMATION BELOW IS FROM THE ORIGINAL `llvm-min-caml` PROJECT


OVERVIEW:

llvm-min-caml is a compiler for a subset of the OCaml programming
language that targets the LLVM intermediate representation. It builds
directly on the work of Eijiro Sumii, Moe Masuko, Kenichi Asai, who
built the min-caml compiler targeting SPARC, PowerPC, and x86 assembly.
Their project (along with documentation) can be found at

            http://min-caml.sourceforge.net/index-e.html

I added a new backend targeting LLVM. Since I have no intention of
mantaining the other backends, I have removed them (along with all other
supporting files) from my distribution.

The current status is full support of all the features of the original
min-caml compiler, as can be found in the above website. In particular,
we perform full tail-call optimization.

OTHER LLVM PORTS:

There are at least two other LLVM ports of min-caml that can be found
through Google, but both fail to correctly perform tail-call optimization
in all cases.

* https://github.com/mzp/min-caml

* https://github.com/kmacy/llmincaml

The second one (llmincaml) failed to produce any LLVM output in fact when
I compiled it. But inspection of the source shows that it does not perform
tail call optimization in the case of an 'If' in tail position.

PREREQUISITES:

* OCaml

I have 4.00.0 in my machine, but it should work with
previous versions as well. I will update this README once
I find out about this. The OCaml distribution can be
downloaded from

      http://caml.inria.fr

* LLVM with Ocaml bindings

I used LLVM version 3.1 but, again, it should work with
earlier versions as well. I will update this README once
I find out about this.

In any case, installing this should be as easy as running

      opam install llvm

BUILDING:

If both the prerequisites are installed and configured
correclty, then follow the steps to build the llvm-min-caml
compiler.

1- Get the source from GitHub

      git clone https://github.com/nojb/llvm-min-caml.git

2- A directory named 'llvm-min-caml' will have been created.
   Move into it.

      cd llvm-min-caml

3- Build the sources.

      ocamlbuild main.native

4- Test the compiler.

I will add a proper test suite in the future, but for now
you can do the following to compile the test test/gcd.ml.

      ./main.native -iter 0 test/gcd

(the flag -iter 0 disables all optimizations so that the output
is easier to read.) This will create a file test/gcd.bc containing
the LLVM bitcode. To actually see it, you can use the llvm-dis utility
from the LLVM distribution.

      llvm-dis < test/gcd.bc

COPYRIGHT:

All the files are copyright 2005, 2006, 2007, 2008, 2013, Eijiro
Sumii, Moe Masuko, Kenichi Asai, Nicolas Ojeda Bar, and distributed
under the conditions stated in the file LICENCE.

BUG REPORTS AND USER FEEDBACK:

Please report bugs and any user feedback directly to me at

                [email protected].

CHANGELOG FOR PRE-LLVM VERSIONS:

[Update on July 24, 2012]

- 32-bit x86 (with SSE2, that is, Pentium IV or later) is now
  supported (on Linux and Cygwin); execute ./to_x86 before make.

[Updates on September 17, 2008]

- PowerPC is now supported (in addition to SPARC), thanks to
  Ms. Masuko and Prof. Asai in Ochanomizu University.  You _must_
  execute either ./to_ppc or ./to_sparc _before_ make.

- The register allocator now uses a simpler algorithm.  It omits the
  backtracking (ToSpill and NoSpill) in previous versions.

llvm-min-caml's People

Contributors

rudyb2001 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.