1
0
mirror of https://github.com/golang/go synced 2024-10-03 09:21:21 -06:00

various: avoid %ld etc

The Plan 9 tools assume that long is 32 bits.
We converted all instances of long to int32 when
importing the code but missed the print formats.
Because int32 is always int on the compilers we use,
it is never correct to use %lux, %ld, etc.  Convert to %ux, %d, etc.

(It matters because on 64-bit gcc, long is 64 bits,
so we were printing 32-bit quantities with 64-bit formats.)

R=ken2
CC=golang-dev
https://golang.org/cl/2491041
This commit is contained in:
Russ Cox 2010-10-13 16:20:22 -04:00
parent 085be1740a
commit d9c989fa25
46 changed files with 197 additions and 197 deletions

View File

@ -59,7 +59,7 @@ Bconv(Fmt *fp)
if(str[0]) if(str[0])
strcat(str, " "); strcat(str, " ");
if(var[i].sym == S) { if(var[i].sym == S) {
sprint(ss, "$%ld", var[i].offset); sprint(ss, "$%d", var[i].offset);
s = ss; s = ss;
} else } else
s = var[i].sym->name; s = var[i].sym->name;
@ -204,7 +204,7 @@ Dconv(Fmt *fp)
break; break;
case D_BRANCH: case D_BRANCH:
sprint(str, "%ld(PC)", a->offset-pc); sprint(str, "%d(PC)", a->offset-pc);
break; break;
case D_FCONST: case D_FCONST:
@ -307,7 +307,7 @@ Nconv(Fmt *fp)
a = va_arg(fp->args, Adr*); a = va_arg(fp->args, Adr*);
s = a->sym; s = a->sym;
if(s == S) { if(s == S) {
sprint(str, "%ld", a->offset); sprint(str, "%d", a->offset);
goto out; goto out;
} }
switch(a->name) { switch(a->name) {
@ -316,23 +316,23 @@ Nconv(Fmt *fp)
break; break;
case D_NONE: case D_NONE:
sprint(str, "%ld", a->offset); sprint(str, "%d", a->offset);
break; break;
case D_EXTERN: case D_EXTERN:
sprint(str, "%s+%ld(SB)", s->name, a->offset); sprint(str, "%s+%d(SB)", s->name, a->offset);
break; break;
case D_STATIC: case D_STATIC:
sprint(str, "%s<>+%ld(SB)", s->name, a->offset); sprint(str, "%s<>+%d(SB)", s->name, a->offset);
break; break;
case D_AUTO: case D_AUTO:
sprint(str, "%s-%ld(SP)", s->name, -a->offset); sprint(str, "%s-%d(SP)", s->name, -a->offset);
break; break;
case D_PARAM: case D_PARAM:
sprint(str, "%s+%ld(FP)", s->name, a->offset); sprint(str, "%s+%d(FP)", s->name, a->offset);
break; break;
} }
out: out:

View File

@ -115,7 +115,7 @@ mulcon0(int32 v)
if(docode(hintab[g].hint, m->code, 1, 0)) if(docode(hintab[g].hint, m->code, 1, 0))
return m; return m;
print("multiply table failure %ld\n", v); print("multiply table failure %d\n", v);
m->code[0] = 0; m->code[0] = 0;
return 0; return 0;
@ -132,7 +132,7 @@ no:
if(gen1(g)) { if(gen1(g)) {
if(docode(hint, m->code, 1, 0)) if(docode(hint, m->code, 1, 0))
return m; return m;
print("multiply table failure %ld\n", v); print("multiply table failure %d\n", v);
break; break;
} }
} }

View File

@ -309,7 +309,7 @@ loop2:
if(debug['R'] && debug['v']) { if(debug['R'] && debug['v']) {
print("\nprop structure:\n"); print("\nprop structure:\n");
for(r = firstr; r != R; r = r->link) { for(r = firstr; r != R; r = r->link) {
print("%ld:%P", r->loop, r->prog); print("%d:%P", r->loop, r->prog);
for(z=0; z<BITS; z++) for(z=0; z<BITS; z++)
bit.b[z] = r->set.b[z] | bit.b[z] = r->set.b[z] |
r->refahead.b[z] | r->calahead.b[z] | r->refahead.b[z] | r->calahead.b[z] |
@ -955,7 +955,7 @@ paint1(Reg *r, int bn)
if(LOAD(r) & ~(r->set.b[z] & ~(r->use1.b[z]|r->use2.b[z])) & bb) { if(LOAD(r) & ~(r->set.b[z] & ~(r->use1.b[z]|r->use2.b[z])) & bb) {
change -= CLOAD * r->loop; change -= CLOAD * r->loop;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tld %B $%d\n", r->loop, print("%d%P\td %B $%d\n", r->loop,
r->prog, blsh(bn), change); r->prog, blsh(bn), change);
} }
for(;;) { for(;;) {
@ -965,21 +965,21 @@ paint1(Reg *r, int bn)
if(r->use1.b[z] & bb) { if(r->use1.b[z] & bb) {
change += CREF * r->loop; change += CREF * r->loop;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tu1 %B $%d\n", r->loop, print("%d%P\tu1 %B $%d\n", r->loop,
p, blsh(bn), change); p, blsh(bn), change);
} }
if((r->use2.b[z]|r->set.b[z]) & bb) { if((r->use2.b[z]|r->set.b[z]) & bb) {
change += CREF * r->loop; change += CREF * r->loop;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tu2 %B $%d\n", r->loop, print("%d%P\tu2 %B $%d\n", r->loop,
p, blsh(bn), change); p, blsh(bn), change);
} }
if(STORE(r) & r->regdiff.b[z] & bb) { if(STORE(r) & r->regdiff.b[z] & bb) {
change -= CLOAD * r->loop; change -= CLOAD * r->loop;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tst %B $%d\n", r->loop, print("%d%P\tst %B $%d\n", r->loop,
p, blsh(bn), change); p, blsh(bn), change);
} }

View File

