diff --git a/compiler/src/dmd/backend/debugprint.d b/compiler/src/dmd/backend/debugprint.d index 9cfbb3f10e7c..1a7334ce5592 100644 --- a/compiler/src/dmd/backend/debugprint.d +++ b/compiler/src/dmd/backend/debugprint.d @@ -329,29 +329,48 @@ void WRdefnod() } @trusted -void WRFL(FL fl) +const(char)* fl_str(FL fl) { - __gshared const(char)[7][FLMAX] fls = - [ "unde ","const ","oper ","func ","data ", - "reg ", - "pseudo", - "auto ","fast ","para ","extrn ", - "code ","block ","udata ","cs ","swit ", - "fltrg ","offst ","datsg ", - "ctor ","dtor ","regsav","asm ", - "ndp ", - "farda ","csdat ", - "local ","tlsdat", - "bprel ","frameh","blocko","alloca", - "stack ","dsym ", - "got ","gotoff", - "funcar", + __gshared const char*[FLMAX] fls = + [ "FLunde", + "FLconst", + "FLoper", + "FLfunc", + "FLdata", + "FLreg", + "FLpseudo", + "FLauto", + "FLfast", + "FLpara", + "FLextern", + "FLcode", + "FLblock", + "FLudata", + "FLcs", + "FLswitch", + "FLfltrg", + "FLoffset", + "FLdatseg", + "FLctor", + "FLdtor", + "FLregsave", + "FLasm", + "FLndp", + "FLfardata", + "FLcsdat", + "FLlocalsize", + "FLtlsdata", + "FLbprel", + "FLframehandler", + "FLblockoff", + "FLallocatmp", + "FLstack", + "FLdsymbol", + "FLgot", + "FLgotoff", + "FLfuncarg", ]; - - if (cast(uint)fl >= FLMAX) - printf("FL%d",fl); - else - printf("FL%s",fls[fl].ptr); + return fls[fl]; } /*********************** diff --git a/compiler/src/dmd/backend/symbol.d b/compiler/src/dmd/backend/symbol.d index bbc08d1c030f..84b2d8e48541 100644 --- a/compiler/src/dmd/backend/symbol.d +++ b/compiler/src/dmd/backend/symbol.d @@ -64,7 +64,7 @@ debug printf("symbol '%s'\n ", s.Sident.ptr); printf(" Sclass = %s ", class_str(s.Sclass)); printf(" Ssymnum = %d",cast(int)s.Ssymnum); - printf(" Sfl = "); WRFL(cast(FL) s.Sfl); + printf(" Sfl = %s", fl_str(cast(FL) s.Sfl)); printf(" Sseg = %d\n",s.Sseg); // printf(" Ssize = x%02x\n",s.Ssize); printf(" Soffset = x%04llx",cast(ulong)s.Soffset); diff --git a/compiler/src/dmd/backend/x86/cod1.d b/compiler/src/dmd/backend/x86/cod1.d index 9525e13d660a..cedd42efdaff 100644 --- a/compiler/src/dmd/backend/x86/cod1.d +++ b/compiler/src/dmd/backend/x86/cod1.d @@ -1650,7 +1650,6 @@ void getlvalue(ref CodeBuilder cdb,ref code pcs,elem *e,regm_t keepmsk) break; default: - WRFL(fl); symbol_print(*s); assert(0); } @@ -3915,7 +3914,7 @@ private void funccall(ref CodeBuilder cdb, elem* e, uint numpara, uint numalign, // Function calls may throw Errors funcsym_p.Sfunc.Fflags3 &= ~Fnothrow; - if (e1.Eoper != OPind) { WRFL(el_fl(e1)); printf("e1.Eoper: %s\n", oper_str(e1.Eoper)); } + if (e1.Eoper != OPind) { printf("e1.fl: %s, e1.Eoper: %s\n", fl_str(el_fl(e1)), oper_str(e1.Eoper)); } save87(cdb); // assume 8087 regs are all trashed assert(e1.Eoper == OPind); elem *e11 = e1.E1; diff --git a/compiler/src/dmd/backend/x86/cod2.d b/compiler/src/dmd/backend/x86/cod2.d index 753b8fb2b095..1928f68ed323 100644 --- a/compiler/src/dmd/backend/x86/cod2.d +++ b/compiler/src/dmd/backend/x86/cod2.d @@ -4945,7 +4945,7 @@ void getoffset(ref CGstate cg, ref CodeBuilder cdb,elem *e,reg_t reg) debug { elem_print(e); - WRFL(fl); + printf("e.fl = %s\n", fl_str(el_fl(e))); } assert(0); } diff --git a/compiler/src/dmd/backend/x86/cod3.d b/compiler/src/dmd/backend/x86/cod3.d index 2fdd9de4af54..b5930a03704f 100644 --- a/compiler/src/dmd/backend/x86/cod3.d +++ b/compiler/src/dmd/backend/x86/cod3.d @@ -5548,7 +5548,6 @@ targ_size_t cod3_bpoffset(Symbol *s) break; default: - WRFL(s.Sfl); symbol_print(*s); assert(0); } @@ -6117,7 +6116,7 @@ void pinholeopt(code *c,block *b) break; default: - WRFL(c.IFL2); + printf("c.fl = %s\n", fl_str(c.IFL2)); assert(0); } break; @@ -7341,7 +7340,7 @@ private void do64bit(ref MiniCodeBuf pbuf, FL fl, ref evc uev,int flags) break; default: - WRFL(fl); + printf("fl: %s\n", fl_str(fl)); assert(0); } pbuf.offset += 8; @@ -7521,7 +7520,7 @@ private void do32bit(ref MiniCodeBuf pbuf, FL fl, ref evc uev,int flags, int val break; default: - WRFL(fl); + printf("fl: %s\n", fl_str(fl)); assert(0); } pbuf.offset += 4; @@ -7609,7 +7608,7 @@ private void do16bit(ref MiniCodeBuf pbuf, FL fl, ref evc uev,int flags) break; default: - WRFL(fl); + printf("fl: %s\n", fl_str(fl)); assert(0); } pbuf.offset += 2; @@ -7775,23 +7774,21 @@ extern (C) void code_print(scope code* c) case FLbprel: case FLtlsdata: case FLextern: - printf(" "); - WRFL(c.IFL1); + printf(" %s", fl_str(c.IFL1)); printf(" sym='%s'",c.IEV1.Vsym.Sident.ptr); if (c.IEV1.Voffset) printf(".%d", cast(int)c.IEV1.Voffset); break; default: - WRFL(c.IFL1); + printf("fl: %s\n", fl_str(c.IFL1)); break; } } } if (ins & T) { - printf(" "); - WRFL(c.IFL2); + printf(" %s\n", fl_str(c.IFL2)); switch (c.IFL2) { case FLconst: @@ -7830,7 +7827,7 @@ extern (C) void code_print(scope code* c) break; default: - WRFL(c.IFL2); + printf("fl: %s\n", fl_str(c.IFL2)); break; } }