hfinkel accepted this revision.
hfinkel added a reviewer: hfinkel.
hfinkel added a comment.
This revision is now accepted and ready to land.

In http://reviews.llvm.org/D10546#202823, @ahatanak wrote:

> In http://reviews.llvm.org/D10546#202675, @hfinkel wrote:
>
> > I don't think, however, you can ever mark the inline asm call as 
> > 'readnone', because you have no way of knowing that it does not load 
> > anything. Any of its inputs could be an address, or used to construct an 
> > address, to something. The programmer might also know that the address is 
> > always dereferenceable, and thus won't produce any side effects other than 
> > its result (and, thus, not mark the statement as volatile).
>
>
> The gcc documentation has the following sentence:
>
> The "memory" clobber tells the compiler that the assembly code performs 
> memory reads or writes to items other than those listed in the input and 
> output operands (for example, accessing the memory pointed to by one of the 
> input parameters).


Okay, sounds good.

> I took it to mean that you have to add "memory" to an inline-asm statement's 
> clobber list in the case it reads from memory using one of the input 
> registers. If you don't, gcc will treat it as a read-none statement.

> 

> __asm__ ("movl (%1), %0" : "=r" (res) : "r" (ptr) : "memory");


In that case, LGTM.


http://reviews.llvm.org/D10546




_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to