@ -47,7 +47,7 @@ swit1(C1 *q, int nc, int32 def, Node *n)
if(nc < 5) { if(nc < 5) {
for(i=0; i<nc; i++) { for(i=0; i<nc; i++) {
if(debug['W']) if(debug['W'])
print("case = %.8lux\n", q->val); print("case = %.8ux\n", q->val);
gopcode(OEQ, nodconst(q->val), n, Z); gopcode(OEQ, nodconst(q->val), n, Z);
patch(p, q->label); patch(p, q->label);
q++; q++;
@ -60,7 +60,7 @@ swit1(C1 *q, int nc, int32 def, Node *n)
i = nc / 2; i = nc / 2;
r = q+i; r = q+i;
if(debug['W']) if(debug['W'])
print("case > %.8lux\n", r->val); print("case > %.8ux\n", r->val);
gopcode(OGT, nodconst(r->val), n, Z); gopcode(OGT, nodconst(r->val), n, Z);
sp = p; sp = p;
gopcode(OEQ, nodconst(r->val), n, Z); /* just gen the B.EQ */ gopcode(OEQ, nodconst(r->val), n, Z); /* just gen the B.EQ */
@ -68,7 +68,7 @@ swit1(C1 *q, int nc, int32 def, Node *n)
swit1(q, i, def, n); swit1(q, i, def, n);
if(debug['W']) if(debug['W'])
print("case < %.8lux\n", r->val); print("case < %.8ux\n", r->val);
patch(sp, pc); patch(sp, pc);
swit1(r+1, nc-i-1, def, n); swit1(r+1, nc-i-1, def, n);
return; return;
@ -81,7 +81,7 @@ direct:
patch(p, def); patch(p, def);
for(i=0; i<nc; i++) { for(i=0; i<nc; i++) {
if(debug['W']) if(debug['W'])
print("case = %.8lux\n", q->val); print("case = %.8ux\n", q->val);
while(q->val != v) { while(q->val != v) {
nextpc(); nextpc();
p->as = ABCASE; p->as = ABCASE;
@ -227,7 +227,7 @@ mulcon(Node *n, Node *nn)
return 0; return 0;
} }
if(debug['M'] && debug['v']) if(debug['M'] && debug['v'])
print("%L multiply: %ld\n", n->lineno, v); print("%L multiply: %d\n", n->lineno, v);
memmove(code, m->code, sizeof(m->code)); memmove(code, m->code, sizeof(m->code));
code[sizeof(m->code)] = 0; code[sizeof(m->code)] = 0;
@ -668,7 +668,7 @@ align(int32 i, Type *t, int op)
} }
o = xround(o, w); o = xround(o, w);
if(debug['A']) if(debug['A'])
print("align %s %ld %T = %ld\n", bnames[op], i, t, o); print("align %s %d %T = %d\n", bnames[op], i, t, o);
return o; return o;
} }

View File

@ -57,18 +57,18 @@ Pconv(Fmt *fp)
switch(p->as) { switch(p->as) {
default: default:
if(p->reg == NREG) if(p->reg == NREG)
snprint(str, sizeof(str), "%.4ld (%L) %-7A%C %D,%D", snprint(str, sizeof(str), "%.4d (%L) %-7A%C %D,%D",
p->loc, p->lineno, p->as, p->scond, &p->from, &p->to); p->loc, p->lineno, p->as, p->scond, &p->from, &p->to);
else if (p->from.type != D_FREG) else if (p->from.type != D_FREG)
snprint(str, sizeof(str), "%.4ld (%L) %-7A%C %D,R%d,%D", snprint(str, sizeof(str), "%.4d (%L) %-7A%C %D,R%d,%D",
p->loc, p->lineno, p->as, p->scond, &p->from, p->reg, &p->to); p->loc, p->lineno, p->as, p->scond, &p->from, p->reg, &p->to);
else else
snprint(str, sizeof(str), "%.4ld (%L) %-7A%C %D,F%d,%D", snprint(str, sizeof(str), "%.4d (%L) %-7A%C %D,F%d,%D",
p->loc, p->lineno, p->as, p->scond, &p->from, p->reg, &p->to); p->loc, p->lineno, p->as, p->scond, &p->from, p->reg, &p->to);
break; break;
case ADATA: case ADATA:
snprint(str, sizeof(str), "%.4ld (%L) %-7A %D/%d,%D", snprint(str, sizeof(str), "%.4d (%L) %-7A %D/%d,%D",
p->loc, p->lineno, p->as, &p->from, p->reg, &p->to); p->loc, p->lineno, p->as, &p->from, p->reg, &p->to);
break; break;
} }

View File

@ -863,12 +863,12 @@ asmb(void)
} }
cflush(); cflush();
if(debug['c']){ if(debug['c']){
print("textsize=%ld\n", textsize); print("textsize=%d\n", textsize);
print("datsize=%ld\n", datsize); print("datsize=%d\n", datsize);
print("bsssize=%ld\n", bsssize); print("bsssize=%d\n", bsssize);
print("symsize=%ld\n", symsize); print("symsize=%d\n", symsize);
print("lcsize=%ld\n", lcsize); print("lcsize=%d\n", lcsize);
print("total=%ld\n", textsize+datsize+bsssize+symsize+lcsize); print("total=%d\n", textsize+datsize+bsssize+symsize+lcsize);
} }
} }
@ -980,7 +980,7 @@ void
nopstat(char *f, Count *c) nopstat(char *f, Count *c)
{ {
if(c->outof) if(c->outof)
Bprint(&bso, "%s delay %ld/%ld (%.2f)\n", f, Bprint(&bso, "%s delay %d/%d (%.2f)\n", f,
c->outof - c->count, c->outof, c->outof - c->count, c->outof,
(double)(c->outof - c->count)/c->outof); (double)(c->outof - c->count)/c->outof);
} }
@ -1186,7 +1186,7 @@ PP = p;
o5 = 0; o5 = 0;
o6 = 0; o6 = 0;
armsize += o->size; armsize += o->size;
if(debug['P']) print("%ulx: %P type %d\n", (uint32)(p->pc), p, o->type); if(debug['P']) print("%ux: %P type %d\n", (uint32)(p->pc), p, o->type);
switch(o->type) { switch(o->type) {
default: default:
diag("unknown asm %d", o->type); diag("unknown asm %d", o->type);
@ -1194,7 +1194,7 @@ if(debug['P']) print("%ulx: %P type %d\n", (uint32)(p->pc), p, o->type);
break; break;
case 0: /* pseudo ops */ case 0: /* pseudo ops */
if(debug['G']) print("%ulx: %s: arm %d %d %d %d\n", (uint32)(p->pc), p->from.sym->name, p->from.sym->thumb, p->from.sym->foreign, p->from.sym->fnptr, p->from.sym->used); if(debug['G']) print("%ux: %s: arm %d %d %d %d\n", (uint32)(p->pc), p->from.sym->name, p->from.sym->thumb, p->from.sym->foreign, p->from.sym->fnptr, p->from.sym->used);
break; break;
case 1: /* op R,[R],R */ case 1: /* op R,[R],R */

View File

@ -263,9 +263,9 @@ Dconv(Fmt *fp)
if(curp->cond != P) { if(curp->cond != P) {
v = curp->cond->pc; v = curp->cond->pc;
if(a->sym != S) if(a->sym != S)
snprint(str, sizeof str, "%s+%.5lux(BRANCH)", a->sym->name, v); snprint(str, sizeof str, "%s+%.5ux(BRANCH)", a->sym->name, v);
else else
snprint(str, sizeof str, "%.5lux(BRANCH)", v); snprint(str, sizeof str, "%.5ux(BRANCH)", v);
} else } else
if(a->sym != S) if(a->sym != S)
snprint(str, sizeof str, "%s+%d(APC)", a->sym->name, a->offset); snprint(str, sizeof str, "%s+%d(APC)", a->sym->name, a->offset);

View File

@ -210,10 +210,10 @@ main(int argc, char *argv[])
break; break;
} }
if(INITDAT != 0 && INITRND != 0) if(INITDAT != 0 && INITRND != 0)
print("warning: -D0x%lux is ignored because of -R0x%lux\n", print("warning: -D0x%ux is ignored because of -R0x%ux\n",
INITDAT, INITRND); INITDAT, INITRND);
if(debug['v']) if(debug['v'])
Bprint(&bso, "HEADER = -H0x%d -T0x%lux -D0x%lux -R0x%lux\n", Bprint(&bso, "HEADER = -H0x%d -T0x%ux -D0x%ux -R0x%ux\n",
HEADTYPE, INITTEXT, INITDAT, INITRND); HEADTYPE, INITTEXT, INITDAT, INITRND);
Bflush(&bso); Bflush(&bso);
zprg.as = AGOK; zprg.as = AGOK;
@ -454,7 +454,7 @@ loop:
if(sig != 0){ if(sig != 0){
if(s->sig != 0 && s->sig != sig) if(s->sig != 0 && s->sig != sig)
diag("incompatible type signatures %lux(%s) and %lux(%s) for %s", s->sig, s->file, sig, pn, s->name); diag("incompatible type signatures %ux(%s) and %ux(%s) for %s", s->sig, s->file, sig, pn, s->name);
s->sig = sig; s->sig = sig;
s->file = pn; s->file = pn;
} }
@ -675,7 +675,7 @@ loop:
if(p->from.type == D_FCONST && chipfloat(p->from.ieee) < 0) { if(p->from.type == D_FCONST && chipfloat(p->from.ieee) < 0) {
/* size sb 9 max */ /* size sb 9 max */
sprint(literal, "$%lux", ieeedtof(p->from.ieee)); sprint(literal, "$%ux", ieeedtof(p->from.ieee));
s = lookup(literal, 0); s = lookup(literal, 0);
if(s->type == 0) { if(s->type == 0) {
s->type = SBSS; s->type = SBSS;
@ -710,7 +710,7 @@ loop:
if(p->from.type == D_FCONST && chipfloat(p->from.ieee) < 0) { if(p->from.type == D_FCONST && chipfloat(p->from.ieee) < 0) {
/* size sb 18 max */ /* size sb 18 max */
sprint(literal, "$%lux.%lux", sprint(literal, "$%ux.%ux",
p->from.ieee->l, p->from.ieee->h); p->from.ieee->l, p->from.ieee->h);
s = lookup(literal, 0); s = lookup(literal, 0);
if(s->type == 0) { if(s->type == 0) {

View File

@ -55,7 +55,7 @@ dodata(void)
s->type, s->name, p); s->type, s->name, p);
v = p->from.offset + p->reg; v = p->from.offset + p->reg;
if(v > s->value) if(v > s->value)
diag("initialize bounds (%ld/%ld): %s\n%P", diag("initialize bounds (%d/%d): %s\n%P",
v, s->value, s->name, p); v, s->value, s->name, p);
if((s->type == SBSS || s->type == SDATA) && (p->to.type == D_CONST || p->to.type == D_OCONST) && (p->to.name == D_EXTERN || p->to.name == D_STATIC)){ if((s->type == SBSS || s->type == SDATA) && (p->to.type == D_CONST || p->to.type == D_OCONST) && (p->to.name == D_EXTERN || p->to.name == D_STATIC)){
s = p->to.sym; s = p->to.sym;
@ -394,7 +394,7 @@ patch(void)
q = q->link; q = q->link;
} }
if(q == P) { if(q == P) {
diag("branch out of range %ld\n%P", c, p); diag("branch out of range %d\n%P", c, p);
p->to.type = D_NONE; p->to.type = D_NONE;
} }
p->cond = q; p->cond = q;

View File

@ -392,7 +392,7 @@ span(void)
if(INITRND) if(INITRND)
INITDAT = rnd(c, INITRND); INITDAT = rnd(c, INITRND);
if(debug['v']) if(debug['v'])
Bprint(&bso, "tsize = %lux\n", textsize); Bprint(&bso, "tsize = %ux\n", textsize);
Bflush(&bso); Bflush(&bso);
} }
@ -426,7 +426,7 @@ flushpool(Prog *p, int skip, int force)
if(blitrl) { if(blitrl) {
if(skip){ if(skip){
if(0 && skip==1)print("note: flush literal pool at %lux: len=%lud ref=%lux\n", p->pc+4, pool.size, pool.start); if(0 && skip==1)print("note: flush literal pool at %ux: len=%ud ref=%ux\n", p->pc+4, pool.size, pool.start);
q = prg(); q = prg();
q->as = AB; q->as = AB;
q->to.type = D_BRANCH; q->to.type = D_BRANCH;

View File

@ -105,7 +105,7 @@ asmsym(void)
putsymb(a->asym->name, 'p', a->aoffset, 0); putsymb(a->asym->name, 'p', a->aoffset, 0);
} }
if(debug['v'] || debug['n']) if(debug['v'] || debug['n'])
Bprint(&bso, "symsize = %lud\n", symsize); Bprint(&bso, "symsize = %ud\n", symsize);
Bflush(&bso); Bflush(&bso);
} }

View File

@ -683,7 +683,7 @@ thumbasmout(Prog *p, Optab *o)
rt = p->to.reg; rt = p->to.reg;
r = p->reg; r = p->reg;
o1 = o2 = o3 = o4 = o5 = o6 = o7 = 0; o1 = o2 = o3 = o4 = o5 = o6 = o7 = 0;
if(debug['P']) print("%ulx: %P type %d %d\n", (uint32)(p->pc), p, o->type, p->align); if(debug['P']) print("%ux: %P type %d %d\n", (uint32)(p->pc), p, o->type, p->align);
opcount[o->type] += o->size; opcount[o->type] += o->size;
switch(o->type) { switch(o->type) {
default: default:
@ -691,7 +691,7 @@ if(debug['P']) print("%ulx: %P type %d %d\n", (uint32)(p->pc), p, o->type, p->al
prasm(p); prasm(p);
break; break;
case 0: /* pseudo ops */ case 0: /* pseudo ops */
if(debug['G']) print("%ulx: %s: thumb\n", (uint32)(p->pc), p->from.sym->name); if(debug['G']) print("%ux: %s: thumb\n", (uint32)(p->pc), p->from.sym->name);
break; break;
case 1: /* op R, -, R or op R, R, - */ case 1: /* op R, -, R or op R, R, - */
o1 = thumboprr(p->as); o1 = thumboprr(p->as);
@ -1162,29 +1162,29 @@ if(debug['G']) print("%ulx: %s: thumb\n", (uint32)(p->pc), p->from.sym->name);
switch(o->size) { switch(o->size) {
default: default:
if(debug['a']) if(debug['a'])
Bprint(&bso, " %.8lux:\t\t%P\n", v, p); Bprint(&bso, " %.8ux:\t\t%P\n", v, p);
break; break;
case 2: case 2:
if(debug['a']) if(debug['a'])
Bprint(&bso, " %.8lux: %.8lux\t%P\n", v, o1, p); Bprint(&bso, " %.8ux: %.8ux\t%P\n", v, o1, p);
hputl(o1); hputl(o1);
break; break;
case 4: case 4:
if(debug['a']) if(debug['a'])
Bprint(&bso, " %.8lux: %.8lux %.8lux\t%P\n", v, o1, o2, p); Bprint(&bso, " %.8ux: %.8ux %.8ux\t%P\n", v, o1, o2, p);
hputl(o1); hputl(o1);
hputl(o2); hputl(o2);
break; break;
case 6: case 6:
if(debug['a']) if(debug['a'])
Bprint(&bso, "%.8lux: %.8lux %.8lux %.8lux\t%P\n", v, o1, o2, o3, p); Bprint(&bso, "%.8ux: %.8ux %.8ux %.8ux\t%P\n", v, o1, o2, o3, p);
hputl(o1); hputl(o1);
hputl(o2); hputl(o2);
hputl(o3); hputl(o3);
break; break;
case 8: case 8:
if(debug['a']) if(debug['a'])
Bprint(&bso, "%.8lux: %.8lux %.8lux %.8lux %.8lux\t%P\n", v, o1, o2, o3, o4, p); Bprint(&bso, "%.8ux: %.8ux %.8ux %.8ux %.8ux\t%P\n", v, o1, o2, o3, o4, p);
hputl(o1); hputl(o1);
hputl(o2); hputl(o2);
hputl(o3); hputl(o3);
@ -1192,7 +1192,7 @@ if(debug['G']) print("%ulx: %s: thumb\n", (uint32)(p->pc), p->from.sym->name);
break; break;
case 10: case 10:
if(debug['a']) if(debug['a'])
Bprint(&bso, "%.8lux: %.8lux %.8lux %.8lux %.8lux %.8lux\t%P\n", v, o1, o2, o3, o4, o5, p); Bprint(&bso, "%.8ux: %.8ux %.8ux %.8ux %.8ux %.8ux\t%P\n", v, o1, o2, o3, o4, o5, p);
hputl(o1); hputl(o1);
hputl(o2); hputl(o2);
hputl(o3); hputl(o3);
@ -1201,7 +1201,7 @@ if(debug['G']) print("%ulx: %s: thumb\n", (uint32)(p->pc), p->from.sym->name);
break; break;
case 12: case 12:
if(debug['a']) if(debug['a'])
Bprint(&bso, "%.8lux: %.8lux %.8lux %.8lux %.8lux %.8lux %.8lux\t%P\n", v, o1, o2, o3, o4, o5, o6, p); Bprint(&bso, "%.8ux: %.8ux %.8ux %.8ux %.8ux %.8ux %.8ux\t%P\n", v, o1, o2, o3, o4, o5, o6, p);
hputl(o1); hputl(o1);
hputl(o2); hputl(o2);
hputl(o3); hputl(o3);
@ -1211,7 +1211,7 @@ if(debug['G']) print("%ulx: %s: thumb\n", (uint32)(p->pc), p->from.sym->name);
break; break;
case 14: case 14:
if(debug['a']) if(debug['a'])
Bprint(&bso, "%.8lux: %.8lux %.8lux %.8lux %.8lux %.8lux %.8lux %.8lux\t%P\n", v, o1, o2, o3, o4, o5, o6, o7, p); Bprint(&bso, "%.8ux: %.8ux %.8ux %.8ux %.8ux %.8ux %.8ux %.8ux\t%P\n", v, o1, o2, o3, o4, o5, o6, o7, p);
hputl(o1); hputl(o1);
hputl(o2); hputl(o2);
hputl(o3); hputl(o3);
@ -1223,12 +1223,12 @@ if(debug['G']) print("%ulx: %s: thumb\n", (uint32)(p->pc), p->from.sym->name);
} }
if(debug['G']){ if(debug['G']){
if(o->type == 17){ if(o->type == 17){
print("%lx: word %ld\n", p->pc, (o2<<16)+o1); print("%x: word %d\n", p->pc, (o2<<16)+o1);
return; return;
} }
if(o->type == 50){ if(o->type == 50){
print("%lx: word %ld\n", p->pc, (o2<<16)+o1); print("%x: word %d\n", p->pc, (o2<<16)+o1);
print("%lx: word %ld\n", p->pc, (o4<<16)+o3); print("%x: word %d\n", p->pc, (o4<<16)+o3);
return; return;
} }
if(o->size > 0) dis(o1, p->pc); if(o->size > 0) dis(o1, p->pc);

View File

@ -120,7 +120,7 @@ sdivgen(Node *l, Node *r, Node *ax, Node *dx)
if(c < 0) if(c < 0)
c = -c; c = -c;
a = sdiv(c, &m, &s); a = sdiv(c, &m, &s);
//print("a=%d i=%ld s=%d m=%lux\n", a, (long)r->vconst, s, m); //print("a=%d i=%d s=%d m=%ux\n", a, (long)r->vconst, s, m);
gins(AMOVL, nodconst(m), ax); gins(AMOVL, nodconst(m), ax);
gins(AIMULL, l, Z); gins(AIMULL, l, Z);
gins(AMOVL, l, ax); gins(AMOVL, l, ax);
@ -141,7 +141,7 @@ udivgen(Node *l, Node *r, Node *ax, Node *dx)
Node nod; Node nod;
a = udiv(r->vconst, &m, &s, &t); a = udiv(r->vconst, &m, &s, &t);
//print("a=%ud i=%ld p=%d s=%d m=%lux\n", a, (long)r->vconst, t, s, m); //print("a=%ud i=%d p=%d s=%d m=%ux\n", a, (long)r->vconst, t, s, m);
if(t != 0) { if(t != 0) {
gins(AMOVL, l, ax); gins(AMOVL, l, ax);
gins(ASHRL, nodconst(t), ax); gins(ASHRL, nodconst(t), ax);

View File

@ -355,7 +355,7 @@ mulgen1(uint32 v, Node *n)
mulparam(v, p); mulparam(v, p);
found: found:
// print("v=%.lx a=%d n=%d s=%d g=%d o=%d \n", p->value, p->alg, p->neg, p->shift, p->arg, p->off); // print("v=%.x a=%d n=%d s=%d g=%d o=%d \n", p->value, p->alg, p->neg, p->shift, p->arg, p->off);
if(p->alg < 0) if(p->alg < 0)
return 0; return 0;

View File

@ -448,7 +448,7 @@ regopt(Prog *p)
if(debug['R'] && debug['v']) { if(debug['R'] && debug['v']) {
print("\nlooping structure:\n"); print("\nlooping structure:\n");
for(r = firstr; r != R; r = r->link) { for(r = firstr; r != R; r = r->link) {
print("%ld:%P", r->loop, r->prog); print("%d:%P", r->loop, r->prog);
for(z=0; z<BITS; z++) for(z=0; z<BITS; z++)
bit.b[z] = r->use1.b[z] | bit.b[z] = r->use1.b[z] |
r->use2.b[z] | r->use2.b[z] |
@ -1113,7 +1113,7 @@ paint1(Reg *r, int bn)
if(LOAD(r) & ~(r->set.b[z]&~(r->use1.b[z]|r->use2.b[z])) & bb) { if(LOAD(r) & ~(r->set.b[z]&~(r->use1.b[z]|r->use2.b[z])) & bb) {
change -= CLOAD * r->loop; change -= CLOAD * r->loop;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tld %B $%d\n", r->loop, print("%d%P\td %B $%d\n", r->loop,
r->prog, blsh(bn), change); r->prog, blsh(bn), change);
} }
for(;;) { for(;;) {
@ -1123,21 +1123,21 @@ paint1(Reg *r, int bn)
if(r->use1.b[z] & bb) { if(r->use1.b[z] & bb) {
change += CREF * r->loop; change += CREF * r->loop;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tu1 %B $%d\n", r->loop, print("%d%P\tu1 %B $%d\n", r->loop,
p, blsh(bn), change); p, blsh(bn), change);
} }
if((r->use2.b[z]|r->set.b[z]) & bb) { if((r->use2.b[z]|r->set.b[z]) & bb) {
change += CREF * r->loop; change += CREF * r->loop;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tu2 %B $%d\n", r->loop, print("%d%P\tu2 %B $%d\n", r->loop,
p, blsh(bn), change); p, blsh(bn), change);
} }
if(STORE(r) & r->regdiff.b[z] & bb) { if(STORE(r) & r->regdiff.b[z] & bb) {
change -= CLOAD * r->loop; change -= CLOAD * r->loop;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tst %B $%d\n", r->loop, print("%d%P\tst %B $%d\n", r->loop,
p, blsh(bn), change); p, blsh(bn), change);
} }
@ -1174,7 +1174,7 @@ regset(Reg *r, uint32 bb)
while(b = bb & ~(bb-1)) { while(b = bb & ~(bb-1)) {
v.type = b & 0xFFFF? BtoR(b): BtoF(b); v.type = b & 0xFFFF? BtoR(b): BtoF(b);
if(v.type == 0) if(v.type == 0)
diag(Z, "zero v.type for %#lux", b); diag(Z, "zero v.type for %#ux", b);
c = copyu(r->prog, &v, A); c = copyu(r->prog, &v, A);
if(c == 3) if(c == 3)
set |= b; set |= b;

View File

@ -566,7 +566,7 @@ align(int32 i, Type *t, int op)
} }
o = xround(o, w); o = xround(o, w);
if(debug['A']) if(debug['A'])
print("align %s %ld %T = %ld\n", bnames[op], i, t, o); print("align %s %d %T = %d\n", bnames[op], i, t, o);
return o; return o;
} }

View File

@ -56,18 +56,18 @@ Pconv(Fmt *fp)
snprint(scale, sizeof scale, "%d,", p->from.scale); snprint(scale, sizeof scale, "%d,", p->from.scale);
switch(p->as) { switch(p->as) {
default: default:
snprint(str, sizeof(str), "%.4ld (%L) %-7A %D,%s%D", snprint(str, sizeof(str), "%.4d (%L) %-7A %D,%s%D",
p->loc, p->lineno, p->as, &p->from, scale, &p->to); p->loc, p->lineno, p->as, &p->from, scale, &p->to);
break; break;
case ADATA: case ADATA:
sconsize = p->from.scale; sconsize = p->from.scale;
snprint(str, sizeof(str), "%.4ld (%L) %-7A %D/%d,%D", snprint(str, sizeof(str), "%.4d (%L) %-7A %D/%d,%D",
p->loc, p->lineno, p->as, &p->from, sconsize, &p->to); p->loc, p->lineno, p->as, &p->from, sconsize, &p->to);
break; break;
case ATEXT: case ATEXT:
snprint(str, sizeof(str), "%.4ld (%L) %-7A %D,%s%lD", snprint(str, sizeof(str), "%.4d (%L) %-7A %D,%s%lD",
p->loc, p->lineno, p->as, &p->from, scale, &p->to); p->loc, p->lineno, p->as, &p->from, scale, &p->to);
break; break;
} }
@ -108,7 +108,7 @@ Dconv(Fmt *fp)
if(a->branch == nil) if(a->branch == nil)
snprint(str, sizeof(str), "<nil>"); snprint(str, sizeof(str), "<nil>");
else else
snprint(str, sizeof(str), "%ld", a->branch->loc); snprint(str, sizeof(str), "%d", a->branch->loc);
break; break;
case D_EXTERN: case D_EXTERN:
@ -131,7 +131,7 @@ Dconv(Fmt *fp)
if(fp->flags & FmtLong) { if(fp->flags & FmtLong) {
d1 = a->offset & 0xffffffffLL; d1 = a->offset & 0xffffffffLL;
d2 = (a->offset>>32) & 0xffffffffLL; d2 = (a->offset>>32) & 0xffffffffLL;
snprint(str, sizeof(str), "$%lud-%lud", (ulong)d1, (ulong)d2); snprint(str, sizeof(str), "$%ud-%ud", (ulong)d1, (ulong)d2);
break; break;
} }
snprint(str, sizeof(str), "$%lld", a->offset); snprint(str, sizeof(str), "$%lld", a->offset);

View File

@ -682,17 +682,17 @@ brk:
print("\nstats\n"); print("\nstats\n");
if(ostats.ncvtreg) if(ostats.ncvtreg)
print(" %4ld cvtreg\n", ostats.ncvtreg); print(" %4d cvtreg\n", ostats.ncvtreg);
if(ostats.nspill) if(ostats.nspill)
print(" %4ld spill\n", ostats.nspill); print(" %4d spill\n", ostats.nspill);
if(ostats.nreload) if(ostats.nreload)
print(" %4ld reload\n", ostats.nreload); print(" %4d reload\n", ostats.nreload);
if(ostats.ndelmov) if(ostats.ndelmov)
print(" %4ld delmov\n", ostats.ndelmov); print(" %4d delmov\n", ostats.ndelmov);
if(ostats.nvar) if(ostats.nvar)
print(" %4ld delmov\n", ostats.nvar); print(" %4d delmov\n", ostats.nvar);
if(ostats.naddr) if(ostats.naddr)
print(" %4ld delmov\n", ostats.naddr); print(" %4d delmov\n", ostats.naddr);
memset(&ostats, 0, sizeof(ostats)); memset(&ostats, 0, sizeof(ostats));
} }
@ -1268,7 +1268,7 @@ regset(Reg *r, uint32 bb)
while(b = bb & ~(bb-1)) { while(b = bb & ~(bb-1)) {
v.type = b & 0xFFFF? BtoR(b): BtoF(b); v.type = b & 0xFFFF? BtoR(b): BtoF(b);
if(v.type == 0) if(v.type == 0)
fatal("zero v.type for %#lux", b); fatal("zero v.type for %#ux", b);
c = copyu(r->prog, &v, A); c = copyu(r->prog, &v, A);
if(c == 3) if(c == 3)
set |= b; set |= b;
@ -1486,7 +1486,7 @@ dumpone(Reg *r)
int z; int z;
Bits bit; Bits bit;
print("%ld:%P", r->loop, r->prog); print("%d:%P", r->loop, r->prog);
for(z=0; z<BITS; z++) for(z=0; z<BITS; z++)
bit.b[z] = bit.b[z] =
r->set.b[z] | r->set.b[z] |
@ -1535,14 +1535,14 @@ dumpit(char *str, Reg *r0)
if(r1 != R) { if(r1 != R) {
print(" pred:"); print(" pred:");
for(; r1 != R; r1 = r1->p2link) for(; r1 != R; r1 = r1->p2link)
print(" %.4lud", r1->prog->loc); print(" %.4ud", r1->prog->loc);
print("\n"); print("\n");
} }
// r1 = r->s1; // r1 = r->s1;
// if(r1 != R) { // if(r1 != R) {
// print(" succ:"); // print(" succ:");
// for(; r1 != R; r1 = r1->s1) // for(; r1 != R; r1 = r1->s1)
// print(" %.4lud", r1->prog->loc); // print(" %.4ud", r1->prog->loc);
// print("\n"); // print("\n");
// } // }
} }

View File

@ -532,7 +532,7 @@ asmb(void)
switch(HEADTYPE) { switch(HEADTYPE) {
default: default:
diag("unknown header type %ld", HEADTYPE); diag("unknown header type %d", HEADTYPE);
case 2: case 2:
case 5: case 5:
seek(cout, HEADR+textsize, 0); seek(cout, HEADR+textsize, 0);

View File

@ -178,7 +178,7 @@ Dconv(Fmt *fp)
break; break;
case D_FCONST: case D_FCONST:
snprint(str, sizeof(str), "$(%.8lux,%.8lux)", a->ieee.h, a->ieee.l); snprint(str, sizeof(str), "$(%.8ux,%.8ux)", a->ieee.h, a->ieee.l);
break; break;
case D_SCONST: case D_SCONST:

View File

@ -202,10 +202,10 @@ main(int argc, char *argv[])
break; break;
} }
if(INITDAT != 0 && INITRND != 0) if(INITDAT != 0 && INITRND != 0)
print("warning: -D0x%llux is ignored because of -R0x%lux\n", print("warning: -D0x%llux is ignored because of -R0x%ux\n",
INITDAT, INITRND); INITDAT, INITRND);
if(debug['v']) if(debug['v'])
Bprint(&bso, "HEADER = -H%ld -T0x%llux -D0x%llux -R0x%lux\n", Bprint(&bso, "HEADER = -H%d -T0x%llux -D0x%llux -R0x%ux\n",
HEADTYPE, INITTEXT, INITDAT, INITRND); HEADTYPE, INITTEXT, INITDAT, INITRND);
Bflush(&bso); Bflush(&bso);
instinit(); instinit();
@ -257,7 +257,7 @@ main(int argc, char *argv[])
undef(); undef();
if(debug['v']) { if(debug['v']) {
Bprint(&bso, "%5.2f cpu time\n", cputime()); Bprint(&bso, "%5.2f cpu time\n", cputime());
Bprint(&bso, "%ld symbols\n", nsymbol); Bprint(&bso, "%d symbols\n", nsymbol);
Bprint(&bso, "%d sizeof adr\n", sizeof(Adr)); Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
Bprint(&bso, "%d sizeof prog\n", sizeof(Prog)); Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
} }
@ -429,7 +429,7 @@ loop:
if(sig != 0){ if(sig != 0){
if(s->sig != 0 && s->sig != sig) if(s->sig != 0 && s->sig != sig)
diag("incompatible type signatures" diag("incompatible type signatures"
"%lux(%s) and %lux(%s) for %s", "%ux(%s) and %ux(%s) for %s",
s->sig, s->file, sig, pn, s->name); s->sig, s->file, sig, pn, s->name);
s->sig = sig; s->sig = sig;
s->file = pn; s->file = pn;
@ -633,7 +633,7 @@ loop:
goto casdef; goto casdef;
if(p->from.type == D_FCONST) { if(p->from.type == D_FCONST) {
/* size sb 9 max */ /* size sb 9 max */
sprint(literal, "$%lux", ieeedtof(&p->from.ieee)); sprint(literal, "$%ux", ieeedtof(&p->from.ieee));
s = lookup(literal, 0); s = lookup(literal, 0);
if(s->type == 0) { if(s->type == 0) {
s->type = SBSS; s->type = SBSS;
@ -678,7 +678,7 @@ loop:
goto casdef; goto casdef;
if(p->from.type == D_FCONST) { if(p->from.type == D_FCONST) {
/* size sb 18 max */ /* size sb 18 max */
sprint(literal, "$%lux.%lux", sprint(literal, "$%ux.%ux",
p->from.ieee.l, p->from.ieee.h); p->from.ieee.l, p->from.ieee.h);
s = lookup(literal, 0); s = lookup(literal, 0);
if(s->type == 0) { if(s->type == 0) {

View File

@ -234,7 +234,7 @@ genasmsym(void (*put)(char*, int, vlong, vlong, int, Sym*))
put(a->asym->name, 'p', a->aoffset, 0, 0, a->gotype); put(a->asym->name, 'p', a->aoffset, 0, 0, a->gotype);
} }
if(debug['v'] || debug['n']) if(debug['v'] || debug['n'])
Bprint(&bso, "symsize = %lud\n", symsize); Bprint(&bso, "symsize = %ud\n", symsize);
Bflush(&bso); Bflush(&bso);
} }

View File

@ -120,7 +120,7 @@ sdivgen(Node *l, Node *r, Node *ax, Node *dx)
if(c < 0) if(c < 0)
c = -c; c = -c;
a = sdiv(c, &m, &s); a = sdiv(c, &m, &s);
//print("a=%d i=%ld s=%d m=%lux\n", a, (int32)r->vconst, s, m); //print("a=%d i=%d s=%d m=%ux\n", a, (int32)r->vconst, s, m);
gins(AMOVL, nodconst(m), ax); gins(AMOVL, nodconst(m), ax);
gins(AIMULL, l, Z); gins(AIMULL, l, Z);
gins(AMOVL, l, ax); gins(AMOVL, l, ax);
@ -141,7 +141,7 @@ udivgen(Node *l, Node *r, Node *ax, Node *dx)
Node nod; Node nod;
a = udiv(r->vconst, &m, &s, &t); a = udiv(r->vconst, &m, &s, &t);
//print("a=%ud i=%ld p=%d s=%d m=%lux\n", a, (int32)r->vconst, t, s, m); //print("a=%ud i=%d p=%d s=%d m=%ux\n", a, (int32)r->vconst, t, s, m);
if(t != 0) { if(t != 0) {
gins(AMOVL, l, ax); gins(AMOVL, l, ax);
gins(ASHRL, nodconst(t), ax); gins(ASHRL, nodconst(t), ax);

View File

@ -355,7 +355,7 @@ mulgen1(uint32 v, Node *n)
mulparam(v, p); mulparam(v, p);
found: found:
// print("v=%.lx a=%d n=%d s=%d g=%d o=%d \n", p->value, p->alg, p->neg, p->shift, p->arg, p->off); // print("v=%.x a=%d n=%d s=%d g=%d o=%d \n", p->value, p->alg, p->neg, p->shift, p->arg, p->off);
if(p->alg < 0) if(p->alg < 0)
return 0; return 0;

View File

@ -382,7 +382,7 @@ regopt(Prog *p)
if(debug['R'] && debug['v']) { if(debug['R'] && debug['v']) {
print("\nlooping structure:\n"); print("\nlooping structure:\n");
for(r = firstr; r != R; r = r->link) { for(r = firstr; r != R; r = r->link) {
print("%ld:%P", r->loop, r->prog); print("%d:%P", r->loop, r->prog);
for(z=0; z<BITS; z++) for(z=0; z<BITS; z++)
bit.b[z] = r->use1.b[z] | bit.b[z] = r->use1.b[z] |
r->use2.b[z] | r->use2.b[z] |
@ -1031,7 +1031,7 @@ paint1(Reg *r, int bn)
if(LOAD(r) & ~(r->set.b[z]&~(r->use1.b[z]|r->use2.b[z])) & bb) { if(LOAD(r) & ~(r->set.b[z]&~(r->use1.b[z]|r->use2.b[z])) & bb) {
change -= CLOAD * r->loop; change -= CLOAD * r->loop;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tld %B $%d\n", r->loop, print("%d%P\td %B $%d\n", r->loop,
r->prog, blsh(bn), change); r->prog, blsh(bn), change);
} }
for(;;) { for(;;) {
@ -1044,7 +1044,7 @@ paint1(Reg *r, int bn)
if(BtoR(bb) != D_F0) if(BtoR(bb) != D_F0)
change = -CINF; change = -CINF;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tu1 %B $%d\n", r->loop, print("%d%P\tu1 %B $%d\n", r->loop,
p, blsh(bn), change); p, blsh(bn), change);
} }
@ -1054,7 +1054,7 @@ paint1(Reg *r, int bn)
if(BtoR(bb) != D_F0) if(BtoR(bb) != D_F0)
change = -CINF; change = -CINF;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tu2 %B $%d\n", r->loop, print("%d%P\tu2 %B $%d\n", r->loop,
p, blsh(bn), change); p, blsh(bn), change);
} }
@ -1064,7 +1064,7 @@ paint1(Reg *r, int bn)
if(BtoR(bb) != D_F0) if(BtoR(bb) != D_F0)
change = -CINF; change = -CINF;
if(debug['R'] && debug['v']) if(debug['R'] && debug['v'])
print("%ld%P\tst %B $%d\n", r->loop, print("%d%P\tst %B $%d\n", r->loop,
p, blsh(bn), change); p, blsh(bn), change);
} }

View File

@ -40,7 +40,7 @@ swit1(C1 *q, int nc, int32 def, Node *n)
if(nc < 5) { if(nc < 5) {
for(i=0; i<nc; i++) { for(i=0; i<nc; i++) {
if(debug['W']) if(debug['W'])
print("case = %.8lux\n", q->val); print("case = %.8ux\n", q->val);
gopcode(OEQ, n->type, n, nodconst(q->val)); gopcode(OEQ, n->type, n, nodconst(q->val));
patch(p, q->label); patch(p, q->label);
q++; q++;
@ -52,7 +52,7 @@ swit1(C1 *q, int nc, int32 def, Node *n)
i = nc / 2; i = nc / 2;
r = q+i; r = q+i;
if(debug['W']) if(debug['W'])
print("case > %.8lux\n", r->val); print("case > %.8ux\n", r->val);
gopcode(OGT, n->type, n, nodconst(r->val)); gopcode(OGT, n->type, n, nodconst(r->val));
sp = p; sp = p;
gbranch(OGOTO); gbranch(OGOTO);
@ -61,7 +61,7 @@ swit1(C1 *q, int nc, int32 def, Node *n)
swit1(q, i, def, n); swit1(q, i, def, n);
if(debug['W']) if(debug['W'])
print("case < %.8lux\n", r->val); print("case < %.8ux\n", r->val);
patch(sp, pc); patch(sp, pc);
swit1(r+1, nc-i-1, def, n); swit1(r+1, nc-i-1, def, n);
} }
@ -564,7 +564,7 @@ align(int32 i, Type *t, int op)
} }
o = xround(o, w); o = xround(o, w);
if(debug['A']) if(debug['A'])
print("align %s %ld %T = %ld\n", bnames[op], i, t, o); print("align %s %d %T = %d\n", bnames[op], i, t, o);
return o; return o;
} }

View File

@ -715,7 +715,7 @@ gclean(void)
for(i=D_AL; i<=D_DI; i++) for(i=D_AL; i<=D_DI; i++)
if(reg[i]) if(reg[i])
yyerror("reg %R left allocated at %lux", i, regpc[i]); yyerror("reg %R left allocated at %ux", i, regpc[i]);
} }
int32 int32
@ -772,7 +772,7 @@ regalloc(Node *n, Type *t, Node *o)
fprint(2, "registers allocated at\n"); fprint(2, "registers allocated at\n");
for(i=D_AX; i<=D_DI; i++) for(i=D_AX; i<=D_DI; i++)
fprint(2, "\t%R\t%#lux\n", i, regpc[i]); fprint(2, "\t%R\t%#ux\n", i, regpc[i]);
yyerror("out of fixed registers"); yyerror("out of fixed registers");
goto err; goto err;

View File

@ -56,18 +56,18 @@ Pconv(Fmt *fp)
snprint(scale, sizeof scale, "%d,", p->from.scale); snprint(scale, sizeof scale, "%d,", p->from.scale);
switch(p->as) { switch(p->as) {
default: default:
snprint(str, sizeof(str), "%.4ld (%L) %-7A %D,%s%D", snprint(str, sizeof(str), "%.4d (%L) %-7A %D,%s%D",
p->loc, p->lineno, p->as, &p->from, scale, &p->to); p->loc, p->lineno, p->as, &p->from, scale, &p->to);
break; break;
case ADATA: case ADATA:
sconsize = p->from.scale; sconsize = p->from.scale;
snprint(str, sizeof(str), "%.4ld (%L) %-7A %D/%d,%D", snprint(str, sizeof(str), "%.4d (%L) %-7A %D/%d,%D",
p->loc, p->lineno, p->as, &p->from, sconsize, &p->to); p->loc, p->lineno, p->as, &p->from, sconsize, &p->to);
break; break;
case ATEXT: case ATEXT:
snprint(str, sizeof(str), "%.4ld (%L) %-7A %D,%s%lD", snprint(str, sizeof(str), "%.4d (%L) %-7A %D,%s%lD",
p->loc, p->lineno, p->as, &p->from, scale, &p->to); p->loc, p->lineno, p->as, &p->from, scale, &p->to);
break; break;
} }

View File

@ -612,17 +612,17 @@ brk:
print("\nstats\n"); print("\nstats\n");
if(ostats.ncvtreg) if(ostats.ncvtreg)
print(" %4ld cvtreg\n", ostats.ncvtreg); print(" %4d cvtreg\n", ostats.ncvtreg);
if(ostats.nspill) if(ostats.nspill)
print(" %4ld spill\n", ostats.nspill); print(" %4d spill\n", ostats.nspill);
if(ostats.nreload) if(ostats.nreload)
print(" %4ld reload\n", ostats.nreload); print(" %4d reload\n", ostats.nreload);
if(ostats.ndelmov) if(ostats.ndelmov)
print(" %4ld delmov\n", ostats.ndelmov); print(" %4d delmov\n", ostats.ndelmov);
if(ostats.nvar) if(ostats.nvar)
print(" %4ld delmov\n", ostats.nvar); print(" %4d delmov\n", ostats.nvar);
if(ostats.naddr) if(ostats.naddr)
print(" %4ld delmov\n", ostats.naddr); print(" %4d delmov\n", ostats.naddr);
memset(&ostats, 0, sizeof(ostats)); memset(&ostats, 0, sizeof(ostats));
} }
@ -1378,7 +1378,7 @@ dumpone(Reg *r)
int z; int z;
Bits bit; Bits bit;
print("%ld:%P", r->loop, r->prog); print("%d:%P", r->loop, r->prog);
for(z=0; z<BITS; z++) for(z=0; z<BITS; z++)
bit.b[z] = bit.b[z] =
r->set.b[z] | r->set.b[z] |
@ -1427,14 +1427,14 @@ dumpit(char *str, Reg *r0)
if(r1 != R) { if(r1 != R) {
print(" pred:"); print(" pred:");
for(; r1 != R; r1 = r1->p2link) for(; r1 != R; r1 = r1->p2link)
print(" %.4lud", r1->prog->loc); print(" %.4ud", r1->prog->loc);
print("\n"); print("\n");
} }
// r1 = r->s1; // r1 = r->s1;
// if(r1 != R) { // if(r1 != R) {
// print(" succ:"); // print(" succ:");
// for(; r1 != R; r1 = r1->s1) // for(; r1 != R; r1 = r1->s1)
// print(" %.4lud", r1->prog->loc); // print(" %.4ud", r1->prog->loc);
// print("\n"); // print("\n");
// } // }
} }

