There are three main conversions that happen in the compiler:
For the generate pass, only the names of the insns matter, from either anameddefine_insn or adefine_expand. The compiler willchoose the pattern with the right name and apply the operands accordingto the documentation later in this chapter, without regard for the RTLtemplate or operand constraints. Note that the names the compiler looksfor are hard-coded in the compiler—it will ignore unnamed patterns andpatterns with names it doesn’t know about, but if you don’t provide anamed pattern it needs, it will abort.
If adefine_insn is used, the template given is inserted into theinsn list. If adefine_expand is used, one of three thingshappens, based on the condition logic. The condition logic may manuallycreate new insns for the insn list, say viaemit_insn(), andinvokeDONE. For certain named patterns, it may invokeFAIL to tell thecompiler to use an alternate way of performing that task. If it invokesneitherDONE norFAIL, the template given in the patternis inserted, as if thedefine_expand were adefine_insn.
Once the insn list is generated, various optimization passes convert,replace, and rearrange the insns in the insn list. This is where thedefine_split anddefine_peephole patterns get used, forexample.
Finally, the insn list’s RTL is matched up with the RTL templates in thedefine_insn patterns, and those patterns are used to emit thefinal assembly code. For this purpose, each nameddefine_insnacts like it’s unnamed, since the names are ignored.