On Thu, Apr 11, 2019 at 11:56:21AM -0500, William Tambe wrote: > How to enforce that GCC will not re-arrange two emit_insn() such that, > in the example below, insn2 will always follow insn1; ie: > > emit_insn (gen_insn1 ()); // emit insn1. > emit_insn (gen_insn2 ()); // emit insn2 Something like this will do the job (from rs6000): ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and ;; all of memory. This blocks insns from being moved across this point. (define_insn "blockage" [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)] "" "" [(set_attr "length" "0")]) (so you do emit_insn (gen_blockage ()) between the two other insns). Segher