LLVM bindings for the Go programming language
Go C++ C Shell
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 110 commits ahead, 1 commit behind nsf:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples/factorial Replace JIT bindings with MCJIT bindings Aug 7, 2014
.gitignore Follow trunk Apr 22, 2014
.travis.yml Add Travis-CI configuration file Sep 4, 2014
LICENSE Update copyright notice to reflect authorship Dec 23, 2011
README.md Merge pull request #43 from pcc/move Nov 1, 2014
analysis.go Follow trunk Apr 22, 2014
bitreader.go Move Go files to top level Mar 26, 2014
bitwriter.cpp Roll LLVM to r218171 Sep 20, 2014
bitwriter.go Introduce llvm.WriteBitcodeToMemoryBuffer function Jul 7, 2014
bitwriter.h Introduce llvm.WriteBitcodeToMemoryBuffer function Jul 7, 2014
core.cpp Introduce support for attribute masks above 1 << 31 Jul 30, 2014
core.go Introduce support for attribute masks above 1 << 31 Jul 30, 2014
core.h Introduce support for attribute masks above 1 << 31 Jul 30, 2014
core_test.go Introduce support for attribute masks above 1 << 31 Jul 30, 2014
debug.go Roll LLVM to r216572 Aug 27, 2014
dibuilder.cpp Roll LLVM to r216572 Aug 27, 2014
dibuilder.h Roll LLVM to r216572 Aug 27, 2014
dummy.cpp Follow trunk Apr 22, 2014
executionengine.go Replace JIT bindings with MCJIT bindings Aug 7, 2014
executionengine_test.go Replace JIT bindings with MCJIT bindings Aug 7, 2014
linker.go Move Go files to top level Mar 26, 2014
llvm_config.go.in Follow trunk Apr 22, 2014
llvm_dep.go Roll LLVM to r218171 Sep 20, 2014
string.go Move Go files to top level Mar 26, 2014
string_test.go Update a couple of import paths May 1, 2014
support.cpp Introduce LoadLibraryPermanently and ParseCommandLineOptions functions Jun 4, 2014
support.go Introduce LoadLibraryPermanently and ParseCommandLineOptions functions Jun 4, 2014
support.h Introduce LoadLibraryPermanently and ParseCommandLineOptions functions Jun 4, 2014
target.go Replace JIT bindings with MCJIT bindings Aug 7, 2014
transforms_instrumentation.cpp Add bindings for the sanitizer passes Jul 30, 2014
transforms_instrumentation.go Add bindings for the sanitizer passes Jul 30, 2014
transforms_instrumentation.h Add bindings for the sanitizer passes Jul 30, 2014
transforms_ipo.go Move Go files to top level Mar 26, 2014
transforms_pmbuilder.go Introduce bindings for PassManagerBuilder Apr 17, 2014
transforms_scalar.go Move Go files to top level Mar 26, 2014
update_llvm.sh Merge pull request #37 from axw/update_llvm_echoe Aug 8, 2014
version.go Expose the LLVM version as a string constant Aug 2, 2014

README.md

GoLLVM

This project has moved to llvm.org. Any contributions or bug reports should be sent there. Please refer to the Go bindings readme for more information.

LLVM bindings for The Go Programming Language.

Build Status

Prerequisites

  • Go 1.2+.
  • CMake (to build LLVM).

The author has only built and tested with Linux, but there is no particular reason why GoLLVM should not work with other operating systems.

Building LLVM

The development version of GoLLVM is tied to a specific revision of LLVM SVN trunk. We also make releases which are synchronized with LLVM releases. Those releases are available in branches named vMN, where M is the major number of the LLVM release and N is the minor number.

The script update\_llvm.sh in this directory can be used to build the required revision of LLVM and prepare it to be used by GoLLVM. If you receive an error message from go build like this:

./analysis.go:4:84: fatal error: llvm-c/Analysis.h: No such file or directory
 #include <llvm-c/Analysis.h> // If you are getting an error here read README.md

or like this:

./llvm_dep.go:5: undefined: run_update_llvm_sh_to_get_revision_NNNNNN

it means that LLVM needs to be built or updated by running the script.

$ ./update_llvm.sh

Any command line arguments supplied to the script are passed to LLVM's CMake build system. A good set of arguments to use during development are:

$ ./update_llvm.sh -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD=host -DBUILD_SHARED_LIBS=ON

Note that CMake keeps a cache of build settings so once you have built LLVM there is no need to pass these arguments again after updating.

Alternatively, you can build LLVM yourself or use a version provided by your distribution, but you must then set the CGO_CFLAGS and CGO_LDFLAGS environment variables:

$ export CGO_CFLAGS=`llvm-config --cflags`
$ export CGO_LDFLAGS="`llvm-config --ldflags` -Wl,-L`llvm-config --libdir` -lLLVM-`llvm-config --version`"
$ go get -tags byollvm github.com/go-llvm/llvm