From: Lucio De Re Date: Fri, 26 Aug 2011 21:42:59 +0000 (-0400) Subject: 8g: fix build on Plan 9 X-Git-Tag: weekly.2011-09-01~56 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=f6a9807f565e4e7c4091833737ea77fa5eb3e412;p=gostls13.git 8g: fix build on Plan 9 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 ; 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 --- diff --git a/src/cmd/8g/cgen.c b/src/cmd/8g/cgen.c index 27c75eda9d..4a37514d45 100644 --- a/src/cmd/8g/cgen.c +++ b/src/cmd/8g/cgen.c @@ -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) { diff --git a/src/cmd/8g/gg.h b/src/cmd/8g/gg.h index 8a6ffdbfb9..0d6aaf60f6 100644 --- a/src/cmd/8g/gg.h +++ b/src/cmd/8g/gg.h @@ -179,3 +179,5 @@ void listinit(void); void zaddr(Biobuf*, Addr*, int, int); +#pragma varargck type "D" Addr* +#pragma varargck type "lD" Addr* diff --git a/src/cmd/8g/ggen.c b/src/cmd/8g/ggen.c index 0d29c05c52..3490a7bd02 100644 --- a/src/cmd/8g/ggen.c +++ b/src/cmd/8g/ggen.c @@ -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); diff --git a/src/cmd/8g/gobj.c b/src/cmd/8g/gobj.c index ec2af12f7f..7b3cabb3df 100644 --- a/src/cmd/8g/gobj.c +++ b/src/cmd/8g/gobj.c @@ -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); } diff --git a/src/cmd/8g/gsubr.c b/src/cmd/8g/gsubr.c index ab4cc1cfe1..9ca7573089 100644 --- a/src/cmd/8g/gsubr.c +++ b/src/cmd/8g/gsubr.c @@ -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); diff --git a/src/cmd/8g/list.c b/src/cmd/8g/list.c index efd9dbbc48..88d3d5f7e3 100644 --- a/src/cmd/8g/list.c +++ b/src/cmd/8g/list.c @@ -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); diff --git a/src/cmd/8g/opt.h b/src/cmd/8g/opt.h index 8f31dec3b3..ed6eb15ab4 100644 --- a/src/cmd/8g/opt.h +++ b/src/cmd/8g/opt.h @@ -162,3 +162,5 @@ int32 RtoB(int); int32 FtoB(int); int BtoR(int32); int BtoF(int32); + +#pragma varargck type "D" Adr* diff --git a/src/cmd/8g/peep.c b/src/cmd/8g/peep.c index 89c2a7ae74..e0e44a5ef4 100644 --- a/src/cmd/8g/peep.c +++ b/src/cmd/8g/peep.c @@ -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;