]> Cypherpunks repositories - gostls13.git/commitdiff
comment sudoaddable;
authorRuss Cox <rsc@golang.org>
Tue, 6 Jan 2009 19:23:58 +0000 (11:23 -0800)
committerRuss Cox <rsc@golang.org>
Tue, 6 Jan 2009 19:23:58 +0000 (11:23 -0800)
remove unused second parameter.

R=ken
OCL=22126
CL=22126

src/cmd/6g/cgen.c
src/cmd/6g/gen.c
src/cmd/6g/gg.h
src/cmd/6g/gsubr.c

index bddbfb397907c32595ef7ee903d2f79aaabc1076..0ab1be5c10269f1a314657d638e7b9ad3da9d116 100644 (file)
@@ -66,7 +66,7 @@ cgen(Node *n, Node *res)
                        break;
                }
 
-               if(sudoaddable(res, n->type, &addr)) {
+               if(sudoaddable(res, &addr)) {
                        a = optoas(OAS, res->type);
                        if(f) {
                                regalloc(&n2, res->type, N);
@@ -104,7 +104,7 @@ cgen(Node *n, Node *res)
                goto ret;
        }
 
-       if(sudoaddable(n, res->type, &addr)) {
+       if(sudoaddable(n, &addr)) {
                a = optoas(OAS, n->type);
                if(res->op == OREGISTER) {
                        p1 = gins(a, N, res);
@@ -340,7 +340,7 @@ abop:       // asymmetric binary
                regalloc(&n1, nl->type, res);
                cgen(nl, &n1);
 
-               if(sudoaddable(nr, nl->type, &addr)) {
+               if(sudoaddable(nr, &addr)) {
                        p1 = gins(a, N, &n1);
                        p1->from = addr;
                        gmove(&n1, res);
index 0d0a647d9309c985560f772206a739006c68521d..12e5a11bd382088e15ab39fafc40e6d5fe225b0f 100644 (file)
@@ -987,7 +987,7 @@ cgen_asop(Node *n)
                                gins(optoas(OINC, nl->type), N, nl);
                                goto ret;
                        }
-                       if(sudoaddable(nl, nr->type, &addr)) {
+                       if(sudoaddable(nl, &addr)) {
                                p1 = gins(optoas(OINC, nl->type), N, N);
                                p1->to = addr;
                                sudoclean();
@@ -1003,7 +1003,7 @@ cgen_asop(Node *n)
                                gins(optoas(ODEC, nl->type), N, nl);
                                goto ret;
                        }
-                       if(sudoaddable(nl, nr->type, &addr)) {
+                       if(sudoaddable(nl, &addr)) {
                                p1 = gins(optoas(ODEC, nl->type), N, N);
                                p1->to = addr;
                                sudoclean();
@@ -1031,7 +1031,7 @@ cgen_asop(Node *n)
                        goto ret;
                }
                if(nr->ullman < UINF)
-               if(sudoaddable(nl, nr->type, &addr)) {
+               if(sudoaddable(nl, &addr)) {
                        if(smallintconst(nr)) {
                                p1 = gins(optoas(n->etype, nl->type), nr, N);
                                p1->to = addr;
index bd6f2a96af2d000c8431f624901f15c27049eb9d..a01e5b6e55868044bd0bebb9701f826e1b90e964 100644 (file)
@@ -215,7 +215,7 @@ Plist*      newplist(void);
 int    isfat(Type*);
 void   setmaxarg(Type*);
 void   sudoclean(void);
-int    sudoaddable(Node*, Type*, Addr*);
+int    sudoaddable(Node*, Addr*);
 
 /*
  * list.c
index a4cb8cb05cd1b64e7ebaf0334fc0f53aa51c53a5..3902a47c4f3d49b488e9158ff9c7b5bbb1038a0f 100644 (file)
@@ -1857,8 +1857,19 @@ sudoclean(void)
        cleani -= 2;
 }
 
+/*
+ * generate code to compute address of n,
+ * a reference to a (perhaps nested) field inside
+ * an array or struct.  
+ * return 0 on failure, 1 on success.
+ * on success, leaves usable address in a.
+ *
+ * caller is responsible for calling sudoclean
+ * after successful sudoaddable,
+ * to release the register used for a.
+ */
 int
-sudoaddable(Node *n, Type *t, Addr *a)
+sudoaddable(Node *n, Addr *a)
 {
        int o, i, w;
        int oary[10];
@@ -1866,8 +1877,9 @@ sudoaddable(Node *n, Type *t, Addr *a)
        Node n1, n2, *nn, *l, *r;
        Node *reg, *reg1;
        Prog *p1;
+       Type *t;
 
-       if(n->type == T || t == T)
+       if(n->type == T)
                return 0;
 
        switch(n->op) {