public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Richard Guenther <richard.guenther@gmail.com>
Cc: Mikael Pettersson <mikpe@it.uu.se>,
	Michael Walle <michael@walle.cc>,
	       Georg-Johann Lay <avr@gjlay.de>,
	Hans-Peter Nilsson <hp@bitrange.com>,
	       Richard Henderson <rth@redhat.com>,
	gcc@gcc.gnu.org
Subject: Re: libgcc: strange optimization
Date: Tue, 02 Aug 2011 14:35:00 -0000	[thread overview]
Message-ID: <mcr4o1z285x.fsf@coign.corp.google.com> (raw)
In-Reply-To: <CAFiYyc1T-nfj_YjMcOZ=65Ncf6tF6sShxa6zo5UpKjfNo2AWkw@mail.gmail.com>	(Richard Guenther's message of "Tue, 2 Aug 2011 15:42:12 +0200")

Richard Guenther <richard.guenther@gmail.com> writes:

> On Tue, Aug 2, 2011 at 3:23 PM, Ian Lance Taylor <iant@google.com> wrote:
>> Richard Guenther <richard.guenther@gmail.com> writes:
>>
>>> Or go one step further and deprecate local register variables alltogether
>>> (they IMHO don't make much sense, and rather the targets should provide
>>> a way to properly constrain asm inputs and outputs).
>>
>> No, local register variables are documented as working and many programs
>> rely on them.  They are a straightforward way to get an asm argument in
>> a specific register, and I don't see any reason to break that.
>
> Well, maybe they look like so.  But in reality there is _no_ connection
> from the register setup to the actual asm.  Which is the problem the
> compiler faces here (apart from the libcall issue).  If there should be
> an implicit dependence of all asms to all local register var setters
> and users then this isn't implemented on gimple (or rather it works
> by chance there as we treat register vars as memory and do not
> disambiguate anything across asms (yet)).

I'm not sure why we need to do anything at the GIMPLE level other than
disable some optimizations.  There is a connection from the register
variable to the asm--the asm refers to the variable.  There is nothing
specific about the register in there, but at the GIMPLE level there
doesn't have to be.

We should not break a useful existing feature because we find it
inconvenient.  Let's just disable some optimizations so that it
continues to work.


>>> I suggest to amend the documentation for local call-clobbered register
>>> variables to say that the only valid sequence using them is from a
>>> non-inlinable function that contains only direct initializations of the
>>> register variables from constants or parameters.
>>
>> Let's just implement those requirements in the compiler itself.
>
> Doesn't work for existing code, no?

Why not?


> And if thinking new code then
> I'd rather have explicit dependences (and a way to represent them).
> Thus, for example
>
> asm ("scall" : : "asm("r0")" (10), ...)
>
> thus, why force new constraints when we already can figure out
> local register vars by register name?  Why not extend the constraint
> syntax somehow to allow specifying the same effect?

I agree that it would be a good idea to permit asms to indicate the
specific register the operand should go into.

Ian

  reply	other threads:[~2011-08-02 14:35 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01 20:30 Michael Walle
2011-08-01 20:51 ` Georg-Johann Lay
2011-08-01 21:14   ` Michael Walle
2011-08-02  6:47     ` Georg-Johann Lay
2011-08-02  6:29   ` Hans-Peter Nilsson
2011-08-01 21:30 ` Richard Henderson
2011-08-02  6:37   ` Hans-Peter Nilsson
2011-08-02  8:49     ` Mikael Pettersson
2011-08-02  9:47       ` Richard Guenther
2011-08-02 10:02         ` Georg-Johann Lay
2011-08-02 10:11           ` Richard Guenther
2011-08-02 10:55             ` Michael Walle
2011-08-02 12:06               ` Mikael Pettersson
2011-08-02 12:23                 ` Richard Guenther
2011-08-02 12:36                   ` Georg-Johann Lay
2011-08-02 12:54                   ` Hans-Peter Nilsson
2011-08-02 13:09                     ` Richard Guenther
2011-08-02 13:16                       ` Hans-Peter Nilsson
2011-08-03  4:59                       ` Miles Bader
2011-08-02 13:23                   ` Ian Lance Taylor
2011-08-02 13:42                     ` Richard Guenther
2011-08-02 14:35                       ` Ian Lance Taylor [this message]
2011-08-03  9:12                       ` Ulrich Weigand
2011-08-03  9:51                         ` Georg-Johann Lay
2011-08-03 10:04                           ` Richard Guenther
2011-08-03 13:27                             ` Michael Matz
2011-08-03 14:02                               ` Richard Guenther
2011-08-03 14:55                                 ` Georg-Johann Lay
2011-08-03 15:05                                 ` Richard Henderson
2011-08-04  0:20                         ` Hans-Peter Nilsson
2011-08-04  7:29                           ` Andreas Schwab
2011-08-04 13:04                             ` Hans-Peter Nilsson
2011-08-04  9:51                           ` Andrew Haley
2011-08-04  9:52                             ` Richard Guenther
2011-08-04 11:11                               ` Andrew Haley
2011-08-04 11:20                                 ` Richard Guenther
2011-08-04 14:46                                   ` Andrew Haley
2011-08-06 15:00                                 ` Paolo Bonzini
2011-08-08  8:06                                   ` Richard Guenther
2011-08-08 10:59                                     ` Paolo Bonzini
2011-08-02 16:03                   ` Richard Henderson
2011-08-02 20:10                     ` Richard Guenther
2011-08-02 17:21                   ` Georg-Johann Lay
2011-08-09 16:55                   ` Richard Earnshaw
2011-08-09 17:24                     ` Ulrich Weigand
2011-08-09 19:48                       ` Hans-Peter Nilsson
2011-08-10  0:40                     ` Hans-Peter Nilsson

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=mcr4o1z285x.fsf@coign.corp.google.com \
    --to=iant@google.com \
    --cc=avr@gjlay.de \
    --cc=gcc@gcc.gnu.org \
    --cc=hp@bitrange.com \
    --cc=michael@walle.cc \
    --cc=mikpe@it.uu.se \
    --cc=richard.guenther@gmail.com \
    --cc=rth@redhat.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).