]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: rearrange fields between ssa.Func, ssa.Cache, and ssa.Config
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 15 Mar 2017 18:15:13 +0000 (11:15 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 17 Mar 2017 05:21:42 +0000 (05:21 +0000)
commita5e3cac89587d2d6235e9a7217185dee9be6852a
tree016d9b235505e45e7938769e19ae7ce58b78995b
parentccaa8e3c6fbba08f238c5ccea437b7cac513685f
cmd/compile: rearrange fields between ssa.Func, ssa.Cache, and ssa.Config

This makes ssa.Func, ssa.Cache, and ssa.Config fulfill
the roles laid out for them in CL 38160.

The only non-trivial change in this CL is how cached
values and blocks get IDs. Prior to this CL, their IDs were
assigned as part of resetting the cache, and only modified
IDs were reset. This required knowing how many values and
blocks were modified, which required a tight coupling between
ssa.Func and ssa.Config. To eliminate that coupling,
we now zero values and blocks during reset,
and assign their IDs when they are used.
Since unused values and blocks have ID == 0,
we can efficiently find the last used value/block,
to avoid zeroing everything.
Bulk zeroing is efficient, but not efficient enough
to obviate the need to avoid zeroing everything every time.
As a happy side-effect, ssa.Func.Free is no longer necessary.

DebugHashMatch and friends now belong in func.go.
They have been left in place for clarity and review.
I will move them in a subsequent CL.

Passes toolstash -cmp. No compiler performance impact.
No change in 'go test cmd/compile/internal/ssa' execution time.

Change-Id: I2eb7af58da067ef6a36e815a6f386cfe8634d098
Reviewed-on: https://go-review.googlesource.com/38167
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
16 files changed:
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/pgen.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/ssa/cache.go
src/cmd/compile/internal/ssa/compile.go
src/cmd/compile/internal/ssa/config.go
src/cmd/compile/internal/ssa/copyelim_test.go
src/cmd/compile/internal/ssa/deadcode_test.go
src/cmd/compile/internal/ssa/dom.go
src/cmd/compile/internal/ssa/func.go
src/cmd/compile/internal/ssa/func_test.go
src/cmd/compile/internal/ssa/fuse_test.go
src/cmd/compile/internal/ssa/loop_test.go
src/cmd/compile/internal/ssa/regalloc.go
src/cmd/compile/internal/ssa/shift_test.go
src/cmd/compile/internal/ssa/stackalloc.go