diff options
author | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2023-05-15 16:23:56 +0000 |
---|---|---|
committer | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2023-05-15 16:23:56 +0000 |
commit | 45ad7fb2547ea58c1733387c21b295c04625a176 (patch) | |
tree | 8a36a78bd61554cfae8dd2652696d02c28d68c9e | |
parent | 5f998f887f77d229aac3516fcf953b743ee0f0c3 (diff) |
7c: clean up the garbage in -S output, fix printing instructions using FCONST
-rw-r--r-- | sys/src/cmd/7c/list.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/sys/src/cmd/7c/list.c b/sys/src/cmd/7c/list.c index a68b2d017..23c115f36 100644 --- a/sys/src/cmd/7c/list.c +++ b/sys/src/cmd/7c/list.c @@ -42,25 +42,28 @@ static char *conds[] = { int Pconv(Fmt *fp) { - char str[STRINGSZ]; + char str[STRINGSZ], *s, *e; Prog *p; int a; p = va_arg(fp->args, Prog*); a = p->as; + s = str; + e = str + sizeof(str); + s = seprint(s, e, " %A %D", a, &p->from); if(a == ADATA) - snprint(str, sizeof(str), " %A %D/%d,%D", a, &p->from, p->reg, &p->to); - else - if(p->as == ATEXT) - snprint(str, sizeof(str), " %A %D,%d,%D", a, &p->from, p->reg, &p->to); - else - if(p->reg == NREG) - snprint(str, sizeof(str), " %A %D,%D", a, &p->from, &p->to); - else - if(p->from.type != D_FREG) - snprint(str, sizeof(str), " %A %D,R%d,%D", a, &p->from, p->reg, &p->to); - else - snprint(str, sizeof(str), " %A %D,F%d,%D", a, &p->from, p->reg, &p->to); + s = seprint(s, e, "/%d", p->reg); + else if(p->as == ATEXT) + s = seprint(s, e, ",%d", p->reg); + else if(p->reg != NREG) + if(p->from.type != D_FREG && p->from.type != D_FCONST) + s = seprint(s, e, ",R%d", p->reg); + else + s = seprint(s, e, ",F%d", p->reg); + if(p->to.type != D_NONE) + s = seprint(s, e, s[-1] == '\t' ? "%D" : ",%D", &p->to); + if(s[-1] == '\t') + s[-1] = 0; return fmtstrcpy(fp, str); } |