1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:44:46 -07:00

cmd/compile/internal/ssagen: call AllocFrame after ssa.Compile

This indirection is no longer necessary.

Change-Id: Ibb5eb1753febdc17a93ea9c35130e3d2b26c360e
Reviewed-on: https://go-review.googlesource.com/c/go/+/526518
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Matthew Dempsky 2023-09-06 22:33:24 -07:00 committed by Gopher Robot
parent dac9b9ddbd
commit 5d6f835b3e
5 changed files with 2 additions and 18 deletions

View File

@ -508,7 +508,6 @@ var passes = [...]pass{
{name: "flagalloc", fn: flagalloc, required: true}, // allocate flags register {name: "flagalloc", fn: flagalloc, required: true}, // allocate flags register
{name: "regalloc", fn: regalloc, required: true}, // allocate int & float registers + stack slots {name: "regalloc", fn: regalloc, required: true}, // allocate int & float registers + stack slots
{name: "loop rotate", fn: loopRotate}, {name: "loop rotate", fn: loopRotate},
{name: "stackframe", fn: stackframe, required: true},
{name: "trim", fn: trim}, // remove empty blocks {name: "trim", fn: trim}, // remove empty blocks
} }
@ -577,8 +576,6 @@ var passOrder = [...]constraint{
{"flagalloc", "regalloc"}, {"flagalloc", "regalloc"},
// loopRotate will confuse regalloc. // loopRotate will confuse regalloc.
{"regalloc", "loop rotate"}, {"regalloc", "loop rotate"},
// stackframe needs to know about spilled registers.
{"regalloc", "stackframe"},
// trim needs regalloc to be done first. // trim needs regalloc to be done first.
{"regalloc", "trim"}, {"regalloc", "trim"},
// memcombine works better if fuse happens first, to help merge stores. // memcombine works better if fuse happens first, to help merge stores.

View File

@ -154,9 +154,6 @@ type Frontend interface {
// for the parts of that compound type. // for the parts of that compound type.
SplitSlot(parent *LocalSlot, suffix string, offset int64, t *types.Type) LocalSlot SplitSlot(parent *LocalSlot, suffix string, offset int64, t *types.Type) LocalSlot
// AllocFrame assigns frame offsets to all live auto variables.
AllocFrame(f *Func)
// Syslook returns a symbol of the runtime function/variable with the // Syslook returns a symbol of the runtime function/variable with the
// given name. // given name.
Syslook(string) *obj.LSym Syslook(string) *obj.LSym

View File

@ -89,8 +89,6 @@ func (TestFrontend) Auto(pos src.XPos, t *types.Type) *ir.Name {
func (d TestFrontend) SplitSlot(parent *LocalSlot, suffix string, offset int64, t *types.Type) LocalSlot { func (d TestFrontend) SplitSlot(parent *LocalSlot, suffix string, offset int64, t *types.Type) LocalSlot {
return LocalSlot{N: parent.N, Type: t, Off: offset} return LocalSlot{N: parent.N, Type: t, Off: offset}
} }
func (TestFrontend) AllocFrame(f *Func) {
}
func (d TestFrontend) Syslook(s string) *obj.LSym { func (d TestFrontend) Syslook(s string) *obj.LSym {
return d.ctxt.Lookup(s) return d.ctxt.Lookup(s)
} }

View File

@ -1,10 +0,0 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ssa
// stackframe calls back into the frontend to assign frame offsets.
func stackframe(f *Func) {
f.fe.AllocFrame(f)
}

View File

@ -566,6 +566,8 @@ func buildssa(fn *ir.Func, worker int) *ssa.Func {
// Main call to ssa package to compile function // Main call to ssa package to compile function
ssa.Compile(s.f) ssa.Compile(s.f)
fe.AllocFrame(s.f)
if len(s.openDefers) != 0 { if len(s.openDefers) != 0 {
s.emitOpenDeferInfo() s.emitOpenDeferInfo()
} }