1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:14:40 -07:00

cmd/6c, cmd/8c: fix print format for Prog

The FmtLong flag should only be used with the %D verb
when printing an ATEXT Prog. It was erroneously used
for every Prog except ADATA. This caused a preponderance
of exclamation points, "!!", in the assembly listings.

I also cleaned up the code so that the list.c files look
very similar. Now the real differences are easily spotted
with a simple diff.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7128045
This commit is contained in:
Anthony Martin 2013-01-18 19:00:38 -08:00
parent c8c8ab08ed
commit 60826e0be6
2 changed files with 59 additions and 49 deletions

View File

@ -93,7 +93,7 @@ Pconv(Fmt *fp)
break;
default:
sprint(str, "(%L) %A %D,%lD",
sprint(str, "(%L) %A %D,%D",
p->lineno, p->as, &p->from, &p->to);
break;
}
@ -120,13 +120,12 @@ Dconv(Fmt *fp)
i = a->type;
if(fp->flags & FmtLong) {
if(i != D_CONST) {
if(i == D_CONST)
sprint(str, "$%lld-%lld", a->offset&0xffffffffLL, a->offset>>32);
else {
// ATEXT dst is not constant
sprint(str, "!!%D", a);
goto brk;
}
sprint(str, "$%lld-%lld", a->offset&0xffffffffLL,
(a->offset>>32)&0xffffffffLL);
goto brk;
}
@ -138,7 +137,6 @@ Dconv(Fmt *fp)
goto brk;
}
switch(i) {
default:
if(a->offset)
sprint(str, "$%lld,%R", a->offset, i);
@ -159,23 +157,20 @@ Dconv(Fmt *fp)
break;
case D_STATIC:
sprint(str, "%s<>+%lld(SB)", a->sym->name,
a->offset);
sprint(str, "%s<>+%lld(SB)", a->sym->name, a->offset);
break;
case D_AUTO:
if(a->sym) {
if(a->sym)
sprint(str, "%s+%lld(SP)", a->sym->name, a->offset);
break;
}
else
sprint(str, "%lld(SP)", a->offset);
break;
case D_PARAM:
if(a->sym) {
if(a->sym)
sprint(str, "%s+%lld(FP)", a->sym->name, a->offset);
break;
}
else
sprint(str, "%lld(FP)", a->offset);
break;

View File

@ -93,7 +93,7 @@ Pconv(Fmt *fp)
break;
default:
sprint(str, "(%L) %A %D,%lD",
sprint(str, "(%L) %A %D,%D",
p->lineno, p->as, &p->from, &p->to);
break;
}
@ -118,6 +118,17 @@ Dconv(Fmt *fp)
a = va_arg(fp->args, Adr*);
i = a->type;
if(fp->flags & FmtLong) {
if(i == D_CONST2)
sprint(str, "$%d-%d", a->offset, a->offset2);
else {
// ATEXT dst is not constant
sprint(str, "!!%D", a);
}
goto brk;
}
if(i >= D_INDIR) {
if(a->offset)
sprint(str, "%d(%R)", a->offset, i-D_INDIR);
@ -126,7 +137,6 @@ Dconv(Fmt *fp)
goto brk;
}
switch(i) {
default:
if(a->offset)
sprint(str, "$%d,%R", a->offset, i);
@ -147,12 +157,14 @@ Dconv(Fmt *fp)
break;
case D_STATIC:
sprint(str, "%s<>+%d(SB)", a->sym->name,
a->offset);
sprint(str, "%s<>+%d(SB)", a->sym->name, a->offset);
break;
case D_AUTO:
if(a->sym)
sprint(str, "%s+%d(SP)", a->sym->name, a->offset);
else
sprint(str, "%d(SP)", a->offset);
break;
case D_PARAM:
@ -167,7 +179,10 @@ Dconv(Fmt *fp)
break;
case D_CONST2:
sprint(str, "$%d-%d", a->offset, a->offset2);
if(!(fp->flags & FmtLong)) {
// D_CONST2 outside of ATEXT should not happen
sprint(str, "!!$%d-%d", a->offset, a->offset2);
}
break;
case D_FCONST: