From: Xi Ruoyao <xry111@xry111.site>
To: Lulu Cheng <chenglulu@loongson.cn>, gcc-patches@gcc.gnu.org
Cc: i@xen0n.name, xuchenghua@loongson.cn
Subject: Re: [PATCH v1 1/2] LoongArch: Modify the method of obtaining symbolic addresses.
Date: Tue, 19 Jul 2022 22:29:35 +0800 [thread overview]
Message-ID: <4d470b84a4ddc51236ad22f9069423d360de2c7a.camel@xry111.site> (raw)
In-Reply-To: <20220719130852.2011955-2-chenglulu@loongson.cn>
The change seems too large. It would be better to split it into
multiple commits (for example, just 3 commits for 1,2,3 below).
On Tue, 2022-07-19 at 21:08 +0800, Lulu Cheng wrote:
> 1. The original LA macro instruction is split into two instructions to
> obtain the address of the symbol if enable '-mexplicit-relocs'.
It's better to add some test cases (with dg-final scan-assembler) for
this. The test case will also show humans the intended behavior after
the change.
> 3. Modify the method that calls global functions. From 'la.global + jirl'
> to 'bl'.
Why? Does it means we'll rely on the assembler to emit the correct
sequence for -fno-plt? Then it would be better to use a pseudo mnemonic
like "call" instead of "bl" (because it's not a single "bl"
instruction).
/* snip */
> static bool
> loongarch_valid_index_p (struct loongarch_address_info *info, rtx x,
> machine_mode mode, bool strict_p)
> @@ -1881,6 +1978,26 @@ loongarch_classify_address (struct loongarch_address_info *info, rtx x,
> info->offset = XEXP (x, 1);
> return (loongarch_valid_base_register_p (info->reg, mode, strict_p)
> && loongarch_valid_offset_p (info->offset, mode));
> +
> + case LO_SUM:
> + info->type = ADDRESS_LO_SUM;
> + info->reg = XEXP (x, 0);
> + info->offset = XEXP (x, 1);
> + /* We have to trust the creator of the LO_SUM to do something vaguely
> + sane. Target-independent code that creates a LO_SUM should also
> + create and verify the matching HIGH. Target-independent code that
> + adds an offset to a LO_SUM must prove that the offset will not
> + induce a carry. Failure to do either of these things would be
> + a bug, and we are not required to check for it here. The MIPS
Don't copy MIPS code.
> +static bool loongarch_split_move_insn_p (rtx dest, rtx src);
Nit: "loongarch_split_move_insn_p" shall start a new line.
next prev parent reply other threads:[~2022-07-19 14:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-19 13:08 [PATCH v1 0/2] " Lulu Cheng
2022-07-19 13:08 ` [PATCH v1 1/2] " Lulu Cheng
2022-07-19 14:29 ` Xi Ruoyao [this message]
2022-07-20 0:40 ` Lulu Cheng
2022-07-19 13:08 ` [PATCH v1 2/2] LoongArch: Modify the definition of the ASM_PREFERRED_EH_DATA_FORMAT macro Lulu Cheng
2022-07-26 6:36 ` [pushed][PATCH v1 0/2] LoongArch: Modify the method of obtaining symbolic addresses Lulu Cheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4d470b84a4ddc51236ad22f9069423d360de2c7a.camel@xry111.site \
--to=xry111@xry111.site \
--cc=chenglulu@loongson.cn \
--cc=gcc-patches@gcc.gnu.org \
--cc=i@xen0n.name \
--cc=xuchenghua@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).