diff options
author | Shenghou Ma <minux@golang.org> | 2014-08-06 00:31:22 -0400 |
---|---|---|
committer | Shenghou Ma <minux@golang.org> | 2014-08-06 00:31:22 -0400 |
commit | 25cf0bae06d25dd858f86ff152215d72c57be6a7 (patch) | |
tree | 1a75f71ac2aebfa0388d361c28159b129e1881cd /src/liblink | |
parent | 849ee80bb4964f407e83bea63d932c399d38ab64 (diff) | |
download | go-25cf0bae06d25dd858f86ff152215d72c57be6a7.tar.gz |
liblink, cmd/dist, cmd/5l: introduce %^ and move C_* constants.
The helps certain diagnostics and also removed duplicated enums as a side effect.
LGTM=dave, rsc
R=rsc, dave
CC=golang-codereviews
https://codereview.appspot.com/115060044
Diffstat (limited to 'src/liblink')
-rw-r--r-- | src/liblink/asm5.c | 50 | ||||
-rw-r--r-- | src/liblink/list5.c | 17 |
2 files changed, 19 insertions, 48 deletions
diff --git a/src/liblink/asm5.c b/src/liblink/asm5.c index 73a31862f..46aa1c1e3 100644 --- a/src/liblink/asm5.c +++ b/src/liblink/asm5.c @@ -65,52 +65,6 @@ enum LTO = 1<<1, LPOOL = 1<<2, LPCREL = 1<<3, - - C_NONE = 0, - C_REG, - C_REGREG, - C_REGREG2, - C_SHIFT, - C_FREG, - C_PSR, - C_FCR, - - C_RCON, /* 0xff rotated */ - C_NCON, /* ~RCON */ - C_SCON, /* 0xffff */ - C_LCON, - C_LCONADDR, - C_ZFCON, - C_SFCON, - C_LFCON, - - C_RACON, - C_LACON, - - C_SBRA, - C_LBRA, - - C_HAUTO, /* halfword insn offset (-0xff to 0xff) */ - C_FAUTO, /* float insn offset (0 to 0x3fc, word aligned) */ - C_HFAUTO, /* both H and F */ - C_SAUTO, /* -0xfff to 0xfff */ - C_LAUTO, - - C_HOREG, - C_FOREG, - C_HFOREG, - C_SOREG, - C_ROREG, - C_SROREG, /* both nil and R */ - C_LOREG, - - C_PC, - C_SP, - C_HREG, - - C_ADDR, /* reference to relocatable address */ - - C_GOK, }; static Optab optab[] = @@ -1264,7 +1218,7 @@ oplook(Link *ctxt, Prog *p) o = oprange[r].stop; /* just generate an error */ } if(0 /*debug['O']*/) { - print("oplook %A %d %d %d\n", + print("oplook %A %^ %^ %^\n", (int)p->as, a1, a2, a3); print(" %d %d\n", p->from.type, p->to.type); } @@ -1278,7 +1232,7 @@ oplook(Link *ctxt, Prog *p) p->optab = (o-optab)+1; return o; } - ctxt->diag("illegal combination %P; %d %d %d, %d %d", + ctxt->diag("illegal combination %P; %^ %^ %^, %d %d", p, a1, a2, a3, p->from.type, p->to.type); ctxt->diag("from %d %d to %d %d\n", p->from.type, p->from.name, p->to.type, p->to.name); prasm(p); diff --git a/src/liblink/list5.c b/src/liblink/list5.c index 4a4e8c71f..a91df55e6 100644 --- a/src/liblink/list5.c +++ b/src/liblink/list5.c @@ -46,6 +46,7 @@ static int Pconv(Fmt *fp); static int Rconv(Fmt *fp); static int RAconv(Fmt *fp); static int DSconv(Fmt *fp); +static int DRconv(Fmt*); #pragma varargck type "$" char* #pragma varargck type "M" Addr* @@ -59,6 +60,9 @@ listinit5(void) fmtinstall('P', Pconv); fmtinstall('R', Rconv); + // for liblink internal use + fmtinstall('^', DRconv); + // for internal use fmtinstall('$', DSconv); fmtinstall('M', Mconv); @@ -314,6 +318,19 @@ Rconv(Fmt *fp) } static int +DRconv(Fmt *fp) +{ + char *s; + int a; + + a = va_arg(fp->args, int); + s = "C_??"; + if(a >= C_NONE && a <= C_NCLASS) + s = cnames5[a]; + return fmtstrcpy(fp, s); +} + +static int Mconv(Fmt *fp) { char str[STRINGSZ]; |