mirror of
https://github.com/golang/go
synced 2024-11-26 04:58:00 -07: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
@ -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.
|
||||
// That register contains the closure pointer on closure entry.
|
||||
func CheckLoweredGetClosurePtr(v *ssa.Value) {
|
||||
entry := v.Block.Func.Entry
|
||||
// TODO register args: not all the register-producing ops can come first.
|
||||
if entry != v.Block || entry.Values[0] != v {
|
||||
if entry != v.Block {
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user