Gollvm from Google
go.googlesource.com
go.googlesource.com
By "adopted" I mean that:
* the code was moved to the same git hosting infrastructure that also hosts official Go compiler and libraries owned by Go team
* the license was changed from Apache to the same BSD license as Go compiler
* another Google employee is contributing to the code
* initial checkin was made by Russ Cox, who is pretty much the lead for Go project
All that implies that this has a blessing of the Go team
> You attempted to reach llvm.org, but the server presented a certificate signed using a weak signature algorithm (such as SHA-1). This means that the security credentials the server presented could have been forged, and the server may not be the server you expected (you may be communicating with an attacker).
1. The maintainer of llgo is a Google employee (and a very talented LLVM engineer).
2. I don't imagine there would be tremendous differences in the strategies used to generate LLVM IR between the tools. ISTM, if there are deficiencies in llgo, then it would be better to fix them rather than creating a whole new tool.1. The maintainer of llgo is a Google employee (and a very talented LLVM engineer).
2. I don't imagine there would be tremendous differences in the strategies used to generate LLVM IR between the tools. ISTM, if there are deficiencies in llgo, then it would be better to fix them rather than creating a whole new tool.
Also, llvm by now reaches far more platforms than the current go compiler. I think that this is the most likely explanation.
We (SUSE / openSUSE) had an incredible amount of issues with gccgo. The main problem was that the runtime wasn't updated often enough, they had some odd patches that broke the runtime, and you generally had to update the compiler to update the Go version (quite difficult in enterprise distributions).
If you design a new processor, you generally take it upon yourself to do the work necessary for folks to use C compilers that target your processors. I'd argue that they're more likely to contribute a backend implementation to LLVM than golang.
Not sure I get it: so Gollvm (=llvm-goparse?) can be used as compiler, but not as a linker (yet?), so gccgo's linker can be used? Also, Go runtime and standard libraries can't be compiled with Gollvm? If standard libs can't be compiled, then how can I know if my app can be compiled?
I know a project named "llvm-go" was started quite long ago, and had somewhat slow (compared to gccgo) progress because of few, non-Google contributors (probably hobbyists); is this the same work? is it just still in progress, but somewhat more (how much?) advanced now?
Some additional googling shows a similarly named project (https://github.com/go-llvm/llvm), which from its readme seems absorbed by LLVM proper, and is subtitled "LLVM bindings for [Go]" (http://llvm.org/svn/llvm-project/llvm/trunk/bindings/go/READ...). Is this the same project, or something more, or something else? [EDIT:] Ok, based on the CONTRIBUTORS file, it's a totally different project, at least one question cleared. (https://go.googlesource.com/gollvm/+/master/CONTRIBUTORS)
See the factorial example, where they build up some LLVM IR (in memory) for computing factorials: https://github.com/go-llvm/llvm/blob/master/examples/factori...
I'd guess the advantage of this is using LLVM's JIT at runtime.
Compare the source code:
http://llvm.org/svn/llvm-project/llvm/trunk/bindings/go/llvm...
https://go.googlesource.com/gollvm/+/master/llvm-gofrontend/
> entry:
> %"$ret0" = alloca i64
> store i64 0, i64* %"$ret0"
> store i64 1, i64* %"$ret0"
> %"$ret0.ld.0" = load i64, i64* %"$ret0"
> ret i64 %"$ret0.ld.0"
> }
Can someone knowledgeable with Go, explain what's happening here? Why does it store a 0 and then a 1 in "$ret0"? Why does it allocate a single integer on the stack? (is it because this is just intermediate code for a virtual machine?) and all of that just to return a 1.
The pass is called mem2reg:
http://llvm.org/docs/Passes.html#mem2reg-promote-memory-to-r...
[1] https://en.wikipedia.org/wiki/Static_single_assignment_form
Go language semantics define that variables receive a zero initialization.[0]
> and then a 1 in "$ret0"?
The 1 is because the code explicitly stores a 1 :-).
Clearly the output code has not been through an optimization pass.
Yeah, and a GPU could also just happen to give you the right answer in an O(1) hashtable lookup
I didn't mean anyone would want to do this but just that it's an interesting parallelism for a language.
Yes, you're confusing it with this project: https://github.com/go-llvm/llvm