Commit 307de654 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile/internal/obj/x86: clean up "is leaf?" check

Minor code cleanup. No functional changes.

Change-Id: I2e631b43b122174302a182a1a286c0f873851ce6
Reviewed-on: https://go-review.googlesource.com/24813
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 64e15291
......@@ -655,17 +655,24 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
// TODO(rsc): Remove 'p.Mode == 64 &&'.
if p.Mode == 64 && autoffset < obj.StackSmall && p.From3Offset()&obj.NOSPLIT == 0 {
leaf := true
LeafSearch:
for q := p; q != nil; q = q.Link {
if q.As == obj.ACALL {
goto noleaf
}
if (q.As == obj.ADUFFCOPY || q.As == obj.ADUFFZERO) && autoffset >= obj.StackSmall-8 {
goto noleaf
switch q.As {
case obj.ACALL:
leaf = false
break LeafSearch
case obj.ADUFFCOPY, obj.ADUFFZERO:
if autoffset >= obj.StackSmall-8 {
leaf = false
break LeafSearch
}
}
}
p.From3.Offset |= obj.NOSPLIT
noleaf:
if leaf {
p.From3.Offset |= obj.NOSPLIT
}
}
if p.From3Offset()&obj.NOSPLIT == 0 || p.From3Offset()&obj.WRAPPER != 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment