cmd/compile's unified IR

461 views
Skip to first unread message

Daniel Martí

unread,
Mar 23, 2022, 6:30:09 AM3/23/22
to golang-dev
Hi all,

I've seen mentions over the months of the compiler's "unified IR", like
https://github.com/golang/go/issues/43930#issuecomment-1055828214.
Is there a document, proposal, or issue that explains what it is?

For example, I found a dev.typeparams CL that got merged nearly a year
ago (https://go-review.googlesource.com/c/go/+/324573) with some
details, but then I'm confused why the compiler notes seem to be talking
about enabling unified IR as if it were a new project.

Compare the above to other projects like the register-baesd calling
convention, which had a detailed document with plenty of context:
https://go.googlesource.com/proposal/+/refs/changes/78/248178/1/design/40724-register-calling.md

I don't expect unified IR to now write a lengthy document or go through
the formal proposal process, but it would be nice to have a short
canonical document explaining what it is, assuming there isn't one :)
An email reply could also work, but it might be harder to perma-link to.

The compiler and runtime meeting notes at #43930 are being very useful,
otherwise - all other topics have a fairly obvious context in comparison.

Thanks!

cuong.m...@gmail.com

unread,
Mar 23, 2022, 6:44:52 AM3/23/22
to golang-dev
You may find the comment in cmd/compile/internal/noder/unified.go:L33, it makes an overview about unified IR.

Daniel Martí

unread,
Mar 24, 2022, 5:07:57 AM3/24/22
to cuong.m...@gmail.com, golang-dev
Thanks! I've sent https://go-review.googlesource.com/c/go/+/395394 to
hopefully make those docs easier to read.

That seems to explain how the unified IR is generated, but not what it
is or why it's useful, though. The internal/ir package also doesn't have
high-level docs I can use.

Christopher Cahoon

unread,
Mar 24, 2022, 2:09:17 PM3/24/22
to golang-dev
Go compiler and runtime meeting notes #43930 - https://golang.org/issues/43930

Matthew Dempsky

unread,
Mar 24, 2022, 2:59:36 PM3/24/22
to Daniel Martí, golang-dev
The best explanation of unified IR at the moment is still the commit message at https://go-review.googlesource.com/c/go/+/324573.

The basic idea is that cmd/compile's frontend has a lot of code that copies IR trees around, and this code is historically a big source of complexity and subtle bugs. Unified IR aims to merge all of that code into a single code path that gets better test coverage and is easier to maintain.

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-dev/20220323102959.wdpqvzdeusqc3ild%40p14s.localdomain.
Reply all
Reply to author
Forward
0 new messages