Commit 2c7ec3d8 authored by Kai Backman's avatar Kai Backman

fix 5g -S and -g output

R=rsc
APPROVED=rsc
DELTA=115  (93 added, 14 deleted, 8 changed)
OCL=34798
CL=34802
parent 020dbcd4
...@@ -149,6 +149,7 @@ void datastring(char*, int, Addr*); ...@@ -149,6 +149,7 @@ void datastring(char*, int, Addr*);
* list.c * list.c
*/ */
int Aconv(Fmt*); int Aconv(Fmt*);
int Cconv(Fmt*);
int Dconv(Fmt*); int Dconv(Fmt*);
int Mconv(Fmt*); int Mconv(Fmt*);
int Pconv(Fmt*); int Pconv(Fmt*);
......
...@@ -38,6 +38,7 @@ listinit(void) ...@@ -38,6 +38,7 @@ listinit(void)
{ {
fmtinstall('A', Aconv); // as fmtinstall('A', Aconv); // as
fmtinstall('C', Cconv); // conditional execution bit
fmtinstall('P', Pconv); // Prog* fmtinstall('P', Pconv); // Prog*
fmtinstall('D', Dconv); // Addr* fmtinstall('D', Dconv); // Addr*
fmtinstall('Y', Yconv); // sconst fmtinstall('Y', Yconv); // sconst
...@@ -55,8 +56,15 @@ Pconv(Fmt *fp) ...@@ -55,8 +56,15 @@ Pconv(Fmt *fp)
sconsize = 8; sconsize = 8;
switch(p->as) { switch(p->as) {
default: default:
snprint(str, sizeof(str), "%.4ld (%L) %-7A %D,%D", if(p->reg == NREG)
p->loc, p->lineno, p->as, &p->from, &p->to); snprint(str, sizeof(str), "%.4ld (%L) %-7A%C %D,%D",
p->loc, p->lineno, p->as, p->scond, &p->from, &p->to);
else if (p->from.type != D_FREG)
snprint(str, sizeof(str), "%.4ld (%L) %-7A%C %D,R%d,%D",
p->loc, p->lineno, p->as, p->scond, &p->from, p->reg, &p->to);
else
snprint(str, sizeof(str), "%.4ld (%L) %-7A%C %D,F%d,%D",
p->loc, p->lineno, p->as, p->scond, &p->from, p->reg, &p->to);
break; break;
case ADATA: case ADATA:
...@@ -65,11 +73,6 @@ Pconv(Fmt *fp) ...@@ -65,11 +73,6 @@ Pconv(Fmt *fp)
snprint(str, sizeof(str), "%.4ld (%L) %-7A %D/%d,%D", snprint(str, sizeof(str), "%.4ld (%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;
case ATEXT:
snprint(str, sizeof(str), "%.4ld (%L) %-7A %D,%lD",
p->loc, p->lineno, p->as, &p->from, &p->to);
break;
} }
return fmtstrcpy(fp, str); return fmtstrcpy(fp, str);
} }
...@@ -77,33 +80,24 @@ Pconv(Fmt *fp) ...@@ -77,33 +80,24 @@ Pconv(Fmt *fp)
int int
Dconv(Fmt *fp) Dconv(Fmt *fp)
{ {
char str[100]; //, s[100]; char str[STRINGSZ];
char *op; char *op;
Addr *a; Addr *a;
int i; int i;
int32 v; int32 v;
// uint32 d1, d2;
a = va_arg(fp->args, Addr*); a = va_arg(fp->args, Addr*);
i = a->type; i = a->type;
switch(i) { switch(i) {
default: default:
if(a->type == D_OREG) sprint(str, "GOK-type(%d)", a->type);
snprint(str, sizeof(str), "$%d(R%d)", a->offset, a->reg);
else
snprint(str, sizeof(str), "R%d", a->reg);
break; break;
case D_NONE: case D_NONE:
str[0] = 0; str[0] = 0;
break; if(a->name != D_NONE || a->reg != NREG || a->sym != S)
sprint(str, "%M(R%d)(NONE)", a, a->reg);
case D_BRANCH:
if(a->sym != S)
sprint(str, "%s+%d(APC)", a->sym->name, a->offset);
else
sprint(str, "%d(APC)", a->offset);
break; break;
case D_CONST: case D_CONST:
...@@ -128,6 +122,44 @@ Dconv(Fmt *fp) ...@@ -128,6 +122,44 @@ Dconv(Fmt *fp)
sprint(str+strlen(str), "(R%d)", a->reg); sprint(str+strlen(str), "(R%d)", a->reg);
break; break;
case D_OCONST:
sprint(str, "$*$%M", a);
if(a->reg != NREG)
sprint(str, "%M(R%d)(CONST)", a, a->reg);
break;
case D_OREG:
if(a->reg != NREG)
sprint(str, "%M(R%d)", a, a->reg);
else
sprint(str, "%M", a);
break;
case D_REG:
sprint(str, "R%d", a->reg);
if(a->name != D_NONE || a->sym != S)
sprint(str, "%M(R%d)(REG)", a, a->reg);
break;
case D_REGREG:
sprint(str, "(R%d,R%d)", a->reg, (int)a->offset);
if(a->name != D_NONE || a->sym != S)
sprint(str, "%M(R%d)(REG)", a, a->reg);
break;
case D_FREG:
sprint(str, "F%d", a->reg);
if(a->name != D_NONE || a->sym != S)
sprint(str, "%M(R%d)(REG)", a, a->reg);
break;
case D_BRANCH:
if(a->sym != S)
sprint(str, "%s+%d(APC)", a->sym->name, a->offset);
else
sprint(str, "%d(APC)", a->offset);
break;
case D_FCONST: case D_FCONST:
snprint(str, sizeof(str), "$(%.17e)", a->dval); snprint(str, sizeof(str), "$(%.17e)", a->dval);
break; break;
...@@ -158,6 +190,44 @@ Aconv(Fmt *fp) ...@@ -158,6 +190,44 @@ Aconv(Fmt *fp)
return fmtstrcpy(fp, anames[i]); return fmtstrcpy(fp, anames[i]);
} }
char* strcond[16] =
{
".EQ",
".NE",
".HS",
".LO",
".MI",
".PL",
".VS",
".VC",
".HI",
".LS",
".GE",
".LT",
".GT",
".LE",
"",
".NV"
};
int
Cconv(Fmt *fp)
{
char s[20];
int c;
c = va_arg(fp->args, int);
strcpy(s, strcond[c & C_SCOND]);
if(c & C_SBIT)
strcat(s, ".S");
if(c & C_PBIT)
strcat(s, ".P");
if(c & C_WBIT)
strcat(s, ".W");
if(c & C_UBIT) /* ambiguous with FBIT */
strcat(s, ".U");
return fmtstrcpy(fp, s);
}
int int
Yconv(Fmt *fp) Yconv(Fmt *fp)
...@@ -223,6 +293,14 @@ Mconv(Fmt *fp) ...@@ -223,6 +293,14 @@ Mconv(Fmt *fp)
a = va_arg(fp->args, Addr*); a = va_arg(fp->args, Addr*);
switch(a->name) { switch(a->name) {
default:
snprint(str, sizeof(str), "GOK-name(%d)", a->name);
break;
case D_NONE:
snprint(str, sizeof(str), "%d", a->offset);
break;
case D_EXTERN: case D_EXTERN:
snprint(str, sizeof(str), "%S+%d(SB)", a->sym, a->offset); snprint(str, sizeof(str), "%S+%d(SB)", a->sym, a->offset);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment