public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@nildram.co.uk>
To: "Andreas Krebbel" <Andreas.Krebbel@de.ibm.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PING] Target hook for rewriting inline asm constraints
Date: Mon, 05 Nov 2007 09:43:00 -0000	[thread overview]
Message-ID: <87ve8hxc1j.fsf@firetop.home> (raw)
In-Reply-To: <20071105092430.GA7464@homer.boeblingen.de.ibm.com> (Andreas 	Krebbel's message of "Mon\, 5 Nov 2007 10\:24\:31 +0100")

"Andreas Krebbel" <Andreas.Krebbel@de.ibm.com> writes:
>> Sorry if this has already been suggested, but why not just replace
>> hard-coded uses of 'm' in constraint-handling code with uses of some
>> target macro?  You could then treat your current 'm' as an ordinary
>> define_memory_constraint.
>
> I'm not sure this would work.  I think reload relies on the
> relationship between the 'm' constraint and GO_IF_LEGITIMATE_ADDRESS.
> There is an early loop invoking find_reloads_address.  This reloads
> all addresses which aren't supported by the target at all i.e. all
> addresses for which GO_IF_LEGITIMATE_ADDRESS is false (or does not
> jump to the given label).  If reload later on sees an 'm' constraint
> it considers the address already been fixed by that early loop.  So I
> would expect that in order to make such a hook work I would have to
> mess around with the reload logic which is not preferable I think.

I don't understand.  What I'm saying is that we should look through
gcc/*.c for cases where the C construct "'m'" refers to "the constraint
associated with legitimate addresses", and replace those cases with some
target macro that is 'm' by default.  E.g.:

	      case 'm':
		if (force_reload)
		  break;
		if (MEM_P (operand)
		    || (REG_P (operand)
			&& REGNO (operand) >= FIRST_PSEUDO_REGISTER
			&& reg_renumber[REGNO (operand)] < 0))
		  win = 1;
		if (CONST_POOL_OK_P (operand))
		  badop = 0;
		constmemok = 1;
		break;

would become:

	      case TARGET_MEM_CONSTRAINT:
		if (force_reload)
		  break;
		if (MEM_P (operand)
		    || (REG_P (operand)
			&& REGNO (operand) >= FIRST_PSEUDO_REGISTER
			&& reg_renumber[REGNO (operand)] < 0))
		  win = 1;
		if (CONST_POOL_OK_P (operand))
		  badop = 0;
		constmemok = 1;
		break;

and other places would change similarly.  If we do that consistently,
there would no longer be a connection between 'm' and
GO_IF_LEGITIMATE_ADDRESS.

Replacing hard-coded constants seems like good practice for its own
sake and would avoid the need for the front end to rewrite asms.

Richard

  reply	other threads:[~2007-11-05  9:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30 12:54 Andreas Krebbel
2007-10-31 16:31 ` Tom Tromey
2007-10-31 16:43   ` Richard Guenther
2007-10-31 18:55     ` Andreas Krebbel
2007-10-31 19:13       ` Richard Guenther
2007-10-31 20:40         ` Andreas Krebbel
2007-11-04 23:05           ` Richard Sandiford
2007-11-05  9:25             ` Andreas Krebbel
2007-11-05  9:43               ` Richard Sandiford [this message]
2007-11-05 10:32                 ` Andreas Krebbel
2007-11-05 11:02                   ` Richard Sandiford
2007-11-05 13:42                     ` Andreas Krebbel
2007-11-06 22:00                       ` Richard Sandiford
2007-11-07 11:55                         ` Andreas Krebbel
2007-10-31 17:22   ` Andreas Krebbel
2007-10-31 17:56     ` Tom Tromey
2007-11-06 18:20 ` Michael Meissner
2007-11-07  9:10   ` Andreas Krebbel

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=87ve8hxc1j.fsf@firetop.home \
    --to=rsandifo@nildram.co.uk \
    --cc=Andreas.Krebbel@de.ibm.com \
    --cc=gcc-patches@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: 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).