From: Lulu Cai Date: Mon, 30 Oct 2023 09:07:08 +0000 (+0800) Subject: Add support for ilp32 register alias. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=98712e137edb0bf33acd3bf716a160d16f600c35;p=binutils-gdb.git Add support for ilp32 register alias. --- diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c index 33f3e71ce2f..d1ce111c186 100644 --- a/gas/config/tc-loongarch.c +++ b/gas/config/tc-loongarch.c @@ -303,6 +303,15 @@ loongarch_after_parse_args () for (i = 0; i < ARRAY_SIZE (loongarch_r_normal_name); i++) str_hash_insert (r_htab, loongarch_r_normal_name[i], (void *) (i + 1), 0); + /* Init ilp32/lp64 registers alias. */ + r_abi_names = loongarch_r_alias; + for (i = 0; i < ARRAY_SIZE (loongarch_r_alias); i++) + str_hash_insert (r_htab, loongarch_r_alias[i], (void *) (i + 1), + 0); + for (i = 0; i < ARRAY_SIZE (loongarch_r_alias_deprecated); i++) + str_hash_insert (r_deprecated_htab, loongarch_r_alias_deprecated[i], + (void *) (i + 1), 0); + if (!cr_htab) cr_htab = str_htab_create (), str_hash_insert (cr_htab, "", 0, 0); @@ -323,6 +332,15 @@ loongarch_after_parse_args () str_hash_insert (f_htab, loongarch_f_normal_name[i], (void *) (i + 1), 0); + /* Init float-ilp32/lp64 registers alias. */ + f_abi_names = loongarch_f_alias; + for (i = 0; i < ARRAY_SIZE (loongarch_f_alias); i++) + str_hash_insert (f_htab, loongarch_f_alias[i], + (void *) (i + 1), 0); + for (i = 0; i < ARRAY_SIZE (loongarch_f_alias_deprecated); i++) + str_hash_insert (f_deprecated_htab, loongarch_f_alias_deprecated[i], + (void *) (i + 1), 0); + if (!fc_htab) fc_htab = str_htab_create (), str_hash_insert (fc_htab, "", 0, 0); @@ -366,29 +384,6 @@ loongarch_after_parse_args () 0); } - /* Init lp64 registers alias. */ - if (LARCH_opts.ase_lp64) - { - r_abi_names = loongarch_r_lp64_name; - for (i = 0; i < ARRAY_SIZE (loongarch_r_lp64_name); i++) - str_hash_insert (r_htab, loongarch_r_lp64_name[i], (void *) (i + 1), - 0); - for (i = 0; i < ARRAY_SIZE (loongarch_r_lp64_name_deprecated); i++) - str_hash_insert (r_deprecated_htab, loongarch_r_lp64_name_deprecated[i], - (void *) (i + 1), 0); - } - - /* Init float-lp64 registers alias */ - if ((LARCH_opts.ase_sf || LARCH_opts.ase_df) && LARCH_opts.ase_lp64) - { - f_abi_names = loongarch_f_lp64_name; - for (i = 0; i < ARRAY_SIZE (loongarch_f_lp64_name); i++) - str_hash_insert (f_htab, loongarch_f_lp64_name[i], - (void *) (i + 1), 0); - for (i = 0; i < ARRAY_SIZE (loongarch_f_lp64_name_deprecated); i++) - str_hash_insert (f_deprecated_htab, loongarch_f_lp64_name_deprecated[i], - (void *) (i + 1), 0); - } } const char * diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c index c65e2414bf8..f7d08c60a58 100644 --- a/gdb/loongarch-tdep.c +++ b/gdb/loongarch-tdep.c @@ -1774,15 +1774,15 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) info.target_desc = tdesc; info.tdesc_data = tdesc_data.get (); - for (int i = 0; i < ARRAY_SIZE (loongarch_r_lp64_name); ++i) - if (loongarch_r_lp64_name[i][0] != '\0') - user_reg_add (gdbarch, loongarch_r_lp64_name[i] + 1, + for (int i = 0; i < ARRAY_SIZE (loongarch_r_alias); ++i) + if (loongarch_r_alias[i][0] != '\0') + user_reg_add (gdbarch, loongarch_r_alias[i] + 1, value_of_loongarch_user_reg, (void *) (size_t) i); - for (int i = 0; i < ARRAY_SIZE (loongarch_f_lp64_name); ++i) + for (int i = 0; i < ARRAY_SIZE (loongarch_f_alias); ++i) { - if (loongarch_f_lp64_name[i][0] != '\0') - user_reg_add (gdbarch, loongarch_f_lp64_name[i] + 1, + if (loongarch_f_alias[i][0] != '\0') + user_reg_add (gdbarch, loongarch_f_alias[i] + 1, value_of_loongarch_user_reg, (void *) (size_t) (LOONGARCH_FIRST_FP_REGNUM + i)); } diff --git a/include/opcode/loongarch.h b/include/opcode/loongarch.h index f358ff429e4..da936f7945a 100644 --- a/include/opcode/loongarch.h +++ b/include/opcode/loongarch.h @@ -189,11 +189,11 @@ dec2 : [1-9][0-9]? extern void loongarch_eliminate_adjacent_repeat_char (char *dest, char c); extern const char *const loongarch_r_normal_name[32]; - extern const char *const loongarch_r_lp64_name[32]; - extern const char *const loongarch_r_lp64_name_deprecated[32]; + extern const char *const loongarch_r_alias[32]; + extern const char *const loongarch_r_alias_deprecated[32]; extern const char *const loongarch_f_normal_name[32]; - extern const char *const loongarch_f_lp64_name[32]; - extern const char *const loongarch_f_lp64_name_deprecated[32]; + extern const char *const loongarch_f_alias[32]; + extern const char *const loongarch_f_alias_deprecated[32]; extern const char *const loongarch_fc_normal_name[4]; extern const char *const loongarch_fc_numeric_name[4]; extern const char *const loongarch_c_normal_name[8]; diff --git a/opcodes/loongarch-dis.c b/opcodes/loongarch-dis.c index 1e711f27415..969ea28f96f 100644 --- a/opcodes/loongarch-dis.c +++ b/opcodes/loongarch-dis.c @@ -82,8 +82,8 @@ set_default_loongarch_dis_options (void) LARCH_opts.ase_lvz = 1; LARCH_opts.ase_lbt = 1; - loongarch_r_disname = loongarch_r_lp64_name; - loongarch_f_disname = loongarch_f_lp64_name; + loongarch_r_disname = loongarch_r_alias; + loongarch_f_disname = loongarch_f_alias; loongarch_fc_disname = loongarch_fc_normal_name; loongarch_c_disname = loongarch_c_normal_name; loongarch_cr_disname = loongarch_cr_normal_name; diff --git a/opcodes/loongarch-opc.c b/opcodes/loongarch-opc.c index 362b6581c76..82b88bdad2a 100644 --- a/opcodes/loongarch-opc.c +++ b/opcodes/loongarch-opc.c @@ -41,7 +41,7 @@ const char *const loongarch_r_normal_name[32] = "$r24", "$r25", "$r26", "$r27", "$r28", "$r29", "$r30", "$r31", }; -const char *const loongarch_r_lp64_name[32] = +const char *const loongarch_r_alias[32] = { "$zero", "$ra", "$tp", "$sp", "$a0", "$a1", "$a2", "$a3", "$a4", "$a5", "$a6", "$a7", "$t0", "$t1", "$t2", "$t3", @@ -49,7 +49,7 @@ const char *const loongarch_r_lp64_name[32] = "$s1", "$s2", "$s3", "$s4", "$s5", "$s6", "$s7", "$s8", }; -const char *const loongarch_r_lp64_name_deprecated[32] = +const char *const loongarch_r_alias_deprecated[32] = { "", "", "", "", "$v0", "$v1", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "$x", "", "", "", "", "", "", "", "", "", "", @@ -63,7 +63,7 @@ const char *const loongarch_f_normal_name[32] = "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31", }; -const char *const loongarch_f_lp64_name[32] = +const char *const loongarch_f_alias[32] = { "$fa0", "$fa1", "$fa2", "$fa3", "$fa4", "$fa5", "$fa6", "$fa7", "$ft0", "$ft1", "$ft2", "$ft3", "$ft4", "$ft5", "$ft6", "$ft7", @@ -71,7 +71,7 @@ const char *const loongarch_f_lp64_name[32] = "$fs0", "$fs1", "$fs2", "$fs3", "$fs4", "$fs5", "$fs6", "$fs7", }; -const char *const loongarch_f_lp64_name_deprecated[32] = +const char *const loongarch_f_alias_deprecated[32] = { "$fv0", "$fv1", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",