View File

@ -483,7 +483,7 @@ asmb(void)
asmins(p); asmins(p);
if(p->pc != expectpc) { if(p->pc != expectpc) {
Bflush(&bso); Bflush(&bso);
diag("phase error %lux sb %lux in %s", p->pc, expectpc, TNAME); diag("phase error %ux sb %ux in %s", p->pc, expectpc, TNAME);
} }
while(pc < p->pc) { while(pc < p->pc) {
cput(0x90); // nop cput(0x90); // nop
@ -494,14 +494,14 @@ asmb(void)
Bflush(&bso); Bflush(&bso);
if(!debug['a']) if(!debug['a'])
print("%P\n", curp); print("%P\n", curp);
diag("phase error %lux sb %lux in %s", p->pc, pc, TNAME); diag("phase error %ux sb %ux in %s", p->pc, pc, TNAME);
pc = p->pc; pc = p->pc;
} }
if(HEADTYPE != 8) { if(HEADTYPE != 8) {
asmins(p); asmins(p);
if(pc != p->pc) { if(pc != p->pc) {
Bflush(&bso); Bflush(&bso);
diag("asmins changed pc %lux sb %lux in %s", p->pc, pc, TNAME); diag("asmins changed pc %ux sb %ux in %s", p->pc, pc, TNAME);
} }
} }
if(cbc < sizeof(and)) if(cbc < sizeof(and))

