]> Cypherpunks repositories - gostls13.git/commitdiff
compilers were inconsistent about
authorRuss Cox <rsc@golang.org>
Tue, 14 Jul 2009 02:20:43 +0000 (19:20 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 14 Jul 2009 02:20:43 +0000 (19:20 -0700)
whether no register argument was
REGARG == 0 or REGARG < 0.
use REGARG < 0 because arm needs 0 for R0.

R=ken
OCL=31562
CL=31566

src/cmd/6c/cgen.c
src/cmd/6c/peep.c
src/cmd/6c/txt.c
src/cmd/6l/6.out.h
src/cmd/8c/cgen.c
src/cmd/8c/peep.c
src/cmd/8c/txt.c
src/cmd/8l/8.out.h
src/cmd/cc/pgen.c

index b9ff04070223e7d681672c64b1a3e410bf2ffacc..aba37b1b5c05d2f3dbb8c230c8b97322fd1a9691 100644 (file)
@@ -923,7 +923,9 @@ cgen(Node *n, Node *nn)
 
                        return;
                }
-               o = reg[REGARG];
+               o = 0;
+               if(REGARG >= 0)
+                       o = reg[REGARG];
                gargs(r, &nod, &nod1);
                if(l->addable < INDEXED) {
                        reglcgen(&nod, l, nn);
@@ -932,7 +934,7 @@ cgen(Node *n, Node *nn)
                        regfree(&nod);
                } else
                        gopcode(OFUNC, n->type, Z, l);
-               if(REGARG)
+               if(REGARG >= 0)
                        if(o != reg[REGARG])
                                reg[REGARG]--;
                if(nn != Z) {
index 2800d58c2a66ceff5ffb7fe350391078232f0450..01793bfc5cecd4849b59cf2242e59ed798e08007 100644 (file)
@@ -799,7 +799,7 @@ copyu(Prog *p, Adr *v, Adr *s)
        case ACALL:     /* funny */
                if(REGEXT && v->type <= REGEXT && v->type > exregoffset)
                        return 2;
-               if(REGARG && v->type == REGARG)
+               if(REGARG >= 0 && v->type == REGARG)
                        return 2;
 
                if(s != A) {
@@ -812,7 +812,7 @@ copyu(Prog *p, Adr *v, Adr *s)
                return 3;
 
        case ATEXT:     /* funny */
-               if(REGARG && v->type == REGARG)
+               if(REGARG >= 0 && v->type == REGARG)
                        return 3;
                return 0;
        }
index fba5d2316e531053d19e43e9d0c211b8ad615fd8..f96c40f8ebf2c9802b65dbf290e19a18992e9149 100644 (file)
@@ -247,7 +247,7 @@ garg1(Node *n, Node *tn1, Node *tn2, int f, Node **fnxp)
                        sugen(n, tn2, n->type->width);
                return;
        }
