cmd/compile: cleanup artifacts from previous CL

Does not pass toolstash, but only because it causes ATYPE instructions
to be emitted in a different order, and it avoids emitting type
metadata for unused variables.

Change-Id: I3ec8f66a40b5af9213e0d6e852b267a8dd995838
Reviewed-on: https://go-review.googlesource.com/30217
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Matthew Dempsky 2016-10-03 16:09:13 -07:00
parent 5c7a005266
commit 9abaef93c7
3 changed files with 16 additions and 28 deletions

View file

@ -262,12 +262,6 @@ func (s *ssaExport) AllocFrame(f *ssa.Func) {
} }
} }
// To satisfy toolstash -cmp, preserve the unsorted
// declaration order so we can emit the ATYPE instructions in
// the same order.
// TODO(mdempsky): Remove in followup CL.
Curfn.Func.UnsortedDcls = append([]*Node(nil), Curfn.Func.Dcl...)
if f.Config.NeedsFpScratch { if f.Config.NeedsFpScratch {
scratchFpMem = temp(Types[TUINT64]) scratchFpMem = temp(Types[TUINT64])
scratchFpMem.Used = scratchUsed scratchFpMem.Used = scratchUsed
@ -432,18 +426,13 @@ func compile(fn *Node) {
} }
} }
for _, n := range fn.Func.UnsortedDcls { for _, n := range fn.Func.Dcl {
if n.Op != ONAME { // might be OTYPE or OLITERAL if n.Op != ONAME { // might be OTYPE or OLITERAL
continue continue
} }
switch n.Class { switch n.Class {
case PAUTO: case PAUTO:
if !n.Used { if !n.Used {
// Hacks to appease toolstash -cmp.
// TODO(mdempsky): Remove in followup CL.
pcloc++
Pc.Pc++
Linksym(ngotype(n))
continue continue
} }
fallthrough fallthrough

View file

@ -22,7 +22,7 @@ func TestSizeof(t *testing.T) {
_32bit uintptr // size on 32bit platforms _32bit uintptr // size on 32bit platforms
_64bit uintptr // size on 64bit platforms _64bit uintptr // size on 64bit platforms
}{ }{
{Func{}, 108, 192}, // TODO(mdempsky): Change back to 96, 168 in followup CL. {Func{}, 96, 168},
{Name{}, 52, 80}, {Name{}, 52, 80},
{Node{}, 92, 144}, {Node{}, 92, 144},
{Sym{}, 60, 112}, {Sym{}, 60, 112},

View file

@ -276,7 +276,6 @@ type Func struct {
Exit Nodes Exit Nodes
Cvars Nodes // closure params Cvars Nodes // closure params
Dcl []*Node // autodcl for this func/closure Dcl []*Node // autodcl for this func/closure
UnsortedDcls []*Node // autodcl for this func/closure
Inldcl Nodes // copy of dcl for use in inlining Inldcl Nodes // copy of dcl for use in inlining
Closgen int Closgen int
Outerfunc *Node // outer function (for closure) Outerfunc *Node // outer function (for closure)