View File

@ -103,7 +103,7 @@ Dconv(Fmt *fp)
i = a->type; i = a->type;
if(i >= D_INDIR && i < 2*D_INDIR) { if(i >= D_INDIR && i < 2*D_INDIR) {
if(a->offset) if(a->offset)
snprint(str, sizeof str, "%ld(%R)", (long)a->offset, i-D_INDIR); snprint(str, sizeof str, "%d(%R)", a->offset, i-D_INDIR);
else else
snprint(str, sizeof str, "(%R)", i-D_INDIR); snprint(str, sizeof str, "(%R)", i-D_INDIR);
goto brk; goto brk;
@ -121,44 +121,44 @@ Dconv(Fmt *fp)
case D_BRANCH: case D_BRANCH:
if(bigP != P && bigP->pcond != P) if(bigP != P && bigP->pcond != P)
if(a->sym != S) if(a->sym != S)
snprint(str, sizeof str, "%lux+%s", bigP->pcond->pc, snprint(str, sizeof str, "%ux+%s", bigP->pcond->pc,
a->sym->name); a->sym->name);
else else
snprint(str, sizeof str, "%lux", bigP->pcond->pc); snprint(str, sizeof str, "%ux", bigP->pcond->pc);
else else
snprint(str, sizeof str, "%ld(PC)", a->offset); snprint(str, sizeof str, "%d(PC)", a->offset);
break; break;
case D_EXTERN: case D_EXTERN:
snprint(str, sizeof str, "%s+%ld(SB)", xsymname(a->sym), a->offset); snprint(str, sizeof str, "%s+%d(SB)", xsymname(a->sym), a->offset);
break; break;
case D_STATIC: case D_STATIC:
snprint(str, sizeof str, "%s<%d>+%ld(SB)", xsymname(a->sym), snprint(str, sizeof str, "%s<%d>+%d(SB)", xsymname(a->sym),
a->sym->version, a->offset); a->sym->version, a->offset);
break; break;
case D_AUTO: case D_AUTO:
snprint(str, sizeof str, "%s+%ld(SP)", xsymname(a->sym), a->offset); snprint(str, sizeof str, "%s+%d(SP)", xsymname(a->sym), a->offset);
break; break;
case D_PARAM: case D_PARAM:
if(a->sym) if(a->sym)
snprint(str, sizeof str, "%s+%ld(FP)", a->sym->name, a->offset); snprint(str, sizeof str, "%s+%d(FP)", a->sym->name, a->offset);
else else
snprint(str, sizeof str, "%ld(FP)", a->offset); snprint(str, sizeof str, "%d(FP)", a->offset);
break; break;
case D_CONST: case D_CONST:
snprint(str, sizeof str, "$%ld", a->offset); snprint(str, sizeof str, "$%d", a->offset);
break; break;
case D_CONST2: case D_CONST2:
snprint(str, sizeof str, "$%ld-%ld", a->offset, a->offset2); snprint(str, sizeof str, "$%d-%d", a->offset, a->offset2);
break; break;
case D_FCONST: case D_FCONST:
snprint(str, sizeof str, "$(%.8lux,%.8lux)", a->ieee.h, a->ieee.l); snprint(str, sizeof str, "$(%.8ux,%.8ux)", a->ieee.h, a->ieee.l);
break; break;
case D_SCONST: case D_SCONST:

View File

@ -210,7 +210,7 @@ main(int argc, char *argv[])
INITRND = 4; INITRND = 4;
HEADR += (INITTEXT & 0xFFFF); HEADR += (INITTEXT & 0xFFFF);
if(debug['v']) if(debug['v'])
Bprint(&bso, "HEADR = 0x%ld\n", HEADR); Bprint(&bso, "HEADR = 0x%d\n", HEADR);
break; break;
case 6: /* apple MACH */ case 6: /* apple MACH */
/* /*
@ -283,10 +283,10 @@ main(int argc, char *argv[])
break; break;
} }
if(INITDAT != 0 && INITRND != 0) if(INITDAT != 0 && INITRND != 0)
print("warning: -D0x%lux is ignored because of -R0x%lux\n", print("warning: -D0x%ux is ignored because of -R0x%ux\n",
INITDAT, INITRND); INITDAT, INITRND);
if(debug['v']) if(debug['v'])
Bprint(&bso, "HEADER = -H0x%ld -T0x%lux -D0x%lux -R0x%lux\n", Bprint(&bso, "HEADER = -H0x%d -T0x%ux -D0x%ux -R0x%ux\n",
HEADTYPE, INITTEXT, INITDAT, INITRND); HEADTYPE, INITTEXT, INITDAT, INITRND);
Bflush(&bso); Bflush(&bso);
@ -300,7 +300,7 @@ main(int argc, char *argv[])
zprg.from.scale = 1; zprg.from.scale = 1;
zprg.to = zprg.from; zprg.to = zprg.from;
pcstr = "%.6lux "; pcstr = "%.6ux ";
nuxiinit(); nuxiinit();
histgen = 0; histgen = 0;
textp = nil; textp = nil;
@ -337,7 +337,7 @@ main(int argc, char *argv[])
undef(); undef();
if(debug['v']) { if(debug['v']) {
Bprint(&bso, "%5.2f cpu time\n", cputime()); Bprint(&bso, "%5.2f cpu time\n", cputime());
Bprint(&bso, "%ld symbols\n", nsymbol); Bprint(&bso, "%d symbols\n", nsymbol);
Bprint(&bso, "%d sizeof adr\n", sizeof(Adr)); Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
Bprint(&bso, "%d sizeof prog\n", sizeof(Prog)); Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
} }
@ -511,7 +511,7 @@ loop:
if(sig != 0){ if(sig != 0){
if(s->sig != 0 && s->sig != sig) if(s->sig != 0 && s->sig != sig)
diag("incompatible type signatures" diag("incompatible type signatures"
"%lux(%s) and %lux(%s) for %s", "%ux(%s) and %ux(%s) for %s",
s->sig, s->file, sig, pn, s->name); s->sig, s->file, sig, pn, s->name);
s->sig = sig; s->sig = sig;
s->file = pn; s->file = pn;
@ -683,7 +683,7 @@ loop:
goto casdef; goto casdef;
if(p->from.type == D_FCONST) { if(p->from.type == D_FCONST) {
/* size sb 9 max */ /* size sb 9 max */
sprint(literal, "$%lux", ieeedtof(&p->from.ieee)); sprint(literal, "$%ux", ieeedtof(&p->from.ieee));
s = lookup(literal, 0); s = lookup(literal, 0);
if(s->type == 0) { if(s->type == 0) {
s->type = SBSS; s->type = SBSS;
@ -721,7 +721,7 @@ loop:
goto casdef; goto casdef;
if(p->from.type == D_FCONST) { if(p->from.type == D_FCONST) {
/* size sb 18 max */ /* size sb 18 max */
sprint(literal, "$%lux.%lux", sprint(literal, "$%ux.%ux",
p->from.ieee.l, p->from.ieee.h); p->from.ieee.l, p->from.ieee.h);
s = lookup(literal, 0); s = lookup(literal, 0);
if(s->type == 0) { if(s->type == 0) {

View File

@ -147,7 +147,7 @@ start:
xdefine("erodata", SRODATA, erodata); xdefine("erodata", SRODATA, erodata);
if(debug['v']) if(debug['v'])
Bprint(&bso, "etext = %lux\n", c); Bprint(&bso, "etext = %ux\n", c);
Bflush(&bso); Bflush(&bso);
for(cursym = textp; cursym != nil; cursym = cursym->next) for(cursym = textp; cursym != nil; cursym = cursym->next)
cursym->value = cursym->text->pc; cursym->value = cursym->text->pc;
@ -1233,7 +1233,7 @@ bad:
} }
return; return;
} }
diag("doasm: notfound t2=%lux from=%lux to=%lux %P", t[2], p->from.type, p->to.type, p); diag("doasm: notfound t2=%ux from=%ux to=%ux %P", t[2], p->from.type, p->to.type, p);
return; return;
mfound: mfound:

View File

@ -73,7 +73,7 @@ putsymb(char *s, int t, int32 v, int ver, Sym *go)
if(debug['n']) { if(debug['n']) {
if(t == 'z' || t == 'Z') { if(t == 'z' || t == 'Z') {
Bprint(&bso, "%c %.8lux ", t, v); Bprint(&bso, "%c %.8ux ", t, v);
for(i=1; s[i] != 0 || s[i+1] != 0; i+=2) { for(i=1; s[i] != 0 || s[i+1] != 0; i+=2) {
f = ((s[i]&0xff) << 8) | (s[i+1]&0xff); f = ((s[i]&0xff) << 8) | (s[i+1]&0xff);
Bprint(&bso, "/%x", f); Bprint(&bso, "/%x", f);
@ -82,9 +82,9 @@ putsymb(char *s, int t, int32 v, int ver, Sym *go)
return; return;
} }
if(ver) if(ver)
Bprint(&bso, "%c %.8lux %s<%d> %s (%.8llux)\n", t, v, s, ver, go ? go->name : "", gv); Bprint(&bso, "%c %.8ux %s<%d> %s (%.8llux)\n", t, v, s, ver, go ? go->name : "", gv);
else else
Bprint(&bso, "%c %.8lux %s\n", t, v, s, go ? go->name : "", gv); Bprint(&bso, "%c %.8ux %s\n", t, v, s, go ? go->name : "", gv);
} }
} }
@ -159,6 +159,6 @@ asmsym(void)
putsymb(a->asym->name, 'p', a->aoffset, 0, a->gotype); putsymb(a->asym->name, 'p', a->aoffset, 0, a->gotype);
} }
if(debug['v'] || debug['n']) if(debug['v'] || debug['n'])
Bprint(&bso, "symsize = %lud\n", symsize); Bprint(&bso, "symsize = %ud\n", symsize);
Bflush(&bso); Bflush(&bso);
} }

