public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Michael Meissner <meissner@linux.ibm.com>,
	gcc-patches@gcc.gnu.org,        dje.gcc@gmail.com
Subject: Re: [PATCH], PowerPC, Patch #6, Create pc-relative addressing insns
Date: Wed, 10 Jul 2019 17:43:00 -0000	[thread overview]
Message-ID: <20190710171149.GD14074@gate.crashing.org> (raw)
In-Reply-To: <20190709223000.GA18842@ibm-toto.the-meissners.org>

Hi Mike,

On Tue, Jul 09, 2019 at 06:30:00PM -0400, Michael Meissner wrote:
> @@ -8760,12 +8762,34 @@ rs6000_cannot_force_const_mem (machine_m
>  static bool
>  use_toc_relative_ref (rtx sym, machine_mode mode)
>  {
> -  return ((constant_pool_expr_p (sym)
> -	   && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (sym),
> -					       get_pool_mode (sym)))
> -	  || (TARGET_CMODEL == CMODEL_MEDIUM
> -	      && SYMBOL_REF_LOCAL_P (sym)
> -	      && GET_MODE_SIZE (mode) <= POWERPC64_TOC_POINTER_ALIGNMENT));
> +  if (!SYMBOL_REF_P (sym) || TARGET_PCREL || !TARGET_TOC)
> +    return false;

Why the SYMBOL_REF test?  The original didn't have any.  But its comment
says
  /* Return true iff the given SYMBOL_REF refers to a constant pool entry
     that we have put in the TOC, or for cmodel=medium, if the SYMBOL_REF
     can be addressed relative to the toc pointer.  */
so perhaps you want an assert instead.

> +
> +  if (constant_pool_expr_p (sym)
> +      && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (sym),
> +					  get_pool_mode (sym)))
> +    return true;
> +
> +  return (TARGET_CMODEL == CMODEL_MEDIUM && SYMBOL_REF_LOCAL_P (sym)
> +	  && GET_MODE_SIZE (mode) <= POWERPC64_TOC_POINTER_ALIGNMENT);

Please don't put disparate things on one line, it was fine before.

> +/* Return true iff the given SYMBOL_REF refers to a constant pool entry that we
> +   have put in the pc-relative constant area, or for cmodel=medium, if the
> +   SYMBOL_REF can be addressed via pc-relative instructions.  */
> +
> +static bool
> +use_pc_relative_ref (rtx sym)
> +{
> +  if (!SYMBOL_REF_P (sym) || !TARGET_PCREL)
> +    return false;

Same here, assert please.  Or nothing, it will ICE not much later anyway.
But don't silently return if something violates the call contract.

> -static GTY(()) alias_set_type set = -1;
> +/* Return the alias set for constants stored in either the TOC or via
> +   pc-relative addressing.  */
> +static GTY(()) alias_set_type data_alias_set = -1;

Please just make a separate alias set for pcrel.  The new name isn't as
bad as just "set" :-), but "data"?  That's not great either.  Conflating
toc and pcrel isn't a good thing.

(Variables don't "return" anything btw).

>  
>  alias_set_type
> -get_TOC_alias_set (void)
> +get_data_alias_set (void)

This name is much worse than the old one.  Just make separate functions
for TOC and for pcrel?  Or is there any reason you want to share them?


Segher

  reply	other threads:[~2019-07-10 17:11 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28  0:06 Add support for PowerPC prefixed memory instructions and pc-relative support (Intro) Michael Meissner
2019-06-28  0:12 ` [PATCH] PowerPC Prefixed Memory, Patch #3, Update predicates Michael Meissner
2019-06-28 13:20   ` Segher Boessenkool
2019-06-28 14:56     ` Bill Schmidt
2019-06-28 18:54     ` Michael Meissner
2019-06-28 18:50 ` [PATCH] PowerPC Prefixed Memory, Patch #4, Add pc-relative reference support Michael Meissner
2019-07-03 22:20   ` Segher Boessenkool
2019-07-08 18:53     ` Michael Meissner
2019-07-08 18:54       ` Segher Boessenkool
2019-07-09 17:36         ` [PATCH, committed] PowerPC Prefixed Memory, Patch #5 (move create_TOC_reference) Michael Meissner
2019-07-09 18:34           ` Segher Boessenkool
2019-07-09 22:42 ` [PATCH], PowerPC, Patch #6, Create pc-relative addressing insns Michael Meissner
2019-07-10 17:43   ` Segher Boessenkool [this message]
2019-07-10 17:57     ` Michael Meissner
2019-07-10 18:55       ` Segher Boessenkool
2019-07-10 21:51   ` [PATCH], PowerPC, Patch #6, revision 2, " Michael Meissner
2019-07-11 20:10     ` Segher Boessenkool
2019-07-11 21:04       ` Michael Meissner
2019-07-11 21:38         ` Segher Boessenkool
2019-07-10  0:28 ` [PATCH], PowerPC, Patch #7, Split up SIGNED_34BIT and SIGNED_16BIT macros Michael Meissner
2019-07-10 18:37   ` Segher Boessenkool
2019-07-11 12:17 ` [PATCH], PowerPC, Patch #8, rename rs6000_prefixed_address Michael Meissner
2019-07-11 21:37   ` Segher Boessenkool
2019-07-11 19:45 ` [PATCH], PowerPC, Patch #9, Refine calculation of whether an address offset is d-form, ds-form, or dq-form Michael Meissner
2019-07-12 17:05   ` Segher Boessenkool
2019-07-16 18:00     ` Michael Meissner
2019-07-16 23:31       ` Segher Boessenkool
2019-07-16  6:35 ` [PATCH], Patch #6, revision 3, Create pc-relative addressing insns Michael Meissner
2019-07-16 21:09   ` Segher Boessenkool
2019-07-18 19:34     ` Michael Meissner
2019-07-18 19:43       ` Segher Boessenkool
2019-07-17  5:44   ` [PATCH], Patch #6, revision 3, (Test on AIX and Darwin) Michael Meissner
2019-07-20 16:28 ` [PATCH], Patch #10, move PowerPC data structures & helper functions from rs6000.c to rs6000-internal.h Michael Meissner
2019-07-20 16:54   ` David Edelsohn
2019-07-22 18:37     ` Michael Meissner
2019-07-22 19:55       ` Segher Boessenkool
2019-07-21 18:13   ` Segher Boessenkool
2019-07-22 18:59     ` Michael Meissner
2019-07-22 20:45       ` Segher Boessenkool
2019-07-22  5:56   ` Segher Boessenkool
2019-07-22 19:33     ` Michael Meissner
2019-07-22 21:33       ` Segher Boessenkool
2019-07-22 23:11         ` Michael Meissner
2019-07-25 13:30           ` Segher Boessenkool

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=20190710171149.GD14074@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=meissner@linux.ibm.com \
    /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).