]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: refactor constant rewriting
authorMatthew Dempsky <mdempsky@google.com>
Sat, 31 Mar 2018 23:49:07 +0000 (16:49 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Mon, 2 Apr 2018 04:09:29 +0000 (04:09 +0000)
commit0250ef910f9a979a2151bd8e02b2641b74cf2f27
tree152b68bb021558977775d102c3b59c8e105be35e
parent3c588b3fe7e1394f7df981284f1dc4c0a2b32b14
cmd/compile: refactor constant rewriting

Extract all rewrite-to-OLITERAL expressions to use a single setconst
helper function.

Does not pass toolstash-check for two reasons:

1) We now consistently clear Left/Right/etc when rewriting Nodes into
OLITERALs, which results in their inlining complexity being correctly
computed. So more functions can now be inlined.

2) We preserve Pos, so PC line tables change somewhat.

Change-Id: I2b5c293bee7c69c2ccd704677f5aba4ec40e3155
Reviewed-on: https://go-review.googlesource.com/103860
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
src/cmd/compile/internal/gc/const.go
src/cmd/compile/internal/gc/sinit.go
src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/compile/internal/gc/walk.go