View File

@ -150,7 +150,7 @@ acidmember(Type *t, int32 off, int flag)
if(typesu[l->etype]) { if(typesu[l->etype]) {
s1 = acidsue(l->link); s1 = acidsue(l->link);
if(s1 != S) { if(s1 != S) {
Bprint(&outbuf, " 'A' %s %ld %s;\n", Bprint(&outbuf, " 'A' %s %d %s;\n",
amap(s1->name), amap(s1->name),
t->offset+off, amap(s->name)); t->offset+off, amap(s->name));
break; break;
@ -189,7 +189,7 @@ acidmember(Type *t, int32 off, int flag)
if(s == S) if(s == S)
break; break;
if(flag) { if(flag) {
Bprint(&outbuf, " '%c' %ld %s;\n", Bprint(&outbuf, " '%c' %d %s;\n",
acidchar[t->etype], t->offset+off, amap(s->name)); acidchar[t->etype], t->offset+off, amap(s->name));
} else { } else {
Bprint(&outbuf, "\tprint(indent, \"%s\t\", addr.%s, \"\\n\");\n", Bprint(&outbuf, "\tprint(indent, \"%s\t\", addr.%s, \"\\n\");\n",
@ -209,7 +209,7 @@ acidmember(Type *t, int32 off, int flag)
acidmember(l, t->offset+off, flag); acidmember(l, t->offset+off, flag);
Bprint(&outbuf, " };\n"); Bprint(&outbuf, " };\n");
} else { } else {
Bprint(&outbuf, " %s %ld %s;\n", Bprint(&outbuf, " %s %d %s;\n",
amap(s1->name), amap(s1->name),
t->offset+off, amap(s->name)); t->offset+off, amap(s->name));
} }
@ -223,7 +223,7 @@ acidmember(Type *t, int32 off, int flag)
} else { } else {
Bprint(&outbuf, "\tprint(indent, \"%s {\\n\");\n", Bprint(&outbuf, "\tprint(indent, \"%s {\\n\");\n",
amap(s1->name)); amap(s1->name));
Bprint(&outbuf, "\tindent_%s(addr+%ld, indent+\"\\t\");\n", Bprint(&outbuf, "\tindent_%s(addr+%d, indent+\"\\t\");\n",
amap(s1->name), t->offset+off); amap(s1->name), t->offset+off);
Bprint(&outbuf, "\tprint(indent, \"}\\n\");\n"); Bprint(&outbuf, "\tprint(indent, \"}\\n\");\n");
} }
@ -263,7 +263,7 @@ acidtype(Type *t)
if(debug['s']) if(debug['s'])
goto asmstr; goto asmstr;
an = amap(s->name); an = amap(s->name);
Bprint(&outbuf, "sizeof%s = %ld;\n", an, t->width); Bprint(&outbuf, "sizeof%s = %d;\n", an, t->width);
Bprint(&outbuf, "aggr %s\n{\n", an); Bprint(&outbuf, "aggr %s\n{\n", an);
for(l = t->link; l != T; l = l->down) for(l = t->link; l != T; l = l->down)
acidmember(l, 0, 1); acidmember(l, 0, 1);
@ -280,7 +280,7 @@ acidtype(Type *t)
break; break;
for(l = t->link; l != T; l = l->down) for(l = t->link; l != T; l = l->down)
if(l->sym != S) if(l->sym != S)
Bprint(&outbuf, "#define\t%s.%s\t%ld\n", Bprint(&outbuf, "#define\t%s.%s\t%d\n",
s->name, s->name,
l->sym->name, l->sym->name,
l->offset); l->offset);

View File

@ -195,7 +195,7 @@ doinit(Sym *s, Type *t, int32 o, Node *a)
dbgdecl(s); dbgdecl(s);
} }
if(debug['i']) { if(debug['i']) {
print("t = %T; o = %ld; n = %s\n", t, o, s->name); print("t = %T; o = %d; n = %s\n", t, o, s->name);
prtree(a, "doinit value"); prtree(a, "doinit value");
} }
@ -323,7 +323,7 @@ init1(Sym *s, Type *t, int32 o, int exflag)
return Z; return Z;
if(debug['i']) { if(debug['i']) {
print("t = %T; o = %ld; n = %s\n", t, o, s->name); print("t = %T; o = %d; n = %s\n", t, o, s->name);
prtree(a, "init1 value"); prtree(a, "init1 value");
} }
@ -479,7 +479,7 @@ init1(Sym *s, Type *t, int32 o, int exflag)
e = r->vconst; e = r->vconst;
if(t->width != 0) if(t->width != 0)
if(e < 0 || e*w >= t->width) { if(e < 0 || e*w >= t->width) {
diag(a, "initialization index out of range: %ld", e); diag(a, "initialization index out of range: %d", e);
continue; continue;
} }
} }
@ -916,7 +916,7 @@ fnproto1(Node *n)
void void
dbgdecl(Sym *s) dbgdecl(Sym *s)
{ {
print("decl \"%s\": C=%s [B=%d:O=%ld] T=%T\n", print("decl \"%s\": C=%s [B=%d:O=%d] T=%T\n",
s->name, cnames[s->class], s->block, s->offset, s->type); s->name, cnames[s->class], s->block, s->offset, s->type);
} }
@ -1571,7 +1571,7 @@ contig(Sym *s, Node *n, int32 v)
Type *zt; Type *zt;
if(debug['i']) { if(debug['i']) {
print("contig v = %ld; s = %s\n", v, s->name); print("contig v = %d; s = %s\n", v, s->name);
prtree(n, "doinit value"); prtree(n, "doinit value");
} }

