* Copy a ARMCPRegInfo structure, allocating it along with the name
* and an optional suffix to the name.
*/
-static ARMCPRegInfo *alloc_cpreg(const ARMCPRegInfo *in,
- const char *name, const char *suffix)
+static ARMCPRegInfo *alloc_cpreg(const ARMCPRegInfo *in, const char *suffix)
{
+ const char *name = in->name;
size_t name_len = strlen(name);
size_t suff_len = suffix ? strlen(suffix) : 0;
ARMCPRegInfo *out = g_malloc(sizeof(*in) + name_len + suff_len + 1);
cp, crm, opc1, opc2, key);
break;
case ARM_CP_SECSTATE_BOTH:
- r_s = alloc_cpreg(r, r->name, "_S");
+ r_s = alloc_cpreg(r, "_S");
add_cpreg_to_hashtable(cpu, r_s, ARM_CP_STATE_AA32, ARM_CP_SECSTATE_S,
cp, crm, opc1, opc2, key);
* and name that it is passed, so it's OK to use
* a local struct here.
*/
- ARMCPRegInfo *nxs_ri = alloc_cpreg(r, r->name, "NXS");
+ ARMCPRegInfo *nxs_ri = alloc_cpreg(r, "NXS");
uint32_t nxs_key;
assert(nxs_ri->crn < 0xf);
for (int crm = crmmin; crm <= crmmax; crm++) {
for (int opc1 = opc1min; opc1 <= opc1max; opc1++) {
for (int opc2 = opc2min; opc2 <= opc2max; opc2++) {
- ARMCPRegInfo *r2 = alloc_cpreg(r, r->name, NULL);
+ ARMCPRegInfo *r2 = alloc_cpreg(r, NULL);
ARMCPRegInfo *r3;
switch (r->state) {
add_cpreg_to_hashtable_aa64(cpu, r2, crm, opc1, opc2);
break;
case ARM_CP_STATE_BOTH:
- r3 = alloc_cpreg(r2, r2->name, NULL);
+ r3 = alloc_cpreg(r2, NULL);
add_cpreg_to_hashtable_aa32(cpu, r2, cp, crm, opc1, opc2);
add_cpreg_to_hashtable_aa64(cpu, r3, crm, opc1, opc2);
break;