Commit 0eda21a2 authored by Russ Cox's avatar Russ Cox

change minimum sethi/ullman number to 1

to distinguish not computed (0) vs trivial (1).

add missing ullmancalc on function args.

R=ken
OCL=18711
CL=18711
parent ce164403
...@@ -28,7 +28,7 @@ if(newproc == N) { ...@@ -28,7 +28,7 @@ if(newproc == N) {
newproc->sym = pkglookup("newproc", "sys"); newproc->sym = pkglookup("newproc", "sys");
newproc->class = PEXTERN; newproc->class = PEXTERN;
newproc->addable = 1; newproc->addable = 1;
newproc->ullman = 0; newproc->ullman = 1;
} }
if(throwindex == N) { if(throwindex == N) {
...@@ -36,7 +36,7 @@ if(throwindex == N) { ...@@ -36,7 +36,7 @@ if(throwindex == N) {
throwindex->sym = pkglookup("throwindex", "sys"); throwindex->sym = pkglookup("throwindex", "sys");
throwindex->class = PEXTERN; throwindex->class = PEXTERN;
throwindex->addable = 1; throwindex->addable = 1;
throwindex->ullman = 0; throwindex->ullman = 1;
} }
if(throwreturn == N) { if(throwreturn == N) {
...@@ -44,7 +44,7 @@ if(throwreturn == N) { ...@@ -44,7 +44,7 @@ if(throwreturn == N) {
throwreturn->sym = pkglookup("throwreturn", "sys"); throwreturn->sym = pkglookup("throwreturn", "sys");
throwreturn->class = PEXTERN; throwreturn->class = PEXTERN;
throwreturn->addable = 1; throwreturn->addable = 1;
throwreturn->ullman = 0; throwreturn->ullman = 1;
} }
if(fn->nbody == N) if(fn->nbody == N)
......
...@@ -1640,7 +1640,7 @@ tempname(Node *n, Type *t) ...@@ -1640,7 +1640,7 @@ tempname(Node *n, Type *t)
n->etype = t->etype; n->etype = t->etype;
n->class = PAUTO; n->class = PAUTO;
n->addable = 1; n->addable = 1;
n->ullman = 0; n->ullman = 1;
dowidth(t); dowidth(t);
w = t->width; w = t->width;
......
...@@ -865,7 +865,7 @@ newname(Sym *s) ...@@ -865,7 +865,7 @@ newname(Sym *s)
n->sym = s; n->sym = s;
n->type = T; n->type = T;
n->addable = 1; n->addable = 1;
n->ullman = 0; n->ullman = 1;
return n; return n;
} }
...@@ -886,7 +886,7 @@ oldname(Sym *s) ...@@ -886,7 +886,7 @@ oldname(Sym *s)
n->sym = s; n->sym = s;
n->type = T; n->type = T;
n->addable = 1; n->addable = 1;
n->ullman = 0; n->ullman = 1;
} }
return n; return n;
} }
......
...@@ -2048,7 +2048,7 @@ ullmancalc(Node *n) ...@@ -2048,7 +2048,7 @@ ullmancalc(Node *n)
switch(n->op) { switch(n->op) {
case OLITERAL: case OLITERAL:
case ONAME: case ONAME:
ul = 0; ul = 1;
goto out; goto out;
case OCALL: case OCALL:
case OCALLMETH: case OCALLMETH:
...@@ -2056,10 +2056,10 @@ ullmancalc(Node *n) ...@@ -2056,10 +2056,10 @@ ullmancalc(Node *n)
ul = UINF; ul = UINF;
goto out; goto out;
} }
ul = 0; ul = 1;
if(n->left != N) if(n->left != N)
ul = n->left->ullman; ul = n->left->ullman;
ur = 0; ur = 1;
if(n->right != N) if(n->right != N)
ur = n->right->ullman; ur = n->right->ullman;
if(ul == ur) if(ul == ur)
......
...@@ -3053,6 +3053,7 @@ loop1: ...@@ -3053,6 +3053,7 @@ loop1:
fatal("reorder1 OLIST"); fatal("reorder1 OLIST");
t++; t++;
ullmancalc(l);
if(l->ullman >= UINF) if(l->ullman >= UINF)
c++; c++;
l = listnext(&save); l = listnext(&save);
...@@ -3072,6 +3073,7 @@ loop2: ...@@ -3072,6 +3073,7 @@ loop2:
r = list(f, r); r = list(f, r);
return r; return r;
} }
ullmancalc(l);
if(l->ullman < UINF) { if(l->ullman < UINF) {
r = list(l, r); r = list(l, r);
goto more; goto more;
...@@ -3123,6 +3125,7 @@ loop1: ...@@ -3123,6 +3125,7 @@ loop1:
if(l->op == OLIST) if(l->op == OLIST)
fatal("reorder2 OLIST"); fatal("reorder2 OLIST");
ullmancalc(l);
if(l->ullman >= UINF) if(l->ullman >= UINF)
c++; c++;
l = listnext(&save); l = listnext(&save);
......
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