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: Andi Kleen <andi at firstfloor dot org>
- To: dw <limegreensocks at yahoo dot com>
- Cc: Andrew Haley <aph at redhat dot com>, "gcc\ at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 27 Feb 2014 20:12:34 -0800
- Subject: Re: Request for discussion: Rewrite of inline assembler docs
- Authentication-results: sourceware.org; auth=none
- References: <530F1C69 dot 5050305 at redhat dot com> <8761o0jw5m dot fsf at tassilo dot jf dot intel dot com> <530FE7A1 dot 7090003 at yahoo dot com>
dw <limegreensocks@yahoo.com> writes:
>
> What would you say to something like this:
>
> "Since GCC does not parse the asm, it has no visibility of any static
> variables or functions it references. This may result in those
> symbols getting discarded by GCC as unused. To avoid this problem,
> list the symbols as inputs or outputs."
output makes no sense I think, only input.
You still need the part about the top-level asm, where input
doesn't work.
>
>> And another common problem:
>>
>> For top level asm there is no guarantee the compiler outputs the
>> statements in order.
>
> Well, basic asm (which is the only thing you can use at top level)
> already says:
>
> "Do not expect a sequence of |asm| statements to remain perfectly
> consecutive after compilation. To ensure that assembler instructions
> maintain their order, use a single |asm| statement containing multiple
> instructions. Note that GCC's optimizer can move |asm| statements
> relative to other code, including across jumps. "
>
> Is something more needed?
Yes it should be made clear that this applies to top-level asm
too.
-Andi
--
ak@linux.intel.com -- Speaking for myself only