diff options
Diffstat (limited to 'src/cmd/gc/walk.c')
-rw-r--r-- | src/cmd/gc/walk.c | 73 |
1 files changed, 50 insertions, 23 deletions
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 6b3860d28..0c89ff138 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -1789,6 +1789,14 @@ badt: return nl; } +/* + * from ascompat[te] + * evaluating actual function arguments. + * f(a,b) + * if there is exactly one function expr, + * then it is done first. otherwise must + * make temp variables + */ Node* reorder1(Node *n) { @@ -1796,15 +1804,6 @@ reorder1(Node *n) Node *l, *r, *f, *a, *g; int c, t; - /* - * from ascompat[te] - * evaluating actual function arguments. - * f(a,b) - * if there is exactly one function expr, - * then it is done first. otherwise must - * make temp variables - */ - l = listfirst(&save, &n); c = 0; // function calls t = 0; // total parameters @@ -1874,6 +1873,13 @@ more: goto loop2; } +/* + * from ascompat[et] + * a,b = f() + * return of a multi. + * there can be no function calls at all, + * or they will over-write the return values. + */ Node* reorder2(Node *n) { @@ -1881,14 +1887,6 @@ reorder2(Node *n) Node *l; int c; - /* - * from ascompat[et] - * a,b = f() - * return of a multi. - * there can be no function calls at all, - * or they will over-write the return values. - */ - l = listfirst(&save, &n); c = 0; @@ -1907,15 +1905,44 @@ loop1: goto loop1; } +/* + * from ascompat[ee] + * a,b = c,d + * simultaneous assignment. there can be + * later use of an earlier lvalue. + */ +int +vmatch(Node *l, Node *r) +{ + dump("l", l); + dump("r", r); + return 0; +} + Node* reorder3(Node *n) { - /* - * from ascompat[ee] - * a,b = c,d - * simultaneous assignment. there can be - * later use of an earlier lvalue. - */ + Iter save1, save2; + Node *l1, *l2; + int c1, c2; + + l1 = listfirst(&save1, &n); + c1 = 0; + + while(l1 != N) { + l2 = listfirst(&save1, &n); + c2 = 0; + while(l2 != N) { + if(c2 > c1) { + if(vmatch(l1->left, l2->right)) { + } + } + l2 = listnext(&save1); + c2++; + } + l1 = listnext(&save1); + c1++; + } return n; } |