Allow asm names for registers which are different from the friendly names shown

in the tracing (because PowerPC register names are just numbers).
This commit is contained in:
David Given 2016-10-15 11:42:47 +02:00
parent b2ddf12473
commit 517120d0fb
8 changed files with 76 additions and 69 deletions

View file

@ -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;

View file

@ -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;

View file

@ -14,6 +14,7 @@ struct phicongruence
struct hreg
{
const char* name;
const char* realname;
uint32_t type;
uint32_t attrs;
bool is_stacked;

View file

@ -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;
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 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!;
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 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;
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 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!;
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

View file

@ -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); }
;

View file

@ -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(&registers, 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(&registers, 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");

View file

@ -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);

View file

@ -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;
};