mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: allow OpArgXXXReg comes before LoweredGetClosurePtr
Both OpArgXXXReg and LoweredGetClosurePtr must come very early, because they carry registers that are technically live on entry. But no need to impose ordering requirement between them. Change-Id: Iee1db6239a75e5b381e0ad25ba5503169333217b Reviewed-on: https://go-review.googlesource.com/c/go/+/309629 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
444d28295b
commit
4b00eb7af4
1 changed files with 14 additions and 3 deletions
|
|
@ -7097,15 +7097,26 @@ func CheckLoweredPhi(v *ssa.Value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckLoweredGetClosurePtr checks that v is the first instruction in the function's entry block.
|
// CheckLoweredGetClosurePtr checks that v is the first instruction in the function's entry block,
|
||||||
|
// except for incoming in-register arguments.
|
||||||
// The output of LoweredGetClosurePtr is generally hardwired to the correct register.
|
// The output of LoweredGetClosurePtr is generally hardwired to the correct register.
|
||||||
// That register contains the closure pointer on closure entry.
|
// That register contains the closure pointer on closure entry.
|
||||||
func CheckLoweredGetClosurePtr(v *ssa.Value) {
|
func CheckLoweredGetClosurePtr(v *ssa.Value) {
|
||||||
entry := v.Block.Func.Entry
|
entry := v.Block.Func.Entry
|
||||||
// TODO register args: not all the register-producing ops can come first.
|
if entry != v.Block {
|
||||||
if entry != v.Block || entry.Values[0] != v {
|
|
||||||
base.Fatalf("in %s, badly placed LoweredGetClosurePtr: %v %v", v.Block.Func.Name, v.Block, v)
|
base.Fatalf("in %s, badly placed LoweredGetClosurePtr: %v %v", v.Block.Func.Name, v.Block, v)
|
||||||
}
|
}
|
||||||
|
for _, w := range entry.Values {
|
||||||
|
if w == v {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
switch w.Op {
|
||||||
|
case ssa.OpArgIntReg, ssa.OpArgFloatReg:
|
||||||
|
// okay
|
||||||
|
default:
|
||||||
|
base.Fatalf("in %s, badly placed LoweredGetClosurePtr: %v %v", v.Block.Func.Name, v.Block, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckArgReg ensures that v is in the function's entry block.
|
// CheckArgReg ensures that v is in the function's entry block.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue