public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Vineet Gupta <vineetg@rivosinc.com>
To: Palmer Dabbelt <palmer@rivosinc.com>
Cc: collison@rivosinc.com, gnu-toolchain@rivosinc.com,
	Kito Cheng <kito.cheng@gmail.com>,
	philipp.tomsich@vrull.eu, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/2] RISC-V: remove CM_PIC as it doesn't do much
Date: Fri, 2 Sep 2022 13:38:40 -0700	[thread overview]
Message-ID: <51ff4d6d-16be-579a-3a84-3f383c8d038e@rivosinc.com> (raw)
In-Reply-To: <376353ac-6bfc-05c9-cb32-85e87eec177d@rivosinc.com>



On 8/31/22 13:39, Vineet Gupta wrote:
> 
> 
> On 8/31/22 07:57, Palmer Dabbelt wrote:
>>>    if (flag_pic)
>>> -    riscv_cmodel = CM_PIC;
>>> +    riscv_cmodel = CM_MEDANY;
>>>
>>>    /* We get better code with explicit relocs for CM_MEDLOW, but
>>>       worse code for the others (for now).  Pick the best default.  */
>>
>> I'm fine either way on this one: having CM_PIC gone makes it a bit 
>> more likely to confuse CM_MEDANY with PIC, but flag_pic is overriding 
>> riscv_cmodel anyway so this isn't really used and deleting code is 
>> always a plus.
> 
> Indeed this was the most contentious part of removing CM_PIC, but it 
> seems this is the way fwd. I'll add Kito's comment from [1] in code to 
> make it more explicit.
> 
> [1]https://github.com/riscv-non-isa/riscv-c-api-doc/pull/11#issuecomment-686385585 

I think I'll punt on this one, in the short-term. The reason being it 
affects USE_LOAD_ADDRESS_MACRO.

#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))

With the patch, PIC implies CM_MEDANY and thus will change codegen for 
pic non-local symbols to also use the load address macro. I think we 
want to go in the opposite direction, i.e. wean away from the asm macros 
and have gcc codegen natively. It seems there are bugs in that area so 
once we flush them out (after creating a few as I don't know of any 
existing documented ones) this will get cleaned out.

Thx
-Vineet

  reply	other threads:[~2022-09-02 20:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 17:48 [PATCH 0/2] PIC cleanup Vineet Gupta
2022-08-30 17:48 ` [PATCH 1/2] RISC-V: remove deprecate pic code model macro Vineet Gupta
2022-08-31 14:57   ` Palmer Dabbelt
2022-08-31 15:35     ` Kito Cheng
2022-09-02 20:33       ` [PATCH v2] " Vineet Gupta
2022-09-02 21:03         ` Andreas Schwab
2022-09-02 21:05           ` [PATCH v3] " Vineet Gupta
2022-09-23 18:07             ` Vineet Gupta
2022-10-05  2:24               ` Kito Cheng
2022-10-05  3:33                 ` Vineet Gupta
2022-08-31 20:36     ` [PATCH 1/2] " Vineet Gupta
2022-08-30 17:48 ` [PATCH 2/2] RISC-V: remove CM_PIC as it doesn't do much Vineet Gupta
2022-08-31 14:57   ` Palmer Dabbelt
2022-08-31 20:39     ` Vineet Gupta
2022-09-02 20:38       ` Vineet Gupta [this message]
2022-09-02 23:08         ` [PATCH] RISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand Vineet Gupta
2022-09-23 16:01           ` Kito 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=51ff4d6d-16be-579a-3a84-3f383c8d038e@rivosinc.com \
    --to=vineetg@rivosinc.com \
    --cc=collison@rivosinc.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gnu-toolchain@rivosinc.com \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@rivosinc.com \
    --cc=philipp.tomsich@vrull.eu \
    /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).