blob: c48e85561cf48669245f024a5c2afd64446eddac [file] [log] [blame]
Peter Collingbournead9841e2014-11-27 00:06:421llgo
2====
3
4llgo is a Go (http://golang.org) frontend for LLVM, written in Go.
5
6llgo is under active development. It compiles and passes most of the
7standard library test suite and a substantial portion of the gc test suite,
8but there are some corner cases that are known not to be handled correctly
9yet. Nevertheless it can compile modestly substantial programs (including
10itself; it is self hosting on x86-64 Linux).
11
12Mailing list: https://groups.google.com/d/forum/llgo-dev
13
14Supported platforms
15-------------------
16
17llgo is currently only supported on the x86-64 Linux platform. Contributions
18that add support for other platforms are welcome.
19
20There are two components which would need to be ported to new platforms: the
21compiler and the runtime library. The compiler has little platform-specific
22code; the most significant is in irgen/cabi.go. The main limiting factor
23for new platforms is the runtime library in third_party/gofrontend/libgo,
24which inherits some support for other platforms from the gc compiler's
25runtime library, but this support tends to be incomplete.
26
27Installation
28------------
29
30llgo requires:
31* Go 1.3 or later.
32* CMake 2.8.8 or later (to build LLVM).
33* A modern C++ toolchain (to build LLVM).
34 http://llvm.org/docs/GettingStarted.html#getting-a-modern-host-c-toolchain
35
36Note that Ubuntu Precise is one Linux distribution which does not package
37a sufficiently new CMake or C++ toolchain.
38
39To build and install llgo:
40
James Y Knight5d71fc52019-01-29 16:37:2741 # Checkout llvm project.
42 git clone https://github.com/llvm/llvm-project.git
Peter Collingbournead9841e2014-11-27 00:06:4243
44 # Build LLVM, Clang and llgo: (see also http://llvm.org/docs/CMake.html)
James Y Knight5d71fc52019-01-29 16:37:2745 cd llvm-project
46 mkdir build
47 cd build
48 cmake ../llvm -DLLVM_ENABLE_PROJECTS='clang;llgo' -DCMAKE_INSTALL_PREFIX=/path/to/llvm-inst
Peter Collingbournead9841e2014-11-27 00:06:4249 make install
50
51Running
52-------
53
Peter Collingbourne76beae32015-04-05 23:32:1354llgo-go is llgo's version of the "go" command. It has the same command line
55interface as go, and works the same way, but it uses llgo to compile.
56
57llgoi is an interactive REPL for Go. It supports expressions, statements, most
58declarations and imports, including binary imports from the standard library
59and source imports from $GOPATH. See docs/llgoi.rst for more information.
60
Peter Collingbournead9841e2014-11-27 00:06:4261llgo is the compiler binary. It has a command line interface that is intended
Peter Collingbourne76beae32015-04-05 23:32:1362to be compatible to a large extent with gccgo.
Peter Collingbournead9841e2014-11-27 00:06:4263
64Contributing
65------------
66
67Changes to code outside the third_party directory should be contributed in
Tanya Lattner449fa2f2015-08-05 04:03:0568the normal way by sending patches to <[email protected]>.
Peter Collingbournead9841e2014-11-27 00:06:4269
70Changes to code in the third_party directory must first be made in the
71respective upstream project, from which they will be mirrored into the llgo
72repository. See the script update_third_party.sh for the locations of the
73upstream projects and details of how the mirroring works.
Chandler Carruthce7d8762015-01-07 21:28:1074