Hacker News new | ask | show | jobs
by yuyuyy 3598 days ago
Is Go based on llvm? It doesn't seem like it, but would be curious to know why not?

Isn't this the point of llvm, to separate the "language component" from the "cpu component"?

5 comments

One benefit is that they were able to bootstrap the language and now enjoy having a pure Go toolchain.

Whereas with LLVM, while they could benefit from all the work that has gone into it, they would get a dependency on C++ for life.

This way, the progress is slower and multiple releases will be required to achieve some optimizations, on the other hand it is the only way to prove to naysayers that for the systems programming use case of writing compilers, Go is also a viable option.

This comment from one of the Go maintainers (Russ Cox) is relevant: https://news.ycombinator.com/item?id=8817990
It's not based on LLVM. I don't know how recently the official FAQ was updated, but they say [1] that while they thought about using LLVM, they thought it was too large and slow for what they were looking for.

[1] https://golang.org/doc/faq#What_compiler_technology_is_used_...

There are llvm (and gcc) implementations of go but main/reference implementation was written from scratch in C and later moved to pure go. IIRC the authors wanted to achieve really fast compilation and a few other things that required them to start from scratch.
There was also the matter of figuring out llvm in order to use it. The initial Go compiler was based on the Plan 9 C compiler toolchain, which the designers of Go know well.

One of the other reasons relates to how stacks are handled for goroutines.

Pehaps this is the point of LLVM, but the point of Go was getting rid of C++.