llvm-capstone/llgo
James Y Knight c0e6b8ac3a IR: Support parsing numeric block ids, and emit them in textual output.
Just as as llvm IR supports explicitly specifying numeric value ids
for instructions, and emits them by default in textual output, now do
the same for blocks.

This is a slightly incompatible change in the textual IR format.

Previously, llvm would parse numeric labels as string names. E.g.
  define void @f() {
    br label %"55"
  55:
    ret void
  }
defined a label *named* "55", even without needing to be quoted, while
the reference required quoting. Now, if you intend a block label which
looks like a value number to be a name, you must quote it in the
definition too (e.g. `"55":`).

Previously, llvm would print nameless blocks only as a comment, and
would omit it if there was no predecessor. This could cause confusion
for readers of the IR, just as unnamed instructions did prior to the
addition of "%5 = " syntax, back in 2008 (PR2480).

Now, it will always print a label for an unnamed block, with the
exception of the entry block. (IMO it may be better to print it for
the entry-block as well. However, that requires updating many more
tests.)

Thus, the following is supported, and is the canonical printing:
  define i32 @f(i32, i32) {
    %3 = add i32 %0, %1
    br label %4

  4:
    ret i32 %3
  }

New test cases covering this behavior are added, and other tests
updated as required.

Differential Revision: https://reviews.llvm.org/D58548

llvm-svn: 356789
2019-03-22 18:27:13 +00:00
..
autoconf [llgo] Roll gofrontend forward 2016-03-15 05:36:43 +00:00
build Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
cmd [llgo]: fix compilation under current llvm 2019-01-21 04:36:43 +00:00
debug Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
docs
driver Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
include Update more file headers across all of the LLVM projects in the monorepo 2019-01-19 10:56:40 +00:00
irgen [llgo]: fix compilation under current llvm 2019-01-21 04:36:43 +00:00
ssaopt
test IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
third_party Update more file headers across all of the LLVM projects in the monorepo 2019-01-19 10:56:40 +00:00
utils/benchcomp benchcomp: Add a mode for analyzing file sizes. 2017-04-03 19:13:12 +00:00
.arcconfig Upgrade all the .arcconfigs to https. 2016-07-14 13:15:37 +00:00
buildslave-config.yaml
CMakeLists.txt [llgo] add llgo source path to LLVM_GO_PACKAGES 2016-07-27 03:01:00 +00:00
libgo-check-failures.diff [llgo] Roll gofrontend forward 2016-03-15 05:36:43 +00:00
libgo-noext.diff
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
llgo-go.sh
README.TXT Adjust documentation for git migration. 2019-01-29 16:37:27 +00:00
update_third_party.sh [llgo] Roll gofrontend forward 2016-03-15 05:36:43 +00:00

llgo
====

llgo is a Go (http://golang.org) frontend for LLVM, written in Go.

llgo is under active development. It compiles and passes most of the
standard library test suite and a substantial portion of the gc test suite,
but there are some corner cases that are known not to be handled correctly
yet. Nevertheless it can compile modestly substantial programs (including
itself; it is self hosting on x86-64 Linux).

Mailing list: https://groups.google.com/d/forum/llgo-dev

Supported platforms
-------------------

llgo is currently only supported on the x86-64 Linux platform. Contributions
that add support for other platforms are welcome.

There are two components which would need to be ported to new platforms: the
compiler and the runtime library. The compiler has little platform-specific
code; the most significant is in irgen/cabi.go. The main limiting factor
for new platforms is the runtime library in third_party/gofrontend/libgo,
which inherits some support for other platforms from the gc compiler's
runtime library, but this support tends to be incomplete.

Installation
------------

llgo requires:
* Go 1.3 or later.
* CMake 2.8.8 or later (to build LLVM).
* A modern C++ toolchain (to build LLVM).
  http://llvm.org/docs/GettingStarted.html#getting-a-modern-host-c-toolchain

Note that Ubuntu Precise is one Linux distribution which does not package
a sufficiently new CMake or C++ toolchain.

To build and install llgo:

    # Checkout llvm project.
    git clone https://github.com/llvm/llvm-project.git

    # Build LLVM, Clang and llgo: (see also http://llvm.org/docs/CMake.html)
    cd llvm-project
    mkdir build
    cd build
    cmake ../llvm -DLLVM_ENABLE_PROJECTS='clang;llgo' -DCMAKE_INSTALL_PREFIX=/path/to/llvm-inst
    make install

Running
-------

llgo-go is llgo's version of the "go" command. It has the same command line
interface as go, and works the same way, but it uses llgo to compile.

llgoi is an interactive REPL for Go. It supports expressions, statements, most
declarations and imports, including binary imports from the standard library
and source imports from $GOPATH. See docs/llgoi.rst for more information.

llgo is the compiler binary. It has a command line interface that is intended
to be compatible to a large extent with gccgo.

Contributing
------------

Changes to code outside the third_party directory should be contributed in
the normal way by sending patches to <llvm-commits@lists.llvm.org>.

Changes to code in the third_party directory must first be made in the
respective upstream project, from which they will be mirrored into the llgo
repository. See the script update_third_party.sh for the locations of the
upstream projects and details of how the mirroring works.