Yes it would. But some instructions following these semantics also have output operands, and this not supported afaik. On Sat, Aug 31, 2013 at 4:16 AM, Rob <robpilling@xxxxxxxxx> wrote: > On Fri, Aug 30, 2013 at 10:41:47AM -0700, Hendrik Greving wrote: >> Following problem: Below, the instruction >> my_insn_can_jump_to_coolLabel is an instruction that can raise a >> fault, that is subsequently handled by a higher OS like code, that >> then will always jump to B3. I believe similar stuff exists in the >> Linux kernel. What happens is that some code from B3 gets hoisted to >> B1' (some base address from a complex address in B3, I suspect CSE). >> The base address is then missing in case we 'jump' to B3 if an >> exception had been raised. >> > ... >> >> Is there anything like instruction barriers I can somehow support at >> codeLabel maybe? How does the Linux kernel do this (if so)? > > Will asm goto() help here? gcc assumes asm statements don't affect > program flow when it reorders basic blocks. You should use asm goto() > with a list of labels at the end if your asm statement will jump around. > > Or alternatively you could give gcc -fno-reorder-blocks to stop it > shifting code around. > > Thanks, > Rob