diff options
author | Lulu Cai <cailulu@loongson.cn> | 2024-12-09 11:21:40 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2024-12-09 12:01:02 +0800 |
commit | 3d75969bd0e2608dc2c23aeee3f2f597b44fa7cc (patch) | |
tree | 0ae200b6c74a5110c6e107a41c93999cf57deacb | |
parent | 01d8e0d24ad301f69b6f5ea39d073a728477507d (diff) | |
download | binutils-3d75969bd0e2608dc2c23aeee3f2f597b44fa7cc.zip binutils-3d75969bd0e2608dc2c23aeee3f2f597b44fa7cc.tar.gz binutils-3d75969bd0e2608dc2c23aeee3f2f597b44fa7cc.tar.bz2 |
LoongArch: Assign DWARF register numbers to register aliases
.cfi directives only support the use of register numbers and not
register names or aliases.
This commit adds support for 4 formats, for example:
.cfi_offset r1, 8
.cfi_offset ra, 8
.cfi_offset $r1,8
.cfi_offset $ra,8
The above .cfi directives are equivalent and all represent dwarf
register number 1.
Display register aliases as specified in the psABI during disassembly.
-rw-r--r-- | binutils/dwarf.c | 29 | ||||
-rw-r--r-- | gas/config/tc-loongarch.c | 103 | ||||
-rw-r--r-- | gas/config/tc-loongarch.h | 8 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/dwarf-regnum.d | 338 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/dwarf-regnum.s | 348 | ||||
-rw-r--r-- | include/opcode/loongarch.h | 4 | ||||
-rw-r--r-- | opcodes/loongarch-opc.c | 32 |
7 files changed, 845 insertions, 17 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 79a18e3..e8425b9 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -8796,6 +8796,27 @@ init_dwarf_regnames_riscv (void) dwarf_regnames_lookup_func = regname_internal_riscv; } +static const char *const dwarf_regnames_loongarch[] = +{ + "$zero", "$ra", "$tp", "$sp", "$a0", "$a1", "$a2", "$a3", /* 0-7 */ + "$a4", "$a5", "$a6", "$a7", "$t0", "$t1", "$t2", "$t3", /* 8-15 */ + "$t4", "$t5", "$t6", "$t7", "$t8", "$r21","$fp", "$s0", /* 16-23 */ + "$s1", "$s2", "$s3", "$s4", "$s5", "$s6", "$s7", "$s8", /* 24-31 */ + "$fa0", "$fa1", "$fa2", "$fa3", "$fa4", "$fa5", "$fa6", /* 32-38 */ + "$fa7", "$ft0", "$ft1", "$ft2", "$ft3", "$ft4", "$ft5", /* 39-45 */ + "$ft6", "$ft7", "$ft8", "$ft9", "$ft10", "$ft11", "$ft12", /* 46-52 */ + "$ft13", "$ft14", "$ft15", "$fs0", "$fs1", "$fs2", "$fs3", /* 53-59 */ + "$fs4", "$fs5", "$fs6", "$fs7", /* 60-63 */ +}; + +static void +init_dwarf_regnames_loongarch (void) +{ + dwarf_regnames = dwarf_regnames_loongarch; + dwarf_regnames_count = ARRAY_SIZE (dwarf_regnames_loongarch); + dwarf_regnames_lookup_func = regname_internal_by_table_only; +} + void init_dwarf_regnames_by_elf_machine_code (unsigned int e_machine) { @@ -8830,6 +8851,10 @@ init_dwarf_regnames_by_elf_machine_code (unsigned int e_machine) init_dwarf_regnames_riscv (); break; + case EM_LOONGARCH: + init_dwarf_regnames_loongarch (); + break; + default: break; } @@ -8879,6 +8904,10 @@ init_dwarf_regnames_by_bfd_arch_and_mach (enum bfd_architecture arch, init_dwarf_regnames_riscv (); break; + case bfd_arch_loongarch: + init_dwarf_regnames_loongarch (); + break; + default: break; } diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c index 411c24b..85b13c3 100644 --- a/gas/config/tc-loongarch.c +++ b/gas/config/tc-loongarch.c @@ -276,6 +276,8 @@ static struct htab *c_htab = NULL; static struct htab *cr_htab = NULL; static struct htab *v_htab = NULL; static struct htab *x_htab = NULL; +static struct htab *cfi_r_htab = NULL; +static struct htab *cfi_f_htab = NULL; void loongarch_after_parse_args () @@ -322,15 +324,27 @@ loongarch_after_parse_args () if (!r_deprecated_htab) r_deprecated_htab = str_htab_create (), str_hash_insert (r_deprecated_htab, "", 0, 0); + /* Init cfi registers alias. */ + if (!cfi_r_htab) + cfi_r_htab = str_htab_create (), str_hash_insert (cfi_r_htab, "", 0, 0); r_abi_names = loongarch_r_normal_name; 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); - + { + str_hash_insert (r_htab, loongarch_r_normal_name[i], + (void *) (i + 1), 0); + str_hash_insert (cfi_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); + { + str_hash_insert (r_htab, loongarch_r_alias[i], + (void *) (i + 1), 0); + str_hash_insert (cfi_r_htab, loongarch_r_alias[i], + (void *) (i + 1), 0); + } for (i = 0; i < ARRAY_SIZE (loongarch_r_alias_1); i++) str_hash_insert (r_htab, loongarch_r_alias_1[i], (void *) (i + 1), 0); @@ -339,6 +353,15 @@ loongarch_after_parse_args () str_hash_insert (r_deprecated_htab, loongarch_r_alias_deprecated[i], (void *) (i + 1), 0); + /* The .cfi directive supports register aliases without the "$" prefix. */ + for (i = 0; i < ARRAY_SIZE (loongarch_r_cfi_name); i++) + { + str_hash_insert (cfi_r_htab, loongarch_r_cfi_name[i], + (void *)(i + 1), 0); + str_hash_insert (cfi_r_htab, loongarch_r_cfi_name_alias[i], + (void *)(i + 1), 0); + } + if (!cr_htab) cr_htab = str_htab_create (), str_hash_insert (cr_htab, "", 0, 0); @@ -353,21 +376,39 @@ loongarch_after_parse_args () if (!f_deprecated_htab) f_deprecated_htab = str_htab_create (), str_hash_insert (f_deprecated_htab, "", 0, 0); + if (!cfi_f_htab) + cfi_f_htab = str_htab_create (), str_hash_insert (cfi_f_htab, "", 0, 0); f_abi_names = loongarch_f_normal_name; for (i = 0; i < ARRAY_SIZE (loongarch_f_normal_name); i++) - str_hash_insert (f_htab, loongarch_f_normal_name[i], (void *) (i + 1), - 0); - + { + str_hash_insert (f_htab, loongarch_f_normal_name[i], + (void *) (i + 1), 0); + str_hash_insert (cfi_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); + { + str_hash_insert (f_htab, loongarch_f_alias[i], + (void *) (i + 1), 0); + str_hash_insert (cfi_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); + /* The .cfi directive supports register aliases without the "$" prefix. */ + for (i = 0; i < ARRAY_SIZE (loongarch_f_cfi_name); i++) + { + str_hash_insert (cfi_f_htab, loongarch_f_cfi_name[i], + (void *)(i + 1), 0); + str_hash_insert (cfi_f_htab, loongarch_f_cfi_name_alias[i], + (void *)(i + 1), 0); + } + if (!fc_htab) fc_htab = str_htab_create (), str_hash_insert (fc_htab, "", 0, 0); @@ -1864,6 +1905,46 @@ loongarch_cfi_frame_initial_instructions (void) cfi_add_CFA_def_cfa_register (3 /* $sp */); } +/* Convert REGNAME to a DWARF register number. */ +int +tc_loongarch_regname_to_dw2regnum (char *regname) +{ + int reg; + + /* Look up in the general purpose register table. */ + if ((reg = (intptr_t) str_hash_find (cfi_r_htab, regname)) > 0) + return reg - 1; + + /* Look up in the floating point register table. */ + if ((reg = (intptr_t) str_hash_find (cfi_f_htab, regname)) > 0) + return reg + 31; + + as_bad (_("unknown register `%s`"), regname); + return -1; +} + +/* Derived from tc_parse_to_dw2regnum, but excluding the case where + the prefix '%'. */ +void +tc_loongarch_parse_to_dw2regnum (expressionS *exp) +{ + SKIP_WHITESPACE (); + if (is_name_beginner (*input_line_pointer)) + { + char *name, c; + + c = get_symbol_name (& name); + + exp->X_op = O_constant; + exp->X_add_number = tc_loongarch_regname_to_dw2regnum (name); + + restore_line_pointer (c); + } + else + expression_and_evaluate (exp); +} + + void loongarch_pre_output_hook (void) { @@ -1910,12 +1991,6 @@ loongarch_pre_output_hook (void) } void -tc_loongarch_parse_to_dw2regnum (expressionS *exp) -{ - expression_and_evaluate (exp); -} - -void md_show_usage (FILE *stream) { fprintf (stream, _("LARCH options:\n")); diff --git a/gas/config/tc-loongarch.h b/gas/config/tc-loongarch.h index b815ebb..582edca 100644 --- a/gas/config/tc-loongarch.h +++ b/gas/config/tc-loongarch.h @@ -124,13 +124,15 @@ extern int loongarch_force_relocation (struct fix *); loongarch_cfi_frame_initial_instructions extern void loongarch_cfi_frame_initial_instructions (void); +#define tc_parse_to_dw2regnum tc_loongarch_parse_to_dw2regnum +extern void tc_loongarch_parse_to_dw2regnum (expressionS *); + +extern int tc_loongarch_regname_to_dw2regnum (char *); + #define tc_symbol_new_hook(sym) \ if (0 == strcmp (sym->bsym->name, FAKE_LABEL_NAME)) \ S_SET_OTHER (sym, STV_HIDDEN); -#define tc_parse_to_dw2regnum tc_loongarch_parse_to_dw2regnum -extern void tc_loongarch_parse_to_dw2regnum (expressionS *); - extern void loongarch_pre_output_hook (void); #define md_pre_output_hook loongarch_pre_output_hook () #define GAS_SORT_RELOCS 1 diff --git a/gas/testsuite/gas/loongarch/dwarf-regnum.d b/gas/testsuite/gas/loongarch/dwarf-regnum.d new file mode 100644 index 0000000..f7af728 --- /dev/null +++ b/gas/testsuite/gas/loongarch/dwarf-regnum.d @@ -0,0 +1,338 @@ +#objdump: --dwarf=frames + +.*: file format .* + +Contents of the .*: + + +00000000 [a-zA-Z0-9]+ [a-zA-Z0-9]+ CIE + Version: .* + Augmentation: .* + Code alignment factor: .* + Data alignment factor: .* + Return address column: .* + Augmentation data: .* +#... +[a-zA-Z0-9]+ [a-zA-Z0-9]+ [a-zA-Z0-9]+ FDE cie=00000000 pc=[a-zA-Z0-9]+\.\.[a-zA-Z0-9]+ + DW_CFA_advance_loc: 4 to 0000000000000020 + DW_CFA_offset_extended_sf: r0 \(\$zero\) at cfa\+8 + DW_CFA_offset_extended_sf: r1 \(\$ra\) at cfa\+16 + DW_CFA_offset_extended_sf: r2 \(\$tp\) at cfa\+24 + DW_CFA_offset_extended_sf: r3 \(\$sp\) at cfa\+32 + DW_CFA_offset_extended_sf: r4 \(\$a0\) at cfa\+40 + DW_CFA_offset_extended_sf: r5 \(\$a1\) at cfa\+48 + DW_CFA_offset_extended_sf: r6 \(\$a2\) at cfa\+56 + DW_CFA_offset_extended_sf: r7 \(\$a3\) at cfa\+64 + DW_CFA_offset_extended_sf: r8 \(\$a4\) at cfa\+72 + DW_CFA_offset_extended_sf: r9 \(\$a5\) at cfa\+80 + DW_CFA_offset_extended_sf: r10 \(\$a6\) at cfa\+88 + DW_CFA_offset_extended_sf: r11 \(\$a7\) at cfa\+96 + DW_CFA_offset_extended_sf: r12 \(\$t0\) at cfa\+104 + DW_CFA_offset_extended_sf: r13 \(\$t1\) at cfa\+112 + DW_CFA_offset_extended_sf: r14 \(\$t2\) at cfa\+120 + DW_CFA_offset_extended_sf: r15 \(\$t3\) at cfa\+128 + DW_CFA_offset_extended_sf: r16 \(\$t4\) at cfa\+136 + DW_CFA_offset_extended_sf: r17 \(\$t5\) at cfa\+144 + DW_CFA_offset_extended_sf: r18 \(\$t6\) at cfa\+152 + DW_CFA_offset_extended_sf: r19 \(\$t7\) at cfa\+160 + DW_CFA_offset_extended_sf: r20 \(\$t8\) at cfa\+168 + DW_CFA_offset_extended_sf: r21 \(\$r21\) at cfa\+176 + DW_CFA_offset_extended_sf: r22 \(\$fp\) at cfa\+184 + DW_CFA_offset_extended_sf: r23 \(\$s0\) at cfa\+192 + DW_CFA_offset_extended_sf: r24 \(\$s1\) at cfa\+200 + DW_CFA_offset_extended_sf: r25 \(\$s2\) at cfa\+208 + DW_CFA_offset_extended_sf: r26 \(\$s3\) at cfa\+216 + DW_CFA_offset_extended_sf: r27 \(\$s4\) at cfa\+224 + DW_CFA_offset_extended_sf: r28 \(\$s5\) at cfa\+232 + DW_CFA_offset_extended_sf: r29 \(\$s6\) at cfa\+240 + DW_CFA_offset_extended_sf: r30 \(\$s7\) at cfa\+248 + DW_CFA_offset_extended_sf: r31 \(\$s8\) at cfa\+256 + DW_CFA_offset_extended_sf: r0 \(\$zero\) at cfa\+8 + DW_CFA_offset_extended_sf: r1 \(\$ra\) at cfa\+16 + DW_CFA_offset_extended_sf: r2 \(\$tp\) at cfa\+24 + DW_CFA_offset_extended_sf: r3 \(\$sp\) at cfa\+32 + DW_CFA_offset_extended_sf: r4 \(\$a0\) at cfa\+40 + DW_CFA_offset_extended_sf: r5 \(\$a1\) at cfa\+48 + DW_CFA_offset_extended_sf: r6 \(\$a2\) at cfa\+56 + DW_CFA_offset_extended_sf: r7 \(\$a3\) at cfa\+64 + DW_CFA_offset_extended_sf: r8 \(\$a4\) at cfa\+72 + DW_CFA_offset_extended_sf: r9 \(\$a5\) at cfa\+80 + DW_CFA_offset_extended_sf: r10 \(\$a6\) at cfa\+88 + DW_CFA_offset_extended_sf: r11 \(\$a7\) at cfa\+96 + DW_CFA_offset_extended_sf: r12 \(\$t0\) at cfa\+104 + DW_CFA_offset_extended_sf: r13 \(\$t1\) at cfa\+112 + DW_CFA_offset_extended_sf: r14 \(\$t2\) at cfa\+120 + DW_CFA_offset_extended_sf: r15 \(\$t3\) at cfa\+128 + DW_CFA_offset_extended_sf: r16 \(\$t4\) at cfa\+136 + DW_CFA_offset_extended_sf: r17 \(\$t5\) at cfa\+144 + DW_CFA_offset_extended_sf: r18 \(\$t6\) at cfa\+152 + DW_CFA_offset_extended_sf: r19 \(\$t7\) at cfa\+160 + DW_CFA_offset_extended_sf: r20 \(\$t8\) at cfa\+168 + DW_CFA_offset_extended_sf: r21 \(\$r21\) at cfa\+176 + DW_CFA_offset_extended_sf: r22 \(\$fp\) at cfa\+184 + DW_CFA_offset_extended_sf: r23 \(\$s0\) at cfa\+192 + DW_CFA_offset_extended_sf: r24 \(\$s1\) at cfa\+200 + DW_CFA_offset_extended_sf: r25 \(\$s2\) at cfa\+208 + DW_CFA_offset_extended_sf: r26 \(\$s3\) at cfa\+216 + DW_CFA_offset_extended_sf: r27 \(\$s4\) at cfa\+224 + DW_CFA_offset_extended_sf: r28 \(\$s5\) at cfa\+232 + DW_CFA_offset_extended_sf: r29 \(\$s6\) at cfa\+240 + DW_CFA_offset_extended_sf: r30 \(\$s7\) at cfa\+248 + DW_CFA_offset_extended_sf: r31 \(\$s8\) at cfa\+256 + DW_CFA_offset_extended_sf: r0 \(\$zero\) at cfa\+8 + DW_CFA_offset_extended_sf: r1 \(\$ra\) at cfa\+16 + DW_CFA_offset_extended_sf: r2 \(\$tp\) at cfa\+24 + DW_CFA_offset_extended_sf: r3 \(\$sp\) at cfa\+32 + DW_CFA_offset_extended_sf: r4 \(\$a0\) at cfa\+40 + DW_CFA_offset_extended_sf: r5 \(\$a1\) at cfa\+48 + DW_CFA_offset_extended_sf: r6 \(\$a2\) at cfa\+56 + DW_CFA_offset_extended_sf: r7 \(\$a3\) at cfa\+64 + DW_CFA_offset_extended_sf: r8 \(\$a4\) at cfa\+72 + DW_CFA_offset_extended_sf: r9 \(\$a5\) at cfa\+80 + DW_CFA_offset_extended_sf: r10 \(\$a6\) at cfa\+88 + DW_CFA_offset_extended_sf: r11 \(\$a7\) at cfa\+96 + DW_CFA_offset_extended_sf: r12 \(\$t0\) at cfa\+104 + DW_CFA_offset_extended_sf: r13 \(\$t1\) at cfa\+112 + DW_CFA_offset_extended_sf: r14 \(\$t2\) at cfa\+120 + DW_CFA_offset_extended_sf: r15 \(\$t3\) at cfa\+128 + DW_CFA_offset_extended_sf: r16 \(\$t4\) at cfa\+136 + DW_CFA_offset_extended_sf: r17 \(\$t5\) at cfa\+144 + DW_CFA_offset_extended_sf: r18 \(\$t6\) at cfa\+152 + DW_CFA_offset_extended_sf: r19 \(\$t7\) at cfa\+160 + DW_CFA_offset_extended_sf: r20 \(\$t8\) at cfa\+168 + DW_CFA_offset_extended_sf: r21 \(\$r21\) at cfa\+176 + DW_CFA_offset_extended_sf: r22 \(\$fp\) at cfa\+184 + DW_CFA_offset_extended_sf: r23 \(\$s0\) at cfa\+192 + DW_CFA_offset_extended_sf: r24 \(\$s1\) at cfa\+200 + DW_CFA_offset_extended_sf: r25 \(\$s2\) at cfa\+208 + DW_CFA_offset_extended_sf: r26 \(\$s3\) at cfa\+216 + DW_CFA_offset_extended_sf: r27 \(\$s4\) at cfa\+224 + DW_CFA_offset_extended_sf: r28 \(\$s5\) at cfa\+232 + DW_CFA_offset_extended_sf: r29 \(\$s6\) at cfa\+240 + DW_CFA_offset_extended_sf: r30 \(\$s7\) at cfa\+248 + DW_CFA_offset_extended_sf: r31 \(\$s8\) at cfa\+256 + DW_CFA_offset_extended_sf: r0 \(\$zero\) at cfa\+8 + DW_CFA_offset_extended_sf: r1 \(\$ra\) at cfa\+16 + DW_CFA_offset_extended_sf: r2 \(\$tp\) at cfa\+24 + DW_CFA_offset_extended_sf: r3 \(\$sp\) at cfa\+32 + DW_CFA_offset_extended_sf: r4 \(\$a0\) at cfa\+40 + DW_CFA_offset_extended_sf: r5 \(\$a1\) at cfa\+48 + DW_CFA_offset_extended_sf: r6 \(\$a2\) at cfa\+56 + DW_CFA_offset_extended_sf: r7 \(\$a3\) at cfa\+64 + DW_CFA_offset_extended_sf: r8 \(\$a4\) at cfa\+72 + DW_CFA_offset_extended_sf: r9 \(\$a5\) at cfa\+80 + DW_CFA_offset_extended_sf: r10 \(\$a6\) at cfa\+88 + DW_CFA_offset_extended_sf: r11 \(\$a7\) at cfa\+96 + DW_CFA_offset_extended_sf: r12 \(\$t0\) at cfa\+104 + DW_CFA_offset_extended_sf: r13 \(\$t1\) at cfa\+112 + DW_CFA_offset_extended_sf: r14 \(\$t2\) at cfa\+120 + DW_CFA_offset_extended_sf: r15 \(\$t3\) at cfa\+128 + DW_CFA_offset_extended_sf: r16 \(\$t4\) at cfa\+136 + DW_CFA_offset_extended_sf: r17 \(\$t5\) at cfa\+144 + DW_CFA_offset_extended_sf: r18 \(\$t6\) at cfa\+152 + DW_CFA_offset_extended_sf: r19 \(\$t7\) at cfa\+160 + DW_CFA_offset_extended_sf: r20 \(\$t8\) at cfa\+168 + DW_CFA_offset_extended_sf: r21 \(\$r21\) at cfa\+176 + DW_CFA_offset_extended_sf: r22 \(\$fp\) at cfa\+184 + DW_CFA_offset_extended_sf: r23 \(\$s0\) at cfa\+192 + DW_CFA_offset_extended_sf: r24 \(\$s1\) at cfa\+200 + DW_CFA_offset_extended_sf: r25 \(\$s2\) at cfa\+208 + DW_CFA_offset_extended_sf: r26 \(\$s3\) at cfa\+216 + DW_CFA_offset_extended_sf: r27 \(\$s4\) at cfa\+224 + DW_CFA_offset_extended_sf: r28 \(\$s5\) at cfa\+232 + DW_CFA_offset_extended_sf: r29 \(\$s6\) at cfa\+240 + DW_CFA_offset_extended_sf: r30 \(\$s7\) at cfa\+248 + DW_CFA_offset_extended_sf: r31 \(\$s8\) at cfa\+256 + DW_CFA_offset_extended_sf: r0 \(\$zero\) at cfa\+8 + DW_CFA_offset_extended_sf: r1 \(\$ra\) at cfa\+16 + DW_CFA_offset_extended_sf: r2 \(\$tp\) at cfa\+24 + DW_CFA_offset_extended_sf: r3 \(\$sp\) at cfa\+32 + DW_CFA_offset_extended_sf: r4 \(\$a0\) at cfa\+40 + DW_CFA_offset_extended_sf: r5 \(\$a1\) at cfa\+48 + DW_CFA_offset_extended_sf: r6 \(\$a2\) at cfa\+56 + DW_CFA_offset_extended_sf: r7 \(\$a3\) at cfa\+64 + DW_CFA_offset_extended_sf: r8 \(\$a4\) at cfa\+72 + DW_CFA_offset_extended_sf: r9 \(\$a5\) at cfa\+80 + DW_CFA_offset_extended_sf: r10 \(\$a6\) at cfa\+88 + DW_CFA_offset_extended_sf: r11 \(\$a7\) at cfa\+96 + DW_CFA_offset_extended_sf: r12 \(\$t0\) at cfa\+104 + DW_CFA_offset_extended_sf: r13 \(\$t1\) at cfa\+112 + DW_CFA_offset_extended_sf: r14 \(\$t2\) at cfa\+120 + DW_CFA_offset_extended_sf: r15 \(\$t3\) at cfa\+128 + DW_CFA_offset_extended_sf: r16 \(\$t4\) at cfa\+136 + DW_CFA_offset_extended_sf: r17 \(\$t5\) at cfa\+144 + DW_CFA_offset_extended_sf: r18 \(\$t6\) at cfa\+152 + DW_CFA_offset_extended_sf: r19 \(\$t7\) at cfa\+160 + DW_CFA_offset_extended_sf: r20 \(\$t8\) at cfa\+168 + DW_CFA_offset_extended_sf: r21 \(\$r21\) at cfa\+176 + DW_CFA_offset_extended_sf: r22 \(\$fp\) at cfa\+184 + DW_CFA_offset_extended_sf: r23 \(\$s0\) at cfa\+192 + DW_CFA_offset_extended_sf: r24 \(\$s1\) at cfa\+200 + DW_CFA_offset_extended_sf: r25 \(\$s2\) at cfa\+208 + DW_CFA_offset_extended_sf: r26 \(\$s3\) at cfa\+216 + DW_CFA_offset_extended_sf: r27 \(\$s4\) at cfa\+224 + DW_CFA_offset_extended_sf: r28 \(\$s5\) at cfa\+232 + DW_CFA_offset_extended_sf: r29 \(\$s6\) at cfa\+240 + DW_CFA_offset_extended_sf: r30 \(\$s7\) at cfa\+248 + DW_CFA_offset_extended_sf: r31 \(\$s8\) at cfa\+256 + DW_CFA_offset_extended_sf: r32 \(\$fa0\) at cfa\+264 + DW_CFA_offset_extended_sf: r33 \(\$fa1\) at cfa\+272 + DW_CFA_offset_extended_sf: r34 \(\$fa2\) at cfa\+280 + DW_CFA_offset_extended_sf: r35 \(\$fa3\) at cfa\+288 + DW_CFA_offset_extended_sf: r36 \(\$fa4\) at cfa\+296 + DW_CFA_offset_extended_sf: r37 \(\$fa5\) at cfa\+304 + DW_CFA_offset_extended_sf: r38 \(\$fa6\) at cfa\+312 + DW_CFA_offset_extended_sf: r39 \(\$fa7\) at cfa\+320 + DW_CFA_offset_extended_sf: r40 \(\$ft0\) at cfa\+328 + DW_CFA_offset_extended_sf: r41 \(\$ft1\) at cfa\+336 + DW_CFA_offset_extended_sf: r42 \(\$ft2\) at cfa\+344 + DW_CFA_offset_extended_sf: r43 \(\$ft3\) at cfa\+352 + DW_CFA_offset_extended_sf: r44 \(\$ft4\) at cfa\+360 + DW_CFA_offset_extended_sf: r45 \(\$ft5\) at cfa\+368 + DW_CFA_offset_extended_sf: r46 \(\$ft6\) at cfa\+376 + DW_CFA_offset_extended_sf: r47 \(\$ft7\) at cfa\+384 + DW_CFA_offset_extended_sf: r48 \(\$ft8\) at cfa\+392 + DW_CFA_offset_extended_sf: r49 \(\$ft9\) at cfa\+400 + DW_CFA_offset_extended_sf: r50 \(\$ft10\) at cfa\+408 + DW_CFA_offset_extended_sf: r51 \(\$ft11\) at cfa\+416 + DW_CFA_offset_extended_sf: r52 \(\$ft12\) at cfa\+424 + DW_CFA_offset_extended_sf: r53 \(\$ft13\) at cfa\+432 + DW_CFA_offset_extended_sf: r54 \(\$ft14\) at cfa\+440 + DW_CFA_offset_extended_sf: r55 \(\$ft15\) at cfa\+448 + DW_CFA_offset_extended_sf: r56 \(\$fs0\) at cfa\+456 + DW_CFA_offset_extended_sf: r57 \(\$fs1\) at cfa\+464 + DW_CFA_offset_extended_sf: r58 \(\$fs2\) at cfa\+472 + DW_CFA_offset_extended_sf: r59 \(\$fs3\) at cfa\+480 + DW_CFA_offset_extended_sf: r60 \(\$fs4\) at cfa\+488 + DW_CFA_offset_extended_sf: r61 \(\$fs5\) at cfa\+496 + DW_CFA_offset_extended_sf: r62 \(\$fs6\) at cfa\+504 + DW_CFA_offset_extended_sf: r63 \(\$fs7\) at cfa\+512 + DW_CFA_offset_extended_sf: r32 \(\$fa0\) at cfa\+264 + DW_CFA_offset_extended_sf: r33 \(\$fa1\) at cfa\+272 + DW_CFA_offset_extended_sf: r34 \(\$fa2\) at cfa\+280 + DW_CFA_offset_extended_sf: r35 \(\$fa3\) at cfa\+288 + DW_CFA_offset_extended_sf: r36 \(\$fa4\) at cfa\+296 + DW_CFA_offset_extended_sf: r37 \(\$fa5\) at cfa\+304 + DW_CFA_offset_extended_sf: r38 \(\$fa6\) at cfa\+312 + DW_CFA_offset_extended_sf: r39 \(\$fa7\) at cfa\+320 + DW_CFA_offset_extended_sf: r40 \(\$ft0\) at cfa\+328 + DW_CFA_offset_extended_sf: r41 \(\$ft1\) at cfa\+336 + DW_CFA_offset_extended_sf: r42 \(\$ft2\) at cfa\+344 + DW_CFA_offset_extended_sf: r43 \(\$ft3\) at cfa\+352 + DW_CFA_offset_extended_sf: r44 \(\$ft4\) at cfa\+360 + DW_CFA_offset_extended_sf: r45 \(\$ft5\) at cfa\+368 + DW_CFA_offset_extended_sf: r46 \(\$ft6\) at cfa\+376 + DW_CFA_offset_extended_sf: r47 \(\$ft7\) at cfa\+384 + DW_CFA_offset_extended_sf: r48 \(\$ft8\) at cfa\+392 + DW_CFA_offset_extended_sf: r49 \(\$ft9\) at cfa\+400 + DW_CFA_offset_extended_sf: r50 \(\$ft10\) at cfa\+408 + DW_CFA_offset_extended_sf: r51 \(\$ft11\) at cfa\+416 + DW_CFA_offset_extended_sf: r52 \(\$ft12\) at cfa\+424 + DW_CFA_offset_extended_sf: r53 \(\$ft13\) at cfa\+432 + DW_CFA_offset_extended_sf: r54 \(\$ft14\) at cfa\+440 + DW_CFA_offset_extended_sf: r55 \(\$ft15\) at cfa\+448 + DW_CFA_offset_extended_sf: r56 \(\$fs0\) at cfa\+456 + DW_CFA_offset_extended_sf: r57 \(\$fs1\) at cfa\+464 + DW_CFA_offset_extended_sf: r58 \(\$fs2\) at cfa\+472 + DW_CFA_offset_extended_sf: r59 \(\$fs3\) at cfa\+480 + DW_CFA_offset_extended_sf: r60 \(\$fs4\) at cfa\+488 + DW_CFA_offset_extended_sf: r61 \(\$fs5\) at cfa\+496 + DW_CFA_offset_extended_sf: r62 \(\$fs6\) at cfa\+504 + DW_CFA_offset_extended_sf: r63 \(\$fs7\) at cfa\+512 + DW_CFA_offset_extended_sf: r32 \(\$fa0\) at cfa\+264 + DW_CFA_offset_extended_sf: r33 \(\$fa1\) at cfa\+272 + DW_CFA_offset_extended_sf: r34 \(\$fa2\) at cfa\+280 + DW_CFA_offset_extended_sf: r35 \(\$fa3\) at cfa\+288 + DW_CFA_offset_extended_sf: r36 \(\$fa4\) at cfa\+296 + DW_CFA_offset_extended_sf: r37 \(\$fa5\) at cfa\+304 + DW_CFA_offset_extended_sf: r38 \(\$fa6\) at cfa\+312 + DW_CFA_offset_extended_sf: r39 \(\$fa7\) at cfa\+320 + DW_CFA_offset_extended_sf: r40 \(\$ft0\) at cfa\+328 + DW_CFA_offset_extended_sf: r41 \(\$ft1\) at cfa\+336 + DW_CFA_offset_extended_sf: r42 \(\$ft2\) at cfa\+344 + DW_CFA_offset_extended_sf: r43 \(\$ft3\) at cfa\+352 + DW_CFA_offset_extended_sf: r44 \(\$ft4\) at cfa\+360 + DW_CFA_offset_extended_sf: r45 \(\$ft5\) at cfa\+368 + DW_CFA_offset_extended_sf: r46 \(\$ft6\) at cfa\+376 + DW_CFA_offset_extended_sf: r47 \(\$ft7\) at cfa\+384 + DW_CFA_offset_extended_sf: r48 \(\$ft8\) at cfa\+392 + DW_CFA_offset_extended_sf: r49 \(\$ft9\) at cfa\+400 + DW_CFA_offset_extended_sf: r50 \(\$ft10\) at cfa\+408 + DW_CFA_offset_extended_sf: r51 \(\$ft11\) at cfa\+416 + DW_CFA_offset_extended_sf: r52 \(\$ft12\) at cfa\+424 + DW_CFA_offset_extended_sf: r53 \(\$ft13\) at cfa\+432 + DW_CFA_offset_extended_sf: r54 \(\$ft14\) at cfa\+440 + DW_CFA_offset_extended_sf: r55 \(\$ft15\) at cfa\+448 + DW_CFA_offset_extended_sf: r56 \(\$fs0\) at cfa\+456 + DW_CFA_offset_extended_sf: r57 \(\$fs1\) at cfa\+464 + DW_CFA_offset_extended_sf: r58 \(\$fs2\) at cfa\+472 + DW_CFA_offset_extended_sf: r59 \(\$fs3\) at cfa\+480 + DW_CFA_offset_extended_sf: r60 \(\$fs4\) at cfa\+488 + DW_CFA_offset_extended_sf: r61 \(\$fs5\) at cfa\+496 + DW_CFA_offset_extended_sf: r62 \(\$fs6\) at cfa\+504 + DW_CFA_offset_extended_sf: r63 \(\$fs7\) at cfa\+512 + DW_CFA_offset_extended_sf: r32 \(\$fa0\) at cfa\+264 + DW_CFA_offset_extended_sf: r33 \(\$fa1\) at cfa\+272 + DW_CFA_offset_extended_sf: r34 \(\$fa2\) at cfa\+280 + DW_CFA_offset_extended_sf: r35 \(\$fa3\) at cfa\+288 + DW_CFA_offset_extended_sf: r36 \(\$fa4\) at cfa\+296 + DW_CFA_offset_extended_sf: r37 \(\$fa5\) at cfa\+304 + DW_CFA_offset_extended_sf: r38 \(\$fa6\) at cfa\+312 + DW_CFA_offset_extended_sf: r39 \(\$fa7\) at cfa\+320 + DW_CFA_offset_extended_sf: r40 \(\$ft0\) at cfa\+328 + DW_CFA_offset_extended_sf: r41 \(\$ft1\) at cfa\+336 + DW_CFA_offset_extended_sf: r42 \(\$ft2\) at cfa\+344 + DW_CFA_offset_extended_sf: r43 \(\$ft3\) at cfa\+352 + DW_CFA_offset_extended_sf: r44 \(\$ft4\) at cfa\+360 + DW_CFA_offset_extended_sf: r45 \(\$ft5\) at cfa\+368 + DW_CFA_offset_extended_sf: r46 \(\$ft6\) at cfa\+376 + DW_CFA_offset_extended_sf: r47 \(\$ft7\) at cfa\+384 + DW_CFA_offset_extended_sf: r48 \(\$ft8\) at cfa\+392 + DW_CFA_offset_extended_sf: r49 \(\$ft9\) at cfa\+400 + DW_CFA_offset_extended_sf: r50 \(\$ft10\) at cfa\+408 + DW_CFA_offset_extended_sf: r51 \(\$ft11\) at cfa\+416 + DW_CFA_offset_extended_sf: r52 \(\$ft12\) at cfa\+424 + DW_CFA_offset_extended_sf: r53 \(\$ft13\) at cfa\+432 + DW_CFA_offset_extended_sf: r54 \(\$ft14\) at cfa\+440 + DW_CFA_offset_extended_sf: r55 \(\$ft15\) at cfa\+448 + DW_CFA_offset_extended_sf: r56 \(\$fs0\) at cfa\+456 + DW_CFA_offset_extended_sf: r57 \(\$fs1\) at cfa\+464 + DW_CFA_offset_extended_sf: r58 \(\$fs2\) at cfa\+472 + DW_CFA_offset_extended_sf: r59 \(\$fs3\) at cfa\+480 + DW_CFA_offset_extended_sf: r60 \(\$fs4\) at cfa\+488 + DW_CFA_offset_extended_sf: r61 \(\$fs5\) at cfa\+496 + DW_CFA_offset_extended_sf: r62 \(\$fs6\) at cfa\+504 + DW_CFA_offset_extended_sf: r63 \(\$fs7\) at cfa\+512 + DW_CFA_offset_extended_sf: r32 \(\$fa0\) at cfa\+264 + DW_CFA_offset_extended_sf: r33 \(\$fa1\) at cfa\+272 + DW_CFA_offset_extended_sf: r34 \(\$fa2\) at cfa\+280 + DW_CFA_offset_extended_sf: r35 \(\$fa3\) at cfa\+288 + DW_CFA_offset_extended_sf: r36 \(\$fa4\) at cfa\+296 + DW_CFA_offset_extended_sf: r37 \(\$fa5\) at cfa\+304 + DW_CFA_offset_extended_sf: r38 \(\$fa6\) at cfa\+312 + DW_CFA_offset_extended_sf: r39 \(\$fa7\) at cfa\+320 + DW_CFA_offset_extended_sf: r40 \(\$ft0\) at cfa\+328 + DW_CFA_offset_extended_sf: r41 \(\$ft1\) at cfa\+336 + DW_CFA_offset_extended_sf: r42 \(\$ft2\) at cfa\+344 + DW_CFA_offset_extended_sf: r43 \(\$ft3\) at cfa\+352 + DW_CFA_offset_extended_sf: r44 \(\$ft4\) at cfa\+360 + DW_CFA_offset_extended_sf: r45 \(\$ft5\) at cfa\+368 + DW_CFA_offset_extended_sf: r46 \(\$ft6\) at cfa\+376 + DW_CFA_offset_extended_sf: r47 \(\$ft7\) at cfa\+384 + DW_CFA_offset_extended_sf: r48 \(\$ft8\) at cfa\+392 + DW_CFA_offset_extended_sf: r49 \(\$ft9\) at cfa\+400 + DW_CFA_offset_extended_sf: r50 \(\$ft10\) at cfa\+408 + DW_CFA_offset_extended_sf: r51 \(\$ft11\) at cfa\+416 + DW_CFA_offset_extended_sf: r52 \(\$ft12\) at cfa\+424 + DW_CFA_offset_extended_sf: r53 \(\$ft13\) at cfa\+432 + DW_CFA_offset_extended_sf: r54 \(\$ft14\) at cfa\+440 + DW_CFA_offset_extended_sf: r55 \(\$ft15\) at cfa\+448 + DW_CFA_offset_extended_sf: r56 \(\$fs0\) at cfa\+456 + DW_CFA_offset_extended_sf: r57 \(\$fs1\) at cfa\+464 + DW_CFA_offset_extended_sf: r58 \(\$fs2\) at cfa\+472 + DW_CFA_offset_extended_sf: r59 \(\$fs3\) at cfa\+480 + DW_CFA_offset_extended_sf: r60 \(\$fs4\) at cfa\+488 + DW_CFA_offset_extended_sf: r61 \(\$fs5\) at cfa\+496 + DW_CFA_offset_extended_sf: r62 \(\$fs6\) at cfa\+504 + DW_CFA_offset_extended_sf: r63 \(\$fs7\) at cfa\+512 +#... diff --git a/gas/testsuite/gas/loongarch/dwarf-regnum.s b/gas/testsuite/gas/loongarch/dwarf-regnum.s new file mode 100644 index 0000000..a94a1a1 --- /dev/null +++ b/gas/testsuite/gas/loongarch/dwarf-regnum.s @@ -0,0 +1,348 @@ +# Check whether CFI directives can access all register names. + .text + .globl _start +_start: + .cfi_startproc + nop + # dwarf 0-31 + .cfi_offset 0, 8 + .cfi_offset 1, 16 + .cfi_offset 2, 24 + .cfi_offset 3, 32 + .cfi_offset 4, 40 + .cfi_offset 5, 48 + .cfi_offset 6, 56 + .cfi_offset 7, 64 + .cfi_offset 8, 72 + .cfi_offset 9, 80 + .cfi_offset 10,88 + .cfi_offset 11,96 + .cfi_offset 12,104 + .cfi_offset 13,112 + .cfi_offset 14,120 + .cfi_offset 15,128 + .cfi_offset 16,136 + .cfi_offset 17,144 + .cfi_offset 18,152 + .cfi_offset 19,160 + .cfi_offset 20,168 + .cfi_offset 21,176 + .cfi_offset 22,184 + .cfi_offset 23,192 + .cfi_offset 24,200 + .cfi_offset 25,208 + .cfi_offset 26,216 + .cfi_offset 27,224 + .cfi_offset 28,232 + .cfi_offset 29,240 + .cfi_offset 30,248 + .cfi_offset 31,256 + + # ABI GPRs name + .cfi_offset $r0, 8 + .cfi_offset $r1, 16 + .cfi_offset $r2, 24 + .cfi_offset $r3, 32 + .cfi_offset $r4, 40 + .cfi_offset $r5, 48 + .cfi_offset $r6, 56 + .cfi_offset $r7, 64 + .cfi_offset $r8, 72 + .cfi_offset $r9, 80 + .cfi_offset $r10,88 + .cfi_offset $r11,96 + .cfi_offset $r12,104 + .cfi_offset $r13,112 + .cfi_offset $r14,120 + .cfi_offset $r15,128 + .cfi_offset $r16,136 + .cfi_offset $r17,144 + .cfi_offset $r18,152 + .cfi_offset $r19,160 + .cfi_offset $r20,168 + .cfi_offset $r21,176 + .cfi_offset $r22,184 + .cfi_offset $r23,192 + .cfi_offset $r24,200 + .cfi_offset $r25,208 + .cfi_offset $r26,216 + .cfi_offset $r27,224 + .cfi_offset $r28,232 + .cfi_offset $r29,240 + .cfi_offset $r30,248 + .cfi_offset $r31,256 + + # ABI GPRs alias + .cfi_offset $zero,8 + .cfi_offset $ra, 16 + .cfi_offset $tp, 24 + .cfi_offset $sp, 32 + .cfi_offset $a0, 40 + .cfi_offset $a1, 48 + .cfi_offset $a2, 56 + .cfi_offset $a3, 64 + .cfi_offset $a4, 72 + .cfi_offset $a5, 80 + .cfi_offset $a6, 88 + .cfi_offset $a7, 96 + .cfi_offset $t0, 104 + .cfi_offset $t1, 112 + .cfi_offset $t2, 120 + .cfi_offset $t3, 128 + .cfi_offset $t4, 136 + .cfi_offset $t5, 144 + .cfi_offset $t6, 152 + .cfi_offset $t7, 160 + .cfi_offset $t8, 168 + .cfi_offset $r21, 176 + .cfi_offset $fp, 184 + .cfi_offset $s0, 192 + .cfi_offset $s1, 200 + .cfi_offset $s2, 208 + .cfi_offset $s3, 216 + .cfi_offset $s4, 224 + .cfi_offset $s5, 232 + .cfi_offset $s6, 240 + .cfi_offset $s7, 248 + .cfi_offset $s8, 256 + + # numeric GPRs alias + .cfi_offset r0, 8 + .cfi_offset r1, 16 + .cfi_offset r2, 24 + .cfi_offset r3, 32 + .cfi_offset r4, 40 + .cfi_offset r5, 48 + .cfi_offset r6, 56 + .cfi_offset r7, 64 + .cfi_offset r8, 72 + .cfi_offset r9, 80 + .cfi_offset r10,88 + .cfi_offset r11,96 + .cfi_offset r12,104 + .cfi_offset r13,112 + .cfi_offset r14,120 + .cfi_offset r15,128 + .cfi_offset r16,136 + .cfi_offset r17,144 + .cfi_offset r18,152 + .cfi_offset r19,160 + .cfi_offset r20,168 + .cfi_offset r21,176 + .cfi_offset r22,184 + .cfi_offset r23,192 + .cfi_offset r24,200 + .cfi_offset r25,208 + .cfi_offset r26,216 + .cfi_offset r27,224 + .cfi_offset r28,232 + .cfi_offset r29,240 + .cfi_offset r30,248 + .cfi_offset r31,256 + + # without "$" GPRs alias + .cfi_offset zero,8 + .cfi_offset ra, 16 + .cfi_offset tp, 24 + .cfi_offset sp, 32 + .cfi_offset a0, 40 + .cfi_offset a1, 48 + .cfi_offset a2, 56 + .cfi_offset a3, 64 + .cfi_offset a4, 72 + .cfi_offset a5, 80 + .cfi_offset a6, 88 + .cfi_offset a7, 96 + .cfi_offset t0, 104 + .cfi_offset t1, 112 + .cfi_offset t2, 120 + .cfi_offset t3, 128 + .cfi_offset t4, 136 + .cfi_offset t5, 144 + .cfi_offset t6, 152 + .cfi_offset t7, 160 + .cfi_offset t8, 168 + .cfi_offset r21, 176 + .cfi_offset fp, 184 + .cfi_offset s0, 192 + .cfi_offset s1, 200 + .cfi_offset s2, 208 + .cfi_offset s3, 216 + .cfi_offset s4, 224 + .cfi_offset s5, 232 + .cfi_offset s6, 240 + .cfi_offset s7, 248 + .cfi_offset s8, 256 + + # dwarf 32-63 + .cfi_offset 32,264 + .cfi_offset 33,272 + .cfi_offset 34,280 + .cfi_offset 35,288 + .cfi_offset 36,296 + .cfi_offset 37,304 + .cfi_offset 38,312 + .cfi_offset 39,320 + .cfi_offset 40,328 + .cfi_offset 41,336 + .cfi_offset 42,344 + .cfi_offset 43,352 + .cfi_offset 44,360 + .cfi_offset 45,368 + .cfi_offset 46,376 + .cfi_offset 47,384 + .cfi_offset 48,392 + .cfi_offset 49,400 + .cfi_offset 50,408 + .cfi_offset 51,416 + .cfi_offset 52,424 + .cfi_offset 53,432 + .cfi_offset 54,440 + .cfi_offset 55,448 + .cfi_offset 56,456 + .cfi_offset 57,464 + .cfi_offset 58,472 + .cfi_offset 59,480 + .cfi_offset 60,488 + .cfi_offset 61,496 + .cfi_offset 62,504 + .cfi_offset 63,512 + + # ABI FPRs names + .cfi_offset $f0, 264 + .cfi_offset $f1, 272 + .cfi_offset $f2, 280 + .cfi_offset $f3, 288 + .cfi_offset $f4, 296 + .cfi_offset $f5, 304 + .cfi_offset $f6, 312 + .cfi_offset $f7, 320 + .cfi_offset $f8, 328 + .cfi_offset $f9, 336 + .cfi_offset $f10,344 + .cfi_offset $f11,352 + .cfi_offset $f12,360 + .cfi_offset $f13,368 + .cfi_offset $f14,376 + .cfi_offset $f15,384 + .cfi_offset $f16,392 + .cfi_offset $f17,400 + .cfi_offset $f18,408 + .cfi_offset $f19,416 + .cfi_offset $f20,424 + .cfi_offset $f21,432 + .cfi_offset $f22,440 + .cfi_offset $f23,448 + .cfi_offset $f24,456 + .cfi_offset $f25,464 + .cfi_offset $f26,472 + .cfi_offset $f27,480 + .cfi_offset $f28,488 + .cfi_offset $f29,496 + .cfi_offset $f30,504 + .cfi_offset $f31,512 + + # ABI FPRs alias + .cfi_offset $fa0, 264 + .cfi_offset $fa1, 272 + .cfi_offset $fa2, 280 + .cfi_offset $fa3, 288 + .cfi_offset $fa4, 296 + .cfi_offset $fa5, 304 + .cfi_offset $fa6, 312 + .cfi_offset $fa7, 320 + .cfi_offset $ft0, 328 + .cfi_offset $ft1, 336 + .cfi_offset $ft2,344 + .cfi_offset $ft3,352 + .cfi_offset $ft4,360 + .cfi_offset $ft5,368 + .cfi_offset $ft6,376 + .cfi_offset $ft7,384 + .cfi_offset $ft8,392 + .cfi_offset $ft9,400 + .cfi_offset $ft10,408 + .cfi_offset $ft11,416 + .cfi_offset $ft12,424 + .cfi_offset $ft13,432 + .cfi_offset $ft14,440 + .cfi_offset $ft15,448 + .cfi_offset $fs0,456 + .cfi_offset $fs1,464 + .cfi_offset $fs2,472 + .cfi_offset $fs3,480 + .cfi_offset $fs4,488 + .cfi_offset $fs5,496 + .cfi_offset $fs6,504 + .cfi_offset $fs7,512 + + # numeric FPRs names + .cfi_offset f0, 264 + .cfi_offset f1, 272 + .cfi_offset f2, 280 + .cfi_offset f3, 288 + .cfi_offset f4, 296 + .cfi_offset f5, 304 + .cfi_offset f6, 312 + .cfi_offset f7, 320 + .cfi_offset f8, 328 + .cfi_offset f9, 336 + .cfi_offset f10,344 + .cfi_offset f11,352 + .cfi_offset f12,360 + .cfi_offset f13,368 + .cfi_offset f14,376 + .cfi_offset f15,384 + .cfi_offset f16,392 + .cfi_offset f17,400 + .cfi_offset f18,408 + .cfi_offset f19,416 + .cfi_offset f20,424 + .cfi_offset f21,432 + .cfi_offset f22,440 + .cfi_offset f23,448 + .cfi_offset f24,456 + .cfi_offset f25,464 + .cfi_offset f26,472 + .cfi_offset f27,480 + .cfi_offset f28,488 + .cfi_offset f29,496 + .cfi_offset f30,504 + .cfi_offset f31,512 + + # without "$" FPRs alias + .cfi_offset fa0, 264 + .cfi_offset fa1, 272 + .cfi_offset fa2, 280 + .cfi_offset fa3, 288 + .cfi_offset fa4, 296 + .cfi_offset fa5, 304 + .cfi_offset fa6, 312 + .cfi_offset fa7, 320 + .cfi_offset ft0, 328 + .cfi_offset ft1, 336 + .cfi_offset ft2,344 + .cfi_offset ft3,352 + .cfi_offset ft4,360 + .cfi_offset ft5,368 + .cfi_offset ft6,376 + .cfi_offset ft7,384 + .cfi_offset ft8,392 + .cfi_offset ft9,400 + .cfi_offset ft10,408 + .cfi_offset ft11,416 + .cfi_offset ft12,424 + .cfi_offset ft13,432 + .cfi_offset ft14,440 + .cfi_offset ft15,448 + .cfi_offset fs0,456 + .cfi_offset fs1,464 + .cfi_offset fs2,472 + .cfi_offset fs3,480 + .cfi_offset fs4,488 + .cfi_offset fs5,496 + .cfi_offset fs6,504 + .cfi_offset fs7,512 + + nop + .cfi_endproc diff --git a/include/opcode/loongarch.h b/include/opcode/loongarch.h index 5425eaf..493fe9b 100644 --- a/include/opcode/loongarch.h +++ b/include/opcode/loongarch.h @@ -267,6 +267,10 @@ dec2 : [1-9][0-9]? extern const char *const loongarch_cr_normal_name[4]; extern const char *const loongarch_v_normal_name[32]; extern const char *const loongarch_x_normal_name[32]; + extern const char *const loongarch_r_cfi_name[32]; + extern const char *const loongarch_r_cfi_name_alias[32]; + extern const char *const loongarch_f_cfi_name[32]; + extern const char *const loongarch_f_cfi_name_alias[32]; extern struct loongarch_ase loongarch_ASEs[]; diff --git a/opcodes/loongarch-opc.c b/opcodes/loongarch-opc.c index 0ba745f..6c2b476 100644 --- a/opcodes/loongarch-opc.c +++ b/opcodes/loongarch-opc.c @@ -126,6 +126,38 @@ const char *const loongarch_x_normal_name[32] = "$xr24", "$xr25", "$xr26", "$xr27", "$xr28", "$xr29", "$xr30", "$xr31", }; +const char *const loongarch_r_cfi_name[32] = +{ + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", +}; + +const char *const loongarch_r_cfi_name_alias[32] = +{ + "zero", "ra", "tp", "sp", "a0", "a1", "a2", "a3", + "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3", + "t4", "t5", "t6", "t7", "t8", "r21","fp", "s0", + "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", +}; + +const char *const loongarch_f_cfi_name[32] = +{ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", + "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", + "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", + "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", +}; + +const char *const loongarch_f_cfi_name_alias[32] = +{ + "fa0", "fa1", "fa2", "fa3", "fa4", "fa5", "fa6", "fa7", + "ft0", "ft1", "ft2", "ft3", "ft4", "ft5", "ft6", "ft7", + "ft8", "ft9", "ft10", "ft11", "ft12", "ft13", "ft14", "ft15", + "fs0", "fs1", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7", +}; + /* Can not use xx_pa for abs. */ /* For LoongArch32 abs. */ |