1
0
mirror of https://github.com/golang/go synced 2024-11-18 06:04:53 -07:00

cmd/compile: ensure InitMem comes after Args

The debug info generation currently depends on this invariant.

A small update to CL 468455.

Update #58482

Change-Id: Ica305d360d9af04036c604b6a65b683f7cb6e212
Reviewed-on: https://go-review.googlesource.com/c/go/+/468695
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Keith Randall 2023-02-15 16:11:37 -08:00 committed by Keith Randall
parent 55044288ad
commit 518889b35c

View File

@ -15,6 +15,7 @@ import (
const ( const (
ScorePhi = iota // towards top of block ScorePhi = iota // towards top of block
ScoreArg // must occur at the top of the entry block ScoreArg // must occur at the top of the entry block
ScoreInitMem // after the args - used as mark by debug info generation
ScoreReadTuple // must occur immediately after tuple-generating insn (or call) ScoreReadTuple // must occur immediately after tuple-generating insn (or call)
ScoreNilCheck ScoreNilCheck
ScoreMemory ScoreMemory
@ -162,9 +163,12 @@ func schedule(f *Func) {
f.Fatalf("%s appeared outside of entry block, b=%s", v.Op, b.String()) f.Fatalf("%s appeared outside of entry block, b=%s", v.Op, b.String())
} }
score[v.ID] = ScorePhi score[v.ID] = ScorePhi
case v.Op == OpArg || v.Op == OpSP || v.Op == OpSB || v.Op == OpInitMem: case v.Op == OpArg || v.Op == OpSP || v.Op == OpSB:
// We want all the args as early as possible, for better debugging. // We want all the args as early as possible, for better debugging.
score[v.ID] = ScoreArg score[v.ID] = ScoreArg
case v.Op == OpInitMem:
// Early, but after args. See debug.go:buildLocationLists
score[v.ID] = ScoreInitMem
case v.Type.IsMemory(): case v.Type.IsMemory():
// Schedule stores as early as possible. This tends to // Schedule stores as early as possible. This tends to
// reduce register pressure. // reduce register pressure.