View File

@ -369,7 +369,7 @@ checkargs(Node *nn, char *s, int pos)
continue; continue;
for(l=tprot; l; l=l->link) for(l=tprot; l; l=l->link)
if(sametype(a->type, l->type)) { if(sametype(a->type, l->type)) {
/*print("checking %T/%ulx %T/%ulx\n", a->type, flag.b[0], l->type, l->flag.b[0]);*/ /*print("checking %T/%ux %T/%ux\n", a->type, flag.b[0], l->type, l->flag.b[0]);*/
if(beq(flag, l->flag)) if(beq(flag, l->flag))
goto loop; goto loop;
} }
@ -437,9 +437,9 @@ pragpack(void)
; ;
if(debug['f']) if(debug['f'])
if(packflg) if(packflg)
print("%4ld: pack %d\n", lineno, packflg); print("%4d: pack %d\n", lineno, packflg);
else else
print("%4ld: pack off\n", lineno); print("%4d: pack off\n", lineno);
} }
void void
@ -459,9 +459,9 @@ pragfpround(void)
; ;
if(debug['f']) if(debug['f'])
if(fproundflg) if(fproundflg)
print("%4ld: fproundflg %d\n", lineno, fproundflg); print("%4d: fproundflg %d\n", lineno, fproundflg);
else else
print("%4ld: fproundflg off\n", lineno); print("%4d: fproundflg off\n", lineno);
} }
void void
@ -477,7 +477,7 @@ pragtextflag(void)
while(getnsc() != '\n') while(getnsc() != '\n')
; ;
if(debug['f']) if(debug['f'])
print("%4ld: textflag %d\n", lineno, textflag); print("%4d: textflag %d\n", lineno, textflag);
} }
void void

