summaryrefslogtreecommitdiff
path: root/src/liblink/list6.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/liblink/list6.c')
-rw-r--r--src/liblink/list6.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/liblink/list6.c b/src/liblink/list6.c
index 0635fdf1f..54cce4aa4 100644
--- a/src/liblink/list6.c
+++ b/src/liblink/list6.c
@@ -82,6 +82,19 @@ Pconv(Fmt *fp)
p = va_arg(fp->args, Prog*);
bigP = p;
+
+ if(fp->flags & FmtSharp) {
+ char *s = str;
+ s += sprint(s, "%.5lld (%L) %A", p->pc, p->lineno, p->as);
+ if(p->from.type != D_NONE)
+ s += sprint(s, " from={%#D}", &p->from);
+ if(p->reg)
+ s += sprint(s, " reg=%d", p->reg);
+ if(p->to.type != D_NONE)
+ s += sprint(s, " to={%#D}", &p->to);
+ return fmtstrcpy(fp, str);
+ }
+
switch(p->as) {
case ADATA:
sprint(str, "%.5lld (%L) %A %D/%d,%D",
@@ -126,6 +139,31 @@ Dconv(Fmt *fp)
a = va_arg(fp->args, Addr*);
i = a->type;
+ if(fp->flags & FmtSharp) {
+ char *s = str;
+ s += sprint(s, "type=");
+ if(i == D_NONE) {
+ sprint(s, "NONE");
+ goto brk;
+ }
+ if(i >= D_INDIR) {
+ i -= D_INDIR;
+ s += sprint(s, "INDIR+");
+ }
+ if(i >= 0 && i < D_LAST && dnames6[i] != nil)
+ s += sprint(s, "%s ", dnames6[i]);
+ else
+ s += sprint(s, "%d ", i);
+ s += sprint(s, "offset=%ld etype=%E width=%d", a->offset, a->etype, a->width);
+ if(a->class != 0)
+ s += sprint(s, " class=%s", cnames9[(int)a->class]);
+ if(a->sym != nil)
+ s += sprint(s, " sym=%s", a->sym->name);
+ if(a->type == D_BRANCH && a->u.branch != nil)
+ s += sprint(s, " branch=%.5lld", a->u.branch->pc);
+ goto brk;
+ }
+
if(fp->flags & FmtLong) {
if(i == D_CONST)
sprint(str, "$%lld-%lld", a->offset&0xffffffffLL, a->offset>>32);