summaryrefslogtreecommitdiff
path: root/src/cmd/6l
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-08-13 00:09:31 -0400
committerRuss Cox <rsc@golang.org>2013-08-13 00:09:31 -0400
commita7f91eed7e65d157bd9fe1fad328c4b9bd65f34d (patch)
treed66fdbc374d8bbd1a22bd56f72459810141ecf3a /src/cmd/6l
parentabcaed5fa3590662bc75d0c4b74eb7cb16456bd7 (diff)
downloadgo-a7f91eed7e65d157bd9fe1fad328c4b9bd65f34d.tar.gz
cmd/gc: add temporary-merging optimization pass
The compilers assume they can generate temporary variables as needed to preserve the right semantics or simplify code generation and the back end will still generate good code. This turns out not to be true. The back ends will only track the first 128 variables per function and give up on the remainder. That needs to be fixed too, in a later CL. This CL merges temporary variables with equal types and non-overlapping lifetimes using the greedy algorithm in Poletto and Sarkar, "Linear Scan Register Allocation", ACM TOPLAS 1999. The result can be striking in the right functions. Top 20 frame size changes in a 6g godoc binary by bytes saved: 5464 1984 (-3480, -63.7%) go/build.(*Context).Import 4456 1824 (-2632, -59.1%) go/printer.(*printer).expr1 2560 80 (-2480, -96.9%) time.nextStdChunk 3496 1608 (-1888, -54.0%) go/printer.(*printer).stmt 1896 272 (-1624, -85.7%) net/http.init 2688 1400 (-1288, -47.9%) fmt.(*pp).printReflectValue 2800 1512 (-1288, -46.0%) main.main 3296 2016 (-1280, -38.8%) crypto/tls.(*Conn).clientHandshake 1664 488 (-1176, -70.7%) time.loadZoneZip 1760 608 (-1152, -65.5%) time.parse 4104 3072 (-1032, -25.1%) runtime/pprof.writeHeap 1680 712 ( -968, -57.6%) go/ast.Walk 2488 1560 ( -928, -37.3%) crypto/x509.parseCertificate 1128 392 ( -736, -65.2%) math/big.nat.divLarge 1528 864 ( -664, -43.5%) go/printer.(*printer).fieldList 1360 712 ( -648, -47.6%) regexp/syntax.(*parser).factor 2104 1528 ( -576, -27.4%) encoding/asn1.parseField 1064 504 ( -560, -52.6%) encoding/xml.(*Decoder).text 584 48 ( -536, -91.8%) html.init 1400 864 ( -536, -38.3%) go/doc.playExample In the same godoc build, cuts the number of functions with too many vars from 83 to 32. R=ken2 CC=golang-dev https://codereview.appspot.com/12829043
Diffstat (limited to 'src/cmd/6l')
-rw-r--r--src/cmd/6l/list.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/6l/list.c b/src/cmd/6l/list.c
index aaf45c4dd..5040e4327 100644
--- a/src/cmd/6l/list.c
+++ b/src/cmd/6l/list.c
@@ -57,7 +57,7 @@ Pconv(Fmt *fp)
switch(p->as) {
case ATEXT:
if(p->from.scale) {
- fmtprint(fp, "(%d) %A %D,%d,%D",
+ fmtprint(fp, "(%d) %A %D,%d,%lD",
p->line, p->as, &p->from, p->from.scale, &p->to);
break;
}