public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Kito Cheng <kito@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2821] RISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand Date: Fri, 23 Sep 2022 16:01:22 +0000 (GMT) [thread overview] Message-ID: <20220923160122.A3CFF3857B8D@sourceware.org> (raw) https://gcc.gnu.org/g:7d4df630c6cfb1909288a2796ec2f8b9ec4e8486 commit r13-2821-g7d4df630c6cfb1909288a2796ec2f8b9ec4e8486 Author: Vineet Gupta <vineetg@rivosinc.com> Date: Fri Sep 2 16:08:20 2022 -0700 RISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand The current macro has several && and || making it really hard to understand the first time. Signed-off-by: Vineet Gupta <vineetg@rivosinc.com> gcc/ChangeLog: * config/riscv/riscv.h (LOCAL_SYM_P): New. (USE_LOAD_ADDRESS_MACRO): Simplify by calling LOCAL_SYM_P. Diff: --- gcc/config/riscv/riscv.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h index eb1284e56d6..363113c6511 100644 --- a/gcc/config/riscv/riscv.h +++ b/gcc/config/riscv/riscv.h @@ -749,18 +749,19 @@ typedef struct { #define CASE_VECTOR_MODE SImode #define CASE_VECTOR_PC_RELATIVE (riscv_cmodel != CM_MEDLOW) +#define LOCAL_SYM_P(sym) \ + ((SYMBOL_REF_P (sym) && SYMBOL_REF_LOCAL_P (sym)) \ + || ((GET_CODE (sym) == CONST) \ + && SYMBOL_REF_P (XEXP (XEXP (sym, 0),0)) \ + && SYMBOL_REF_LOCAL_P (XEXP (XEXP (sym, 0),0)))) + /* The load-address macro is used for PC-relative addressing of symbols that bind locally. Don't use it for symbols that should be addressed via the GOT. Also, avoid it for CM_MEDLOW, where LUI addressing currently results in more opportunities for linker relaxation. */ #define USE_LOAD_ADDRESS_MACRO(sym) \ (!TARGET_EXPLICIT_RELOCS && \ - ((flag_pic \ - && ((SYMBOL_REF_P (sym) && SYMBOL_REF_LOCAL_P (sym)) \ - || ((GET_CODE (sym) == CONST) \ - && SYMBOL_REF_P (XEXP (XEXP (sym, 0),0)) \ - && SYMBOL_REF_LOCAL_P (XEXP (XEXP (sym, 0),0))))) \ - || riscv_cmodel == CM_MEDANY)) + ((flag_pic && LOCAL_SYM_P (sym)) || riscv_cmodel == CM_MEDANY)) /* Define this as 1 if `char' should by default be signed; else as 0. */ #define DEFAULT_SIGNED_CHAR 0
reply other threads:[~2022-09-23 16:01 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220923160122.A3CFF3857B8D@sourceware.org \ --to=kito@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).