From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 10F753858D20 for ; Mon, 30 Oct 2023 09:07:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 10F753858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 10F753858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698656839; cv=none; b=iKcN5VeTY7i3JtOmphUaur7Ii6QwPUSIYCroNBfdebkBsiAm82wOQZ9lVpqxZ0KlobL3j2a5oHs6T5uoP6UN6DUEJ345/D2yoKfk/8F/Brjo1inXDRxmqfRxA/7qDV0f0eirPdvf6YWWsJEriQc0uee+aloRaj+rJoWJBjKVVog= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698656839; c=relaxed/simple; bh=445/1Ayv8FPg4ovAne/ZytXh/i7PlSY69RvZRfojxb8=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=vLjChTCqJuYqdajS7jbpCCFYX9+xrd3MvNRpv7LwzvZIWb0Bgg78+fQD5kYIoVR+FPv32llfxYzW6yv6VbOwiGFIRHL4wffSdBCS3sqgMxjCB0QznAQL6XHwL17f9l9zYlL08WEEO17p3dskl+e0XUX35djz4AXMdcKY8le2r0g= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from loongson.cn (unknown [10.2.6.5]) by gateway (Coremail) with SMTP id _____8BxY_A+cj9lErU1AA--.39434S3; Mon, 30 Oct 2023 17:07:10 +0800 (CST) Received: from 5.5.5 (unknown [10.2.6.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxbS89cj9lzuY2AA--.52445S4; Mon, 30 Oct 2023 17:07:10 +0800 (CST) From: Lulu Cai To: binutils@sourceware.org Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn, liuzhensong@loongson.cn, mengqinggang@loongson.cn, xry111@xry111.site, i.swmail@xen0n.name, maskray@google.com, yangtiezhu@loongson.cn, Lulu Cai Subject: [PATCH] Add support for ilp32 register alias. Date: Mon, 30 Oct 2023 17:07:08 +0800 Message-Id: <20231030090708.2006370-1-cailulu@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:AQAAf8CxbS89cj9lzuY2AA--.52445S4 X-CM-SenderInfo: xfdlz3tox6z05rqj20fqof0/1tbiAQAAB2U-EqcEhQABsp X-Coremail-Antispam: 1Uk129KBj93XoWxtw4DAry8uw18Cw1kGw4UGFX_yoW3JFyDpF 9rZrnxtr1rGFnaqrnrC345W34DXrnrWr12qF4akF1xurs8X3srZr48JFyv9F13K3yUWrWj qFW8W3WUZF1UGFXCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07j1YL9UUUUU= X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --- gas/config/tc-loongarch.c | 41 +++++++++++++++++--------------------- gdb/loongarch-tdep.c | 12 +++++------ include/opcode/loongarch.h | 8 ++++---- opcodes/loongarch-dis.c | 4 ++-- opcodes/loongarch-opc.c | 8 ++++---- 5 files changed, 34 insertions(+), 39 deletions(-) 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", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", -- 2.31.1