Local variables reordering and 'asm volatile("" ::: "memory");'

Segher Boessenkool segher@kernel.crashing.org
Mon Sep 9 04:51:00 GMT 2019


On Mon, Sep 09, 2019 at 07:23:01AM +0300, Alexander Monakov wrote:
> On Sun, 8 Sep 2019, Ayrat Gaskarov wrote:
> > But it would be a real pain to add asm volatile for every possible
> > variable and computations that were previously (and after) done (may
> > be even from callers up a stacktrace). Could we somehow avoid this?
> 
> You can move the code-that-shall-not-be-disturbed in a separate function
> and limit visibility of interprocedural analysis into that function,
> for example by compiling it in a separate file without LTO,
> or calling it via a pointer received from an asm, e.g.:

Or just declaring it with  __attribute__((noipa))  :-)


Segher



More information about the Gcc-help mailing list