From: Ken Thompson Date: Wed, 11 Jun 2008 19:25:44 +0000 (-0700) Subject: reorder1 - function first instead of last X-Git-Tag: weekly.2009-11-06~3704 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2bba3a610d7d4cb42391b724408c694ff9ebb791;p=gostls13.git reorder1 - function first instead of last SVN=122160 --- diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 948b0a8973..49c1ef4bc1 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -1224,6 +1224,7 @@ convas(Node *n) if(n->op != OAS) fatal("convas: not as %O", n->op); + ullmancalc(n); l = n->left; r = n->right; if(l == N || r == N) @@ -1321,7 +1322,7 @@ loop1: if(c == 0 || t == 1) return n; if(c > 1) { - yyerror("reorder1: too many funcation calls evaluating parameters"); + yyerror("reorder1: too many function calls evaluating parameters"); return n; } goto pass2; @@ -1337,21 +1338,18 @@ loop1: pass2: l = listfirst(&save, &n); - f = N; // isolated function call - r = N; // rest of them + r = N; // rest + f = N; // fncall loop2: if(l == N) { - if(r == N || f == N) - fatal("reorder1 not nil 1"); r = nod(OLIST, f, r); - return rev(r); + r = rev(r); + return r; } - if(l->ullman >= UINF) { - if(f != N) - fatal("reorder1 not nil 2"); + if(l->ullman >= UINF) f = l; - } else + else if(r == N) r = l; else