[dev.cc] liblink: fix printing of SHRL CX, DX:AX

Change-Id: I6a119109c8dea7fecb32de2c4b1b5ba54bc485be
Reviewed-on: https://go-review.googlesource.com/4100
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Russ Cox 2015-02-06 16:57:38 -05:00
parent e90a91eac4
commit fbd17986ea
4 changed files with 22 additions and 45 deletions

View File

@ -59,6 +59,12 @@ func Pconv(p *obj.Prog) string {
default:
str = fmt.Sprintf("%.5d (%v)\t%v\t%v,%v", p.Pc, p.Line(), Aconv(int(p.As)), Dconv(p, 0, &p.From), Dconv(p, 0, &p.To))
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if (p.From.Type == obj.TYPE_REG || p.From.Type == obj.TYPE_CONST) && p.From.Index != 0 {
str += fmt.Sprintf(":%s", Rconv(int(p.From.Index)))
}
break
}
@ -97,14 +103,6 @@ func Dconv(p *obj.Prog, flag int, a *obj.Addr) string {
str = fmt.Sprintf("%v", Rconv(int(a.Reg)))
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if a.Index != REG_NONE {
s = fmt.Sprintf("(%v*%d)", Rconv(int(a.Index)), int(a.Scale))
str += s
}
case obj.TYPE_BRANCH:
if a.Sym != nil {
str = fmt.Sprintf("%s(SB)", a.Sym.Name)
@ -158,14 +156,6 @@ func Dconv(p *obj.Prog, flag int, a *obj.Addr) string {
case obj.TYPE_CONST:
str = fmt.Sprintf("$%d", a.Offset)
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if a.Index != REG_NONE {
s = fmt.Sprintf("(%v*%d)", Rconv(int(a.Index)), int(a.Scale))
str += s
}
case obj.TYPE_TEXTSIZE:
if a.U.Argsize == obj.ArgsSizeUnknown {
str = fmt.Sprintf("$%d", a.Offset)

View File

@ -71,6 +71,12 @@ func Pconv(p *obj.Prog) string {
default:
str = fmt.Sprintf("%.5d (%v)\t%v\t%v,%v", p.Pc, p.Line(), Aconv(int(p.As)), Dconv(p, 0, &p.From), Dconv(p, 0, &p.To))
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if (p.From.Type == obj.TYPE_REG || p.From.Type == obj.TYPE_CONST) && p.From.Index != 0 {
str += fmt.Sprintf(":%s", Rconv(int(p.From.Index)))
}
break
}
@ -162,14 +168,6 @@ func Dconv(p *obj.Prog, flag int, a *obj.Addr) string {
case obj.TYPE_CONST:
str = fmt.Sprintf("$%d", a.Offset)
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if a.Index != REG_NONE {
s = fmt.Sprintf("(%v*%d)", Rconv(int(a.Index)), int(a.Scale))
str += s
}
case obj.TYPE_TEXTSIZE:
if a.U.Argsize == obj.ArgsSizeUnknown {
str = fmt.Sprintf("$%d", a.Offset)

View File

@ -102,6 +102,11 @@ Pconv(Fmt *fp)
default:
sprint(str, "%.5lld (%L) %A %D,%D",
p->pc, p->lineno, p->as, &p->from, &p->to);
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if((p->from.type == TYPE_REG || p->from.type == TYPE_CONST) && p->from.index != REG_NONE)
sprint(strchr(str, 0), ":%R", p->from.index);
break;
}
bigP = nil;
@ -195,13 +200,6 @@ Dconv(Fmt *fp)
case TYPE_CONST:
sprint(str, "$%lld", a->offset);
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if(a->index != REG_NONE) {
sprint(s, "(%R*%d)", (int)a->index, (int)a->scale);
strcat(str, s);
}
break;
case TYPE_TEXTSIZE:

View File

@ -89,6 +89,11 @@ Pconv(Fmt *fp)
default:
sprint(str, "%.5lld (%L) %A %D,%D",
p->pc, p->lineno, p->as, &p->from, &p->to);
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if((p->from.type == TYPE_REG || p->from.type == TYPE_CONST) && p->from.index != 0)
sprint(strchr(str, 0), ":%R", p->from.index);
break;
}
bigP = nil;
@ -131,13 +136,6 @@ Dconv(Fmt *fp)
break;
}
sprint(str, "%R", a->reg);
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if(a->index != REG_NONE) {
sprint(s, "(%R*%d)", (int)a->index, (int)a->scale);
strcat(str, s);
}
break;
case TYPE_BRANCH:
@ -189,13 +187,6 @@ Dconv(Fmt *fp)
case TYPE_CONST:
sprint(str, "$%lld", a->offset);
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if(a->index != REG_NONE) {
sprint(s, "(%R*%d)", (int)a->index, (int)a->scale);
strcat(str, s);
}
break;
case TYPE_TEXTSIZE: