Re: Is clobber "memory" in include/asm-i386/system.h necessary?

Ingo Molnar (mingo@kaliban.csoma.elte.hu)
Thu, 2 May 1996 16:16:36 -0400 (EDT)


On Wed, 1 May 1996, Tom May wrote:

> In include/asm-i386/system.h there are numerous uses of __asm__ which
> clobber "memory". For reference, here they are:
>
> #define mb() __asm__ __volatile__ ("" : : :"memory")
> #define sti() __asm__ __volatile__ ("sti": : :"memory")
> #define cli() __asm__ __volatile__ ("cli": : :"memory")

> This clobber seems unnecessary since none of these instructions modify
> memory that gcc doesn't know about, and any memory that is modified by
> other means (hardware, interrupt handlers, etc.) is (should be?)
> accounted for in other ways such as by using volatile.

the "memory" option saves all register variables to memory .. so you will
have definit memory contents at that point. And i think it "atomizes" code
encosed in such "memory" options, no code will be optimized across this
boundary? ... not sure though ...