tinygo-org / tinygo Public
Home
Ron Evans edited this page Apr 20, 2022
·
23 revisions
Pages 13
Clone this wiki locally
If you're looking for documentation, that's online over here.
Also, look at the sidebar for some random notes on TinyGo.
Reference material for new TinyGo developers
Intro
- LLVM from a Go perspective
- An introduction to LLVM in Go
- GopherAcademy: LLVM IR and Go
- Learning LLVM (pdf)
- http://notes.eatonphil.com/compiler-basics-llvm.html
General
- How a Go Program Compiles down to Machine Code - Good overview how the mainline Go compiler operates
Go SSA
- http://en.wikipedia.org/wiki/Static_single_assignment_form - A good intro to SSA in general
- Online Go SSA viewer - Paste Go code in the left pane, shows the Go SSA on the right
- Go SSA documentation
Tip: Generating Go SSA from the command line
Go SSA can be generated from the command line by adding the GOSSAFUNC
variable to your environment for go build
:
$ GOSSAFUNC=main go build -a src/examples/wasm/main/main.go
# runtime
dumped SSA to /usr/local/go/src/runtime/ssa.html
# command-line-arguments
dumped SSA to src/examples/wasm/main/ssa.html
The ssa.html file can be viewed using a browser:
$ ls -la src/examples/wasm/main/
total 156
drwxrwxr-x. 2 jc jc 72 May 6 18:51 .
drwxrwxr-x. 6 jc jc 125 May 6 18:50 ..
-rw-rw-r--. 1 jc jc 1304 May 6 18:50 index.html
-rw-rw-r--. 1 jc jc 55 May 6 18:50 main.go
-rw-rw-r--. 1 jc jc 254 May 6 18:50 README.md
-rw-r--r--. 1 jc jc 146489 May 6 18:51 ssa.html
LLVM
- What each of the LLVM command line tools do
- Mapping High Level Constructs to LLVM IR (source)
- LLVM Programmers Manual
- LLVM Language Reference Manual
- LLVM for Grad Students - Some useful intro pieces in here, though it has a different focus
- Quick intro to using LLVM Bugpoint - Useful for reducing test cases when LLVM crashes on a .ll or .bc file
- How to submit an LLVM bug
Related projects
- go-llvm docs - Docs for the official LLVM bindings for Go
- https://github.com/llir/llvm - Library for interacting with LLVM IR in pure Go