aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/regalloc.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2017-03-17 16:04:46 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2017-03-19 00:21:23 +0000
commitaea3aff66911e31cba9eddd93c02eb591ae483bf (patch)
tree62e215c0d47ab16717a8d8512f1d2a36425f9fe2 /src/cmd/compile/internal/ssa/regalloc.go
parent2c397c7a753963494ce5dd5d7eda471354074698 (diff)
downloadgo-aea3aff66911e31cba9eddd93c02eb591ae483bf.tar.xz
cmd/compile: separate ssa.Frontend and ssa.TypeSource
Prior to this CL, the ssa.Frontend field was responsible for providing types to the backend during compilation. However, the types needed by the backend are few and static. It makes more sense to use a struct for them and to hang that struct off the ssa.Config, which is the correct home for readonly data. Now that Types is a struct, we can clean up the names a bit as well. This has the added benefit of allowing early construction of all types needed by the backend. This will be useful for concurrent backend compilation. Passes toolstash-check -all. No compiler performance change. Updates #15756 Change-Id: I021658c8cf2836d6a22bbc20cc828ac38c7da08a Reviewed-on: https://go-review.googlesource.com/38336 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/regalloc.go')
-rw-r--r--src/cmd/compile/internal/ssa/regalloc.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/ssa/regalloc.go b/src/cmd/compile/internal/ssa/regalloc.go
index 03f1f7ce32..a1b07433ae 100644
--- a/src/cmd/compile/internal/ssa/regalloc.go
+++ b/src/cmd/compile/internal/ssa/regalloc.go
@@ -2055,10 +2055,11 @@ func (e *edgeState) erase(loc Location) {
func (e *edgeState) findRegFor(typ Type) Location {
// Which registers are possibilities.
var m regMask
+ types := &e.s.f.Config.Types
if typ.IsFloat() {
- m = e.s.compatRegs(e.s.f.fe.TypeFloat64())
+ m = e.s.compatRegs(types.Float64)
} else {
- m = e.s.compatRegs(e.s.f.fe.TypeInt64())
+ m = e.s.compatRegs(types.Int64)
}
// Pick a register. In priority order:
@@ -2082,7 +2083,7 @@ func (e *edgeState) findRegFor(typ Type) Location {
// No register is available. Allocate a temp location to spill a register to.
// The type of the slot is immaterial - it will not be live across
// any safepoint. Just use a type big enough to hold any register.
- typ = e.s.f.fe.TypeInt64()
+ typ = types.Int64
t := LocalSlot{e.s.f.fe.Auto(typ), typ, 0}
// TODO: reuse these slots.