Request for discussion: Rewrite of inline assembler docs
Andi Kleen
andi@firstfloor.org
Fri Feb 28 04:12:00 GMT 2014
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
More information about the Gcc
mailing list