From: David Given Date: Sat, 15 Oct 2016 09:42:47 +0000 (+0200) Subject: Allow asm names for registers which are different from the friendly names shown X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=517120d0fbca0e3ebbacd1997e714029b50c13a9;p=ack.git Allow asm names for registers which are different from the friendly names shown in the tracing (because PowerPC register names are just numbers). --- diff --git a/mach/proto/mcg/hop.c b/mach/proto/mcg/hop.c index 6b84c62a7..a362f8b79 100644 --- a/mach/proto/mcg/hop.c +++ b/mach/proto/mcg/hop.c @@ -123,7 +123,7 @@ char* hop_render(struct hop* hop) case INSEL_HREG: { struct hreg* hreg = insel->u.hreg; - appendf("%s", hreg->name); + appendf("%s", hreg->realname); break; } @@ -134,7 +134,7 @@ char* hop_render(struct hop* hop) if (!hreg) hreg = pmap_findright(&hop->regsout, vreg); if (hreg) - appendf("%s", hreg->name); + appendf("%s", hreg->realname); else appendf("%%%d", vreg->id); break; diff --git a/mach/proto/mcg/reg.c b/mach/proto/mcg/reg.c index 848c1cd98..bb7266504 100644 --- a/mach/proto/mcg/reg.c +++ b/mach/proto/mcg/reg.c @@ -13,6 +13,7 @@ struct hreg* new_hreg(const struct burm_register_data* brd) { struct hreg* hreg = calloc(1, sizeof *hreg); hreg->name = brd->name; + hreg->realname = brd->realname; hreg->attrs = brd->attrs; hreg->is_stacked = false; return hreg; @@ -22,6 +23,7 @@ struct hreg* new_stacked_hreg(int offset, uint32_t attrs) { struct hreg* hreg = calloc(1, sizeof *hreg); hreg->name = aprintf("stacked_%d", offset); + hreg->realname = hreg->name; hreg->attrs = attrs; hreg->is_stacked = true; hreg->offset = offset; diff --git a/mach/proto/mcg/reg.h b/mach/proto/mcg/reg.h index 753109063..f1b5e1b05 100644 --- a/mach/proto/mcg/reg.h +++ b/mach/proto/mcg/reg.h @@ -14,6 +14,7 @@ struct phicongruence struct hreg { const char* name; + const char* realname; uint32_t type; uint32_t attrs; bool is_stacked; diff --git a/mach/proto/mcg/table b/mach/proto/mcg/table index dce199cae..ad94b05b9 100644 --- a/mach/proto/mcg/table +++ b/mach/proto/mcg/table @@ -7,71 +7,71 @@ REGISTERS * a register into another register (e.g. for eviction). */ - r12 bytes4! int! volatile; - r11 bytes4! int! volatile; - r10 bytes4! int! volatile; - r9 bytes4! int! volatile; - r8 bytes4! int! volatile; - r7 bytes4! int! volatile; - r6 bytes4! int! volatile; - r5 bytes4! int! volatile; - r4 bytes4! int! volatile; - r3 bytes4! int! ret volatile; - - r31 bytes4! int!; - r30 bytes4! int!; - r29 bytes4! int!; - r28 bytes4! int!; - r27 bytes4! int!; - r26 bytes4! int!; - r25 bytes4! int!; - r24 bytes4! int!; - r23 bytes4! int!; - r22 bytes4! int!; - r21 bytes4! int!; - r20 bytes4! int!; - r19 bytes4! int!; - r18 bytes4! int!; - r17 bytes4! int!; - r16 bytes4! int!; - r15 bytes4! int!; - r14 bytes4! int!; - - f14 bytes4! float! volatile; - f13 bytes4! float! volatile; - f12 bytes4! float! volatile; - f11 bytes4! float! volatile; - f10 bytes4! float! volatile; - f9 bytes4! float! volatile; - f8 bytes4! float! volatile; - f7 bytes4! float! volatile; - f6 bytes4! float! volatile; - f5 bytes4! float! volatile; - f4 bytes4! float! volatile; - f3 bytes4! float! volatile; - f2 bytes4! float! volatile; - f1 bytes4! float! volatile; - f0 bytes4! float! volatile; - - f31 bytes4! float!; - f30 bytes4! float!; - f29 bytes4! float!; - f28 bytes4! float!; - f27 bytes4! float!; - f26 bytes4! float!; - f25 bytes4! float!; - f24 bytes4! float!; - f23 bytes4! float!; - f22 bytes4! float!; - f21 bytes4! float!; - f20 bytes4! float!; - f19 bytes4! float!; - f18 bytes4! float!; - f17 bytes4! float!; - f16 bytes4! float!; - f15 bytes4! float!; - - cr0 cr!; + r12 "12" bytes4! int! volatile; + r11 "11" bytes4! int! volatile; + r10 "10" bytes4! int! volatile; + r9 "9" bytes4! int! volatile; + r8 "8" bytes4! int! volatile; + r7 "7" bytes4! int! volatile; + r6 "6" bytes4! int! volatile; + r5 "5" bytes4! int! volatile; + r4 "4" bytes4! int! volatile; + r3 "3" bytes4! int! ret volatile; + + r31 "31" bytes4! int!; + r30 "30" bytes4! int!; + r29 "29" bytes4! int!; + r28 "28" bytes4! int!; + r27 "27" bytes4! int!; + r26 "26" bytes4! int!; + r25 "25" bytes4! int!; + r24 "24" bytes4! int!; + r23 "23" bytes4! int!; + r22 "22" bytes4! int!; + r21 "21" bytes4! int!; + r20 "20" bytes4! int!; + r19 "19" bytes4! int!; + r18 "18" bytes4! int!; + r17 "17" bytes4! int!; + r16 "16" bytes4! int!; + r15 "15" bytes4! int!; + r14 "14" bytes4! int!; + + f14 "14" bytes4! float! volatile; + f13 "13" bytes4! float! volatile; + f12 "12" bytes4! float! volatile; + f11 "11" bytes4! float! volatile; + f10 "10" bytes4! float! volatile; + f9 "9" bytes4! float! volatile; + f8 "8" bytes4! float! volatile; + f7 "7" bytes4! float! volatile; + f6 "6" bytes4! float! volatile; + f5 "5" bytes4! float! volatile; + f4 "4" bytes4! float! volatile; + f3 "3" bytes4! float! volatile; + f2 "2" bytes4! float! volatile; + f1 "1" bytes4! float! volatile; + f0 "0" bytes4! float! volatile; + + f31 "31" bytes4! float!; + f30 "30" bytes4! float!; + f29 "29" bytes4! float!; + f28 "28" bytes4! float!; + f27 "27" bytes4! float!; + f26 "26" bytes4! float!; + f25 "25" bytes4! float!; + f24 "24" bytes4! float!; + f23 "23" bytes4! float!; + f22 "22" bytes4! float!; + f21 "21" bytes4! float!; + f20 "20" bytes4! float!; + f19 "19" bytes4! float!; + f18 "18" bytes4! float!; + f17 "17" bytes4! float!; + f16 "16" bytes4! float!; + f15 "15" bytes4! float!; + + cr0 "cr0" cr!; DECLARATIONS diff --git a/util/mcgg/gram.y b/util/mcgg/gram.y index 748d3fa38..9155271fc 100644 --- a/util/mcgg/gram.y +++ b/util/mcgg/gram.y @@ -71,7 +71,7 @@ registers ; register - : ID { $$ = makereg($1); } + : ID QFRAGMENT { $$ = makereg($1, $2); } | register ID { $$ = $1; addregattr($1, $2, false); } | register ID '!' { $$ = $1; addregattr($1, $2, true); } ; diff --git a/util/mcgg/iburg.c b/util/mcgg/iburg.c index ff8b1e973..390853201 100644 --- a/util/mcgg/iburg.c +++ b/util/mcgg/iburg.c @@ -253,7 +253,7 @@ static void* install(const char* name) return &p->sym; } -struct reg* makereg(const char* id) +struct reg* makereg(const char* id, const char* realname) { struct reg* p = smap_get(®isters, id); static int number = 0; @@ -262,6 +262,7 @@ struct reg* makereg(const char* id) yyerror("redefinition of '%s'", id); p = calloc(1, sizeof(*p)); p->name = id; + p->realname = realname; p->number = number++; smap_put(®isters, id, p); @@ -591,7 +592,8 @@ static void emitregisters(void) struct reg* r = registers.item[i].right; assert(r->number == i); - print("%1{ \"%s\", 0x%x, 0x%x },\n", r->name, r->type, r->attrs); + print("%1{ \"%s\", \"%s\", 0x%x, 0x%x },\n", + r->name, r->realname, r->type, r->attrs); } print("%1{ NULL }\n"); print("};\n\n"); diff --git a/util/mcgg/iburg.h b/util/mcgg/iburg.h index 689a84177..48397c21e 100644 --- a/util/mcgg/iburg.h +++ b/util/mcgg/iburg.h @@ -58,7 +58,8 @@ struct terminfo struct reg { - const char* name; /* register name */ + const char* name; /* friendly register name */ + const char* realname; /* name used in assembly output */ int number; /* identifying number */ uint32_t attrs; /* bitfield of register attributes */ uint32_t type; /* register type */ @@ -70,7 +71,7 @@ struct regattr int number; /* identifying number */ }; -extern struct reg* makereg(const char* name); +extern struct reg* makereg(const char* name, const char* realname); extern void addregattr(struct reg* reg, const char* regattr, bool exact); extern struct regattr* getregattr(const char* name); diff --git a/util/mcgg/mcgg.h b/util/mcgg/mcgg.h index 242c1efcd..2631e0097 100644 --- a/util/mcgg/mcgg.h +++ b/util/mcgg/mcgg.h @@ -64,6 +64,7 @@ extern const struct burm_instruction_data burm_instruction_data[]; struct burm_register_data { const char* name; + const char* realname; uint32_t type; uint32_t attrs; };