-       if(REGARG && curarg == 0 && typechlpv[n->type->etype]) {
+       if(REGARG >= 0 && curarg == 0 && typechlpv[n->type->etype]) {
                regaalloc1(tn1, n);
                if(n->complex >= FNX) {
                        cgen(*fnxp, tn1);
@@ -437,8 +437,8 @@ regsalloc(Node *n, Node *nn)
 void
 regaalloc1(Node *n, Node *nn)
 {
-       if(REGARG == 0)
-               diag(n, "regaalloc1 and REGARG==0");
+       if(REGARG < 0)
+               diag(n, "regaalloc1 and REGARG<0");
        nodreg(n, nn, REGARG);
        reg[REGARG]++;
        curarg = align(curarg, nn->type, Aarg1);
@@ -1475,7 +1475,7 @@ gpseudo(int a, Sym *s, Node *n)
        p->from.sym = s;
        p->from.scale = textflag;
        textflag = 0;
-       
+
        if(s->class == CSTATIC)
                p->from.type = D_STATIC;
        naddr(n, &p->to);
@@ -1513,8 +1513,8 @@ exreg(Type *t)
 
 schar  ewidth[NTYPE] =
 {
-       -1,             /*[TXXX]*/      
-       SZ_CHAR,        /*[TCHAR]*/     
+       -1,             /*[TXXX]*/
+       SZ_CHAR,        /*[TCHAR]*/
        SZ_CHAR,        /*[TUCHAR]*/
        SZ_SHORT,       /*[TSHORT]*/
        SZ_SHORT,       /*[TUSHORT]*/
@@ -1538,10 +1538,10 @@ int32   ncast[NTYPE] =
 {
        0,                              /*[TXXX]*/
        BCHAR|BUCHAR,                   /*[TCHAR]*/
-       BCHAR|BUCHAR,                   /*[TUCHAR]*/    
+       BCHAR|BUCHAR,                   /*[TUCHAR]*/
        BSHORT|BUSHORT,                 /*[TSHORT]*/
        BSHORT|BUSHORT,                 /*[TUSHORT]*/
-       BINT|BUINT|BLONG|BULONG,        /*[TINT]*/              
+       BINT|BUINT|BLONG|BULONG,        /*[TINT]*/
        BINT|BUINT|BLONG|BULONG,        /*[TUINT]*/
        BINT|BUINT|BLONG|BULONG,        /*[TLONG]*/
        BINT|BUINT|BLONG|BULONG,        /*[TULONG]*/
index 15815f4e0d83eee21d534dbc38c1a7ae183299ef..dc1d057fd19aa100c4eb9a5632d0adb86fa6f359 100644 (file)
@@ -832,7 +832,7 @@ enum
        T_SCONST        = 1<<5,
        T_64            = 1<<6,
 
-       REGARG          = 0,
+       REGARG          = -1,
        REGRET          = D_AX,
        FREGRET         = D_X0,
        REGSP           = D_SP,
index 1df03ef50c3a1c26c4a4274ad58c274dea814f79..0d147b02fa9e35907a2329bc7fa5f704618635e2 100644 (file)
@@ -925,7 +925,7 @@ cgen(Node *n, Node *nn)
                        regfree(&nod);
                } else
                        gopcode(OFUNC, n->type, Z, l);
-               if(REGARG && reg[REGARG])
+               if(REGARG >= 0 && reg[REGARG])
                        reg[REGARG]--;
                if(nn != Z) {
                        regret(&nod, n);
index 64ce5fa78675db69af54dc4b5188a668944dac71..9e18fc94d2dc90d9545f5ef067c757b64da3ab6d 100644 (file)
@@ -713,7 +713,7 @@ copyu(Prog *p, Adr *v, Adr *s)
                return 3;
 
        case ACALL:     /* funny */
-               if(REGARG && v->type == REGARG)
+               if(REGARG >= 0 && v->type == REGARG)
                        return 2;
 
                if(s != A) {
index 5cc43e0e94cccd7f02715fe4c322c59c0887a441..8abaa667d45a56a095e50835e68bf6fed9e28aa1 100644 (file)
@@ -233,7 +233,7 @@ garg1(Node *n, Node *tn1, Node *tn2, int f, Node **fnxp)
                        sugen(n, tn2, n->type->width);
                return;
        }
-       if(REGARG && curarg == 0 && typeilp[n->type->etype]) {
+       if(REGARG >= 0 && curarg == 0 && typeilp[n->type->etype]) {
                regaalloc1(tn1, n);
                if(n->complex >= FNX) {
                        cgen(*fnxp, tn1);
@@ -1409,8 +1409,8 @@ exreg(Type *t)
 
 schar  ewidth[NTYPE] =
 {
-       -1,             /*[TXXX]*/      
-       SZ_CHAR,        /*[TCHAR]*/     
+       -1,             /*[TXXX]*/
+       SZ_CHAR,        /*[TCHAR]*/
        SZ_CHAR,        /*[TUCHAR]*/
        SZ_SHORT,       /*[TSHORT]*/
        SZ_SHORT,       /*[TUSHORT]*/
@@ -1434,10 +1434,10 @@ int32   ncast[NTYPE] =
 {
        0,                              /*[TXXX]*/
        BCHAR|BUCHAR,                   /*[TCHAR]*/
-       BCHAR|BUCHAR,                   /*[TUCHAR]*/    
+       BCHAR|BUCHAR,                   /*[TUCHAR]*/
        BSHORT|BUSHORT,                 /*[TSHORT]*/
        BSHORT|BUSHORT,                 /*[TUSHORT]*/
-       BINT|BUINT|BLONG|BULONG|BIND,   /*[TINT]*/              
+       BINT|BUINT|BLONG|BULONG|BIND,   /*[TINT]*/
        BINT|BUINT|BLONG|BULONG|BIND,   /*[TUINT]*/
        BINT|BUINT|BLONG|BULONG|BIND,   /*[TLONG]*/
        BINT|BUINT|BLONG|BULONG|BIND,   /*[TULONG]*/
index a53624218691881abd6ef8497e7e34b75ffaf6a2..ef85b9d22068f8c23ede10e133865c9687cdb09a 100644 (file)
@@ -460,7 +460,7 @@ enum
        T_SCONST        = 1<<5,
        T_OFFSET2       = 1<<6,
 
-       REGARG          = 0,
+       REGARG          = -1,
        REGRET          = D_AX,
        FREGRET         = D_F0,
        REGSP           = D_SP,
index 2b7402f4ea8111ba27032f7ed6d5a9a7564f9d9c..0b9dc8e163a57c770f73a369d5e118b1e7a3cb6a 100644 (file)
@@ -83,7 +83,7 @@ codgen(Node *n, Node *nn)
        /*
         * isolate first argument
         */
-       if(REGARG) {
+       if(REGARG >= 0) {
                if(typesuv[thisfn->link->etype]) {
                        nod1 = *nodret->left;
                        nodreg(&nod, &nod1, REGARG);
@@ -385,8 +385,8 @@ loop:
                gbranch(OGOTO);         /* entry */
                sp = p;
 
-               /* 
-                * if there are no incoming labels in the 
+               /*
+                * if there are no incoming labels in the
                 * body and the top's not reachable, warn
                 */
                if(!canreach && warnreach && deadheads(n)) {
@@ -410,7 +410,7 @@ loop:
 
                patch(spc, pc);
                gen(l->right->right);   /* inc */
-               patch(sp, pc);  
+               patch(sp, pc);
                if(l->left != Z) {      /* test */
                        bcomplex(l->left, Z);
                        patch(p, breakpc);
@@ -460,7 +460,7 @@ loop:
                 * Don't complain about unreachable break statements.
                 * There are breaks hidden in yacc's output and some people
                 * write return; break; in their switch statements out of habit.
-                * However, don't confuse the analysis by inserting an 
+                * However, don't confuse the analysis by inserting an
                 * unreachable reference to breakpc either.
                 */
                if(!canreach)
@@ -488,7 +488,7 @@ loop:
                                canreach = 1;
                                gen(n->right->right);
                                /*
-                                * treat constant ifs as regular ifs for 
+                                * treat constant ifs as regular ifs for
                                 * reachability warnings.
                                 */
                                if(!canreach && oldreach && debug['w'] < 2)
@@ -501,7 +501,7 @@ loop:
                                canreach = 1;
                                supgen(n->right->right);
                                /*
-                                * treat constant ifs as regular ifs for 
+                                * treat constant ifs as regular ifs for
                                 * reachability warnings.
                                 */
                                if(!oldreach && canreach && debug['w'] < 2)