]> Cypherpunks repositories - gostls13.git/commitdiff
8g: fix build on Plan 9
authorLucio De Re <lucio.dere@gmail.com>
Fri, 26 Aug 2011 21:42:59 +0000 (17:42 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 26 Aug 2011 21:42:59 +0000 (17:42 -0400)
8g/cgen.c:
8g/gobj.c
. dropped unnecessary assignments;
8g/gg.h
. added varargckk pragmas;
8g/ggen.c
. dropped duplicate assignment;
8g/gsubr.c
. adjusted format in print statement;
. dropped unnecessary assignment;
. replaced GCC's _builtin_return_address(0) with Plan 9's
  getcallerpc(&n) which is defined as a macro in <u.h>;
8g/list.c
. adjusted format in snprint statement;
8g/opt.h
. added varargck pragma (Adr*) that is specific for the invoking
  modules;
8g/peep.c
. dropped unnecessary incrementation;

R=rsc
CC=golang-dev
https://golang.org/cl/4974044

src/cmd/8g/cgen.c
src/cmd/8g/gg.h
src/cmd/8g/ggen.c
src/cmd/8g/gobj.c
src/cmd/8g/gsubr.c
src/cmd/8g/list.c
src/cmd/8g/opt.h
src/cmd/8g/peep.c

index 27c75eda9da61e595f571b554b285c5f2dc1eb19..4a37514d455264cd470ae5dd997288e96e7f70c2 100644 (file)
@@ -682,7 +682,6 @@ agen(Node *n, Node *res)
                break;
 
        case ODOT:
-               t = nl->type;
                agen(nl, res);
                if(n->xoffset != 0) {
                        nodconst(&n1, types[tptr], n->xoffset);
@@ -800,9 +799,6 @@ bgen(Node *n, int true, Prog *to)
        if(n->ninit != nil)
                genlist(n->ninit);
 
-       nl = n->left;
-       nr = n->right;
-
        if(n->type == T) {
                convlit(&n, types[TBOOL]);
                if(n->type == T)
@@ -815,7 +811,6 @@ bgen(Node *n, int true, Prog *to)
                patch(gins(AEND, N, N), to);
                return;
        }
-       nl = N;
        nr = N;
 
        switch(n->op) {
index 8a6ffdbfb9a73393e6bde7be596eb0a5db1536ab..0d6aaf60f6c22f17948fa5551382c9e811b78dcf 100644 (file)
@@ -179,3 +179,5 @@ void        listinit(void);
 
 void   zaddr(Biobuf*, Addr*, int, int);
 
+#pragma        varargck        type    "D"     Addr*
+#pragma        varargck        type    "lD"    Addr*
index 0d29c05c52125de4ba7c15f9a20f985aae764158..3490a7bd020c0a15f6ca1e9ef897542418a5a18c 100644 (file)
@@ -431,7 +431,6 @@ hard:
        if(nr->ullman >= nl->ullman || nl->addable) {
                mgen(nr, &n2, N);
                nr = &n2;
-               nr = &n2;
        } else {
                tempname(&n2, nr->type);
                cgen(nr, &n2);
index ec2af12f7f5215cb069a7c5326999a806bc68ec9..7b3cabb3df6885ee567adb55cd99b8fc3fa9183e 100644 (file)
@@ -630,7 +630,6 @@ out:
                // but 6l has a bug, and it can't handle
                // JMP instructions too close to the top of
                // a new function.
-               p = pc;
                gins(ANOP, N, N);
        }
 
index ab4cc1cfe162c69b6caa05f312c399bfcf587afb..9ca75730896fe278b130f3c7f8a7078dc9e49d56 100644 (file)
@@ -825,7 +825,7 @@ regalloc(Node *n, Type *t, Node *o)
 
                fprint(2, "registers allocated at\n");
                for(i=D_AX; i<=D_DI; i++)
-                       fprint(2, "\t%R\t%#ux\n", i, regpc[i]);
+                       fprint(2, "\t%R\t%#lux\n", i, regpc[i]);
                yyerror("out of fixed registers");
                goto err;
 
@@ -835,7 +835,6 @@ regalloc(Node *n, Type *t, Node *o)
                goto out;
        }
        yyerror("regalloc: unknown type %T", t);
-       i = 0;
 
 err:
        nodreg(n, t, 0);
@@ -845,7 +844,7 @@ out:
        if (i == D_SP)
                print("alloc SP\n");
        if(reg[i] == 0) {
-               regpc[i] = (ulong)__builtin_return_address(0);
+               regpc[i] = (ulong)getcallerpc(&n);
                if(i == D_AX || i == D_CX || i == D_DX || i == D_SP) {
                        dump("regalloc-o", o);
                        fatal("regalloc %R", i);
index efd9dbbc488828f213435f515961bb54a30993c5..88d3d5f7e34c52d029361a58f1cd4c5449633891 100644 (file)
@@ -130,7 +130,7 @@ Dconv(Fmt *fp)
                if(fp->flags & FmtLong) {
                        d1 = a->offset;
                        d2 = a->offset2;
-                       snprint(str, sizeof(str), "$%ud-%ud", (ulong)d1, (ulong)d2);
+                       snprint(str, sizeof(str), "$%lud-%lud", (ulong)d1, (ulong)d2);
                        break;
                }
                snprint(str, sizeof(str), "$%d", a->offset);
index 8f31dec3b3525a63fc2988402b38c1a61af25d26..ed6eb15ab4812ed1ecf91d7dc586a6a60fa7ffac 100644 (file)
@@ -162,3 +162,5 @@ int32       RtoB(int);
 int32  FtoB(int);
 int    BtoR(int32);
 int    BtoF(int32);
+
+#pragma        varargck        type    "D"     Adr*
index 89c2a7ae744a0beb9a4d0a12d2f60b38af7d2c68..e0e44a5ef4847229f4157bdf0ec2416e758ff0f5 100644 (file)
@@ -884,7 +884,6 @@ loop:
                if(p->from.dval == p0->from.dval)
                if(p->from.index == p0->from.index) {
                        excise(r);
-                       t++;
                        goto loop;
                }
                break;