1
0
mirror of https://github.com/golang/go synced 2024-11-18 07:24:45 -07:00

Adding more debug output when 5l encounters a bad op

combination.

R=rsc
APPROVED=rsc
DELTA=69  (68 added, 0 deleted, 1 changed)
OCL=30798
CL=30801
This commit is contained in:
Kai Backman 2009-06-26 13:44:25 -07:00
parent 4556c04d8b
commit d6197d94b5
3 changed files with 69 additions and 1 deletions

View File

@ -381,6 +381,7 @@ int Aconv(Fmt*);
int Cconv(Fmt*); int Cconv(Fmt*);
int Dconv(Fmt*); int Dconv(Fmt*);
int Nconv(Fmt*); int Nconv(Fmt*);
int Oconv(Fmt*);
int Pconv(Fmt*); int Pconv(Fmt*);
int Sconv(Fmt*); int Sconv(Fmt*);
int aclass(Adr*); int aclass(Adr*);

View File

@ -40,6 +40,7 @@ listinit(void)
fmtinstall('P', Pconv); fmtinstall('P', Pconv);
fmtinstall('S', Sconv); fmtinstall('S', Sconv);
fmtinstall('N', Nconv); fmtinstall('N', Nconv);
fmtinstall('O', Oconv); // C_type constants
} }
void void
@ -372,6 +373,72 @@ Sconv(Fmt *fp)
return fmtstrcpy(fp, str); return fmtstrcpy(fp, str);
} }
static char*
cnames[] =
{
[C_ADDR] = "C_ADDR",
[C_BCON] = "C_BCON",
[C_FAUTO] = "C_FAUTO",
[C_FCON] = "C_FCON",
[C_FCR] = "C_FCR",
[C_FEXT] = "C_FEXT",
[C_FOREG] = "C_FOREG",
[C_FREG] = "C_FREG",
[C_GACON] = "C_GACON",
[C_GBRA] = "C_GBRA",
[C_GCON] = "C_GCON",
[C_GOK] = "C_GOK",
[C_GOREG] = "C_GOREG",
[C_HAUTO] = "C_HAUTO",
[C_HEXT] = "C_HEXT",
[C_HFAUTO] = "C_HFAUTO",
[C_HFEXT] = "C_HFEXT",
[C_HFOREG] = "C_HFOREG",
[C_HOREG] = "C_HOREG",
[C_HREG] = "C_HREG",
[C_LACON] = "C_LACON",
[C_LAUTO] = "C_LAUTO",
[C_LBRA] = "C_LBRA",
[C_LCON] = "C_LCON",
[C_LECON] = "C_LECON",
[C_LEXT] = "C_LEXT",
[C_LOREG] = "C_LOREG",
[C_NCON] = "C_NCON",
[C_NONE] = "C_NONE",
[C_OFFPC] = "C_OFFPC",
[C_PC] = "C_PC",
[C_PSR] = "C_PSR",
[C_RACON] = "C_RACON",
[C_RCON] = "C_RCON",
[C_RECON] = "C_RECON",
[C_REG] = "C_REG",
[C_REGREG] = "C_REGREG",
[C_ROREG] = "C_ROREG",
[C_SACON] = "C_SACON",
[C_SAUTO] = "C_SAUTO",
[C_SBRA] = "C_SBRA",
[C_SCON] = "C_SCON",
[C_SEXT] = "C_SEXT",
[C_SHIFT] = "C_SHIFT",
[C_SOREG] = "C_SOREG",
[C_SP] = "C_SP",
[C_SROREG] = "C_SROREG"
};
int
Oconv(Fmt *fp)
{
char buf[500];
int o;
o = va_arg(fp->args, int);
if(o < 0 || o >= nelem(cnames) || cnames[o] == nil) {
snprint(buf, sizeof(buf), "C_%d", o);
return fmtstrcpy(fp, buf);
}
return fmtstrcpy(fp, cnames[o]);
}
void void
diag(char *fmt, ...) diag(char *fmt, ...)
{ {

View File

@ -864,7 +864,7 @@ oplook(Prog *p)
p->optab = (o-otab)+1; p->optab = (o-otab)+1;
return o; return o;
} }
diag("illegal combination %A %d %d %d, %d %d", diag("illegal combination %A %O %O %O, %d %d",
p->as, a1, a2, a3, p->from.type, p->to.type); p->as, a1, a2, a3, p->from.type, p->to.type);
prasm(p); prasm(p);
if(o == 0) if(o == 0)