View File

@ -630,7 +630,7 @@ l1:
vv = c; vv = c;
yylval.vval = convvtox(vv, TUCHAR); yylval.vval = convvtox(vv, TUCHAR);
if(yylval.vval != vv) if(yylval.vval != vv)
yyerror("overflow in character constant: 0x%lx", c); yyerror("overflow in character constant: 0x%x", c);
else else
if(c & 0x80){ if(c & 0x80){
nearln = lineno; nearln = lineno;
@ -1410,11 +1410,11 @@ Lconv(Fmt *fp)
strcat(str, " "); strcat(str, " ");
} }
if(a[i].line) if(a[i].line)
snprint(s, STRINGSZ, "%s:%ld[%s:%ld]", snprint(s, STRINGSZ, "%s:%d[%s:%d]",
a[i].line->name, l-a[i].ldel+1, a[i].line->name, l-a[i].ldel+1,
a[i].incl->name, l-a[i].idel+1); a[i].incl->name, l-a[i].idel+1);
else else
snprint(s, STRINGSZ, "%s:%ld", snprint(s, STRINGSZ, "%s:%d",
a[i].incl->name, l-a[i].idel+1); a[i].incl->name, l-a[i].idel+1);
if(strlen(s)+strlen(str) >= STRINGSZ-10) if(strlen(s)+strlen(str) >= STRINGSZ-10)
break; break;
@ -1463,7 +1463,7 @@ Tconv(Fmt *fp)
n = t->width; n = t->width;
if(t->link && t->link->width) if(t->link && t->link->width)
n /= t->link->width; n /= t->link->width;
sprint(s, "[%ld]", n); sprint(s, "[%d]", n);
if(strlen(str) + strlen(s) < STRINGSZ) if(strlen(str) + strlen(s) < STRINGSZ)
strcat(str, s); strcat(str, s);
} }

View File

