Nick Maclaren <nmm1@xxxxxxxxxxxxx> writes: > What I need to do is to insert the following: > > extern void *__limit; > extern void __failure (void); > if (%SP < __limit) __failure(); This is similar to what probe_stack_range in explow.c does, so that a look at that function. It's obviously easier to answer more detailed questions. The general flow of RTL is: * Define insn FOO in .md file * Generate it using emit_insn (gen_FOO (operands)). * Use standard names for, e.g., addition insns so that gcc knows which ones to use when generating code. There are literally thousands of example of RTL generation in the gcc code base. Ian