diff options
author | Vineet Gupta <vineetg@rivosinc.com> | 2022-09-02 16:08:20 -0700 |
---|---|---|
committer | Kito Cheng <kito.cheng@sifive.com> | 2022-09-23 23:51:42 +0800 |
commit | 7d4df630c6cfb1909288a2796ec2f8b9ec4e8486 (patch) | |
tree | c8d9c2e95959b524c804f0fabf970c43574381fb /gcc/config | |
parent | b2fe02b476afc1cddb3abcf26ec4b1e072a9401b (diff) | |
download | gcc-7d4df630c6cfb1909288a2796ec2f8b9ec4e8486.zip gcc-7d4df630c6cfb1909288a2796ec2f8b9ec4e8486.tar.gz gcc-7d4df630c6cfb1909288a2796ec2f8b9ec4e8486.tar.bz2 |
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.
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/riscv/riscv.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h index eb1284e..363113c 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 |