This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Request for discussion: Rewrite of inline assembler docs
- From: Andrew Haley <aph at redhat dot com>
- To: Hannes Frederic Sowa <hannes at stressinduktion dot org>
- Cc: dw <limegreensocks at yahoo dot com>, gcc at gcc dot gnu dot org, rdsandiford at googlemail dot com
- Date: Fri, 28 Mar 2014 13:15:39 +0000
- Subject: Re: Request for discussion: Rewrite of inline assembler docs
- Authentication-results: sourceware.org; auth=none
- References: <532FE0CB dot 6040109 at yahoo dot com> <87ior2ed7s dot fsf at sandifor-thinkpad dot stglab dot manchester dot uk dot ibm dot com> <5332823B dot 10805 at yahoo dot com> <87d2h94cr8 dot fsf at talisman dot default> <5333A135 dot 4060007 at yahoo dot com> <87y4zw138j dot fsf at talisman dot default> <533514C7 dot 3040402 at yahoo dot com> <53353C73 dot 8050708 at redhat dot com> <20140328093031 dot GG29498 at order dot stressinduktion dot org> <533543D5 dot 2000401 at redhat dot com> <20140328104615 dot GH29498 at order dot stressinduktion dot org>
On 03/28/2014 10:46 AM, Hannes Frederic Sowa wrote:
> On Fri, Mar 28, 2014 at 09:41:41AM +0000, Andrew Haley wrote:
>> On 03/28/2014 09:30 AM, Hannes Frederic Sowa wrote:
>>> On Fri, Mar 28, 2014 at 09:10:11AM +0000, Andrew Haley wrote:
>>>> On 03/28/2014 06:20 AM, dw wrote:
>>>>> Using this clobber causes the compiler to flush all (modified) registers
>>>>> being used to store memory-based values to memory before executing the
>>>>> @code{asm} statement.
>>>>
>>>> I don't know what a "memory-based" value is. This phrase doesn't help
>>>> at all. In addition, it isn't true. Modified registers are not
>>>> flushed to memory unless they are clobbered or their address is taken.
>>>> This sentence should be deleted.
>>>
>>> i and sum form your example are not allocated in memory. If you make
>>> one of them static you should be able to see the effect.
>>
>> I know. That's not the point. "memory-based" is not a well-defined
>> term. In order to write clear documentation it is necessary either to
>> define terms or to use terms that are already well-defined.
>
> Ok, I see the problem. Maybe something like this by avoiding the term?
>
> Using this clobber causes the compiler to flush all (modified) registers
> being used to store values which gcc decided to originally allocate in
> memory before executing the @code{asm} statement.
Not really, no: that's not true.
>> What is true here is that all registers used to cache variables that
>> are reachable from pointers in the program are flushed. Anything that
>> is statically allocated is reachable, as is anything dynamically
>> allocated by malloc; auto variables are not reachable unless their
>> address is taken.
>
> One would have to go into detail of various optimizations which could
> remove the address taking
One would not: any such optimization would be incorrect. Any memory
reachable from an inline asm statement with a memory clobber must
be flushed to memory.
> e.g. IMHO the last sentence of the paragraph already
> deals with this.
Which last sentence of what paragraph?
Andrew.