1
0
mirror of https://github.com/golang/go synced 2024-11-26 08:38:01 -07:00

cmd/compile: schedule in-register OpArg first

OpArgXXXReg values must be scheduled at the very top, as their
registers need to be live at the beginning before any other use
of the register.

Change-Id: Ic76768bb74da402adbe61db3b2d174ecd3f9fffc
Reviewed-on: https://go-review.googlesource.com/c/go/+/306329
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Cherry Zhang 2021-03-31 10:27:06 -04:00
parent 46fa8afca6
commit cb42e3e979

View File

@ -137,7 +137,14 @@ func schedule(f *Func) {
case v.Op == OpVarDef:
// We want all the vardefs next.
score[v.ID] = ScoreVarDef
case v.Op == OpArg || v.Op == OpArgIntReg || v.Op == OpArgFloatReg:
case v.Op == OpArgIntReg || v.Op == OpArgFloatReg:
// In-register args must be scheduled as early as possible to ensure that the
// context register is not stomped. They should only appear in the entry block.
if b != f.Entry {
f.Fatalf("%s appeared outside of entry block, b=%s", v.Op, b.String())
}
score[v.ID] = ScorePhi
case v.Op == OpArg:
// We want all the args as early as possible, for better debugging.
score[v.ID] = ScoreArg
case v.Type.IsMemory():