@ -143,7 +143,7 @@ picklemember(Type *t, int32 off)
case TIND: case TIND:
if(s == S) if(s == S)
Bprint(&outbuf, Bprint(&outbuf,
"%s\"p\", (char*)addr+%ld+_i*%ld);\n", "%s\"p\", (char*)addr+%d+_i*%d);\n",
picklestr, t->offset+off, t->width); picklestr, t->offset+off, t->width);
else else
Bprint(&outbuf, Bprint(&outbuf,
@ -164,14 +164,14 @@ picklemember(Type *t, int32 off)
case TFLOAT: case TFLOAT:
case TDOUBLE: case TDOUBLE:
if(s == S) if(s == S)
Bprint(&outbuf, "%s\"%c\", (char*)addr+%ld+_i*%ld);\n", Bprint(&outbuf, "%s\"%c\", (char*)addr+%d+_i*%d);\n",
picklestr, picklechar[t->etype], t->offset+off, t->width); picklestr, picklechar[t->etype], t->offset+off, t->width);
else else
Bprint(&outbuf, "%s\"%c\", &addr->%s);\n", Bprint(&outbuf, "%s\"%c\", &addr->%s);\n",
picklestr, picklechar[t->etype], pmap(s->name)); picklestr, picklechar[t->etype], pmap(s->name));
break; break;
case TARRAY: case TARRAY:
Bprint(&outbuf, "\tfor(_i = 0; _i < %ld; _i++) {\n\t", Bprint(&outbuf, "\tfor(_i = 0; _i < %d; _i++) {\n\t",
t->width/t->link->width); t->width/t->link->width);
picklemember(t->link, t->offset+off); picklemember(t->link, t->offset+off);
Bprint(&outbuf, "\t}\n\t_i = 0;\n\tUSED(_i);\n"); Bprint(&outbuf, "\t}\n\t_i = 0;\n\tUSED(_i);\n");
@ -183,7 +183,7 @@ picklemember(Type *t, int32 off)
if(s1 == S) if(s1 == S)
break; break;
if(s == S) { if(s == S) {
Bprint(&outbuf, "\tbp = pickle_%s(bp, ep, un, (%s*)((char*)addr+%ld+_i*%ld));\n", Bprint(&outbuf, "\tbp = pickle_%s(bp, ep, un, (%s*)((char*)addr+%d+_i*%d));\n",
pmap(s1->name), pmap(s1->name), t->offset+off, t->width); pmap(s1->name), pmap(s1->name), t->offset+off, t->width);
} else { } else {
Bprint(&outbuf, "\tbp = pickle_%s(bp, ep, un, &addr->%s);\n", Bprint(&outbuf, "\tbp = pickle_%s(bp, ep, un, &addr->%s);\n",
@ -235,7 +235,7 @@ pickletype(Type *t)
break; break;
for(l = t->link; l != T; l = l->down) for(l = t->link; l != T; l = l->down)
if(l->sym != S) if(l->sym != S)
Bprint(&outbuf, "#define\t%s.%s\t%ld\n", Bprint(&outbuf, "#define\t%s.%s\t%d\n",
s->name, s->name,
l->sym->name, l->sym->name,
l->offset); l->offset);

View File

@ -80,7 +80,7 @@ doswit(Node *n)
qsort(iq, nc, sizeof(C1), swcmp); qsort(iq, nc, sizeof(C1), swcmp);
if(debug['W']) if(debug['W'])
for(i=0; i<nc; i++) for(i=0; i<nc; i++)
print("case %2ld: = %.8llux\n", i, (vlong)iq[i].val); print("case %2d: = %.8llux\n", i, (vlong)iq[i].val);
for(i=0; i<nc-1; i++) for(i=0; i<nc-1; i++)
if(iq[i].val == iq[i+1].val) if(iq[i].val == iq[i+1].val)
diag(n, "duplicate cases in switch %lld", (vlong)iq[i].val); diag(n, "duplicate cases in switch %lld", (vlong)iq[i].val);

View File

@ -92,18 +92,18 @@ prtree1(Node *n, int d, int f)
{ {
case ONAME: case ONAME:
print(" \"%F\"", n); print(" \"%F\"", n);
print(" %ld", n->xoffset); print(" %d", n->xoffset);
i = 0; i = 0;
break; break;
case OINDREG: case OINDREG:
print(" %ld(R%d)", n->xoffset, n->reg); print(" %d(R%d)", n->xoffset, n->reg);
i = 0; i = 0;
break; break;
case OREGISTER: case OREGISTER:
if(n->xoffset) if(n->xoffset)
print(" %ld+R%d", n->xoffset, n->reg); print(" %d+R%d", n->xoffset, n->reg);
else else
print(" R%d", n->reg); print(" R%d", n->reg);
i = 0; i = 0;
@ -845,7 +845,7 @@ simplifyshift(Node *n)
/* /*
if(debug['h']) if(debug['h'])
print("%.3o %ld %ld %d #%.lux\n", print("%.3o %d %d %d #%.ux\n",
(s1<<3)|s2, c1, c2, topbit(c3), c3); (s1<<3)|s2, c1, c2, topbit(c3), c3);
*/ */

View File

@ -81,7 +81,7 @@ ran(uvlong pc, uvlong epc)
key.epc = pc+1; key.epc = pc+1;
r = treeget(&breakpoints, &key); r = treeget(&breakpoints, &key);
if(r == nil) if(r == nil)
sysfatal("unchecked breakpoint at %#lux+%d", pc, (int)(epc-pc)); sysfatal("unchecked breakpoint at %#llux+%d", pc, (int)(epc-pc));
// Might be that the tail of the sequence // Might be that the tail of the sequence
// was run already, so r->epc is before the end. // was run already, so r->epc is before the end.

View File

@ -158,7 +158,7 @@ walkclosure(Node *func, NodeList **init)
// create the function // create the function
xfunc = nod(ODCLFUNC, N, N); xfunc = nod(ODCLFUNC, N, N);
snprint(namebuf, sizeof namebuf, "_func_%.3ld", ++closgen); snprint(namebuf, sizeof namebuf, "_func_%.3d", ++closgen);
xfunc->nname = newname(lookup(namebuf)); xfunc->nname = newname(lookup(namebuf));
xfunc->nname->ntype = xtype; xfunc->nname->ntype = xtype;
xfunc->nname->defn = xfunc; xfunc->nname->defn = xfunc;

View File

@ -937,11 +937,11 @@ Lconv(Fmt *fp)
if(debug['L']) if(debug['L'])
fmtprint(fp, "%s/", pathname); fmtprint(fp, "%s/", pathname);
if(a[i].line) if(a[i].line)
fmtprint(fp, "%s:%ld[%s:%ld]", fmtprint(fp, "%s:%d[%s:%d]",
a[i].line->name, lno-a[i].ldel+1, a[i].line->name, lno-a[i].ldel+1,
a[i].incl->name, lno-a[i].idel+1); a[i].incl->name, lno-a[i].idel+1);
else else
fmtprint(fp, "%s:%ld", fmtprint(fp, "%s:%d",
a[i].incl->name, lno-a[i].idel+1); a[i].incl->name, lno-a[i].idel+1);
lno = a[i].incl->line - 1; // now print out start of this file lno = a[i].incl->line - 1; // now print out start of this file
} }
@ -1020,10 +1020,10 @@ Jconv(Fmt *fp)
fmtprint(fp, " a(%d)", n->addable); fmtprint(fp, " a(%d)", n->addable);
if(n->vargen != 0) if(n->vargen != 0)
fmtprint(fp, " g(%ld)", n->vargen); fmtprint(fp, " g(%d)", n->vargen);
if(n->lineno != 0) if(n->lineno != 0)
fmtprint(fp, " l(%ld)", n->lineno); fmtprint(fp, " l(%d)", n->lineno);
if(n->xoffset != 0) if(n->xoffset != 0)
fmtprint(fp, " x(%lld)", n->xoffset); fmtprint(fp, " x(%lld)", n->xoffset);
@ -1377,7 +1377,7 @@ Tconv(Fmt *fp)
case TARRAY: case TARRAY:
if(t->bound >= 0) if(t->bound >= 0)
fmtprint(fp, "[%ld]%T", t->bound, t->type); fmtprint(fp, "[%d]%T", t->bound, t->type);
else else
fmtprint(fp, "[]%T", t->type); fmtprint(fp, "[]%T", t->type);
break; break;
@ -1431,7 +1431,7 @@ Nconv(Fmt *fp)
fmtprint(fp, "%O%J", n->op, n); fmtprint(fp, "%O%J", n->op, n);
break; break;
} }
fmtprint(fp, "%O-%S G%ld%J", n->op, fmtprint(fp, "%O-%S G%d%J", n->op,
n->sym, n->vargen, n); n->sym, n->vargen, n);
goto ptyp; goto ptyp;
@ -1477,7 +1477,7 @@ Nconv(Fmt *fp)
break; break;
} }
if(n->sym != S) if(n->sym != S)
fmtprint(fp, " %S G%ld", n->sym, n->vargen); fmtprint(fp, " %S G%d", n->sym, n->vargen);
ptyp: ptyp:
if(n->type != T) if(n->type != T)
@ -2330,7 +2330,7 @@ frame(int context)
case ONAME: case ONAME:
if(flag) if(flag)
print("--- %s frame ---\n", p); print("--- %s frame ---\n", p);
print("%O %S G%ld %T\n", n->op, n->sym, n->vargen, n->type); print("%O %S G%d %T\n", n->op, n->sym, n->vargen, n->type);
flag = 0; flag = 0;
break; break;

View File

@ -897,7 +897,7 @@ asmlc(void)
continue; continue;
} }
if(debug['O']) if(debug['O'])
Bprint(&bso, "\t\t%6ld", lcsize); Bprint(&bso, "\t\t%6d", lcsize);
v = (p->pc - oldpc) / MINLC; v = (p->pc - oldpc) / MINLC;
while(v) { while(v) {
s = 127; s = 127;
@ -905,7 +905,7 @@ asmlc(void)
s = v; s = v;
cput(s+128); /* 129-255 +pc */ cput(s+128); /* 129-255 +pc */
if(debug['O']) if(debug['O'])
Bprint(&bso, " pc+%ld*%d(%ld)", s, MINLC, s+128); Bprint(&bso, " pc+%d*%d(%d)", s, MINLC, s+128);
v -= s; v -= s;
lcsize++; lcsize++;
} }
@ -920,10 +920,10 @@ asmlc(void)
cput(s); cput(s);
if(debug['O']) { if(debug['O']) {
if(s > 0) if(s > 0)
Bprint(&bso, " lc+%ld(%d,%ld)\n", Bprint(&bso, " lc+%d(%d,%d)\n",
s, 0, s); s, 0, s);
else else
Bprint(&bso, " lc%ld(%d,%ld)\n", Bprint(&bso, " lc%d(%d,%d)\n",
s, 0, s); s, 0, s);
Bprint(&bso, "%6llux %P\n", Bprint(&bso, "%6llux %P\n",
p->pc, p); p->pc, p);
@ -934,14 +934,14 @@ asmlc(void)
if(s > 0) { if(s > 0) {
cput(0+s); /* 1-64 +lc */ cput(0+s); /* 1-64 +lc */
if(debug['O']) { if(debug['O']) {
Bprint(&bso, " lc+%ld(%ld)\n", s, 0+s); Bprint(&bso, " lc+%d(%d)\n", s, 0+s);
Bprint(&bso, "%6llux %P\n", Bprint(&bso, "%6llux %P\n",
p->pc, p); p->pc, p);
} }
} else { } else {
cput(64-s); /* 65-128 -lc */ cput(64-s); /* 65-128 -lc */
if(debug['O']) { if(debug['O']) {
Bprint(&bso, " lc%ld(%ld)\n", s, 64-s); Bprint(&bso, " lc%d(%d)\n", s, 64-s);
Bprint(&bso, "%6llux %P\n", Bprint(&bso, "%6llux %P\n",
p->pc, p); p->pc, p);
} }
@ -955,7 +955,7 @@ asmlc(void)
lcsize++; lcsize++;
} }
if(debug['v'] || debug['O']) if(debug['v'] || debug['O'])
Bprint(&bso, "lcsize = %ld\n", lcsize); Bprint(&bso, "lcsize = %d\n", lcsize);
Bflush(&bso); Bflush(&bso);
} }

View File

@ -132,7 +132,7 @@ doar(Biobuf *bp)
for (offset = Boffset(bp);;offset += size) { for (offset = Boffset(bp);;offset += size) {
size = nextar(bp, offset, membername); size = nextar(bp, offset, membername);
if (size < 0) { if (size < 0) {
error("phase error on ar header %ld", offset); error("phase error on ar header %d", offset);
return; return;
} }
if (size == 0) if (size == 0)