gccint: Overview

1 
1 17.1 Overview of How the Machine Description is Used
1 ====================================================
1 
1 There are three main conversions that happen in the compiler:
1 
1   1. The front end reads the source code and builds a parse tree.
1 
1   2. The parse tree is used to generate an RTL insn list based on named
1      instruction patterns.
1 
1   3. The insn list is matched against the RTL templates to produce
1      assembler code.
1 
1  For the generate pass, only the names of the insns matter, from either
1 a named 'define_insn' or a 'define_expand'.  The compiler will choose
1 the pattern with the right name and apply the operands according to the
1 documentation later in this chapter, without regard for the RTL template
1 or operand constraints.  Note that the names the compiler looks for are
1 hard-coded in the compiler--it will ignore unnamed patterns and patterns
1 with names it doesn't know about, but if you don't provide a named
1 pattern it needs, it will abort.
1 
1  If a 'define_insn' is used, the template given is inserted into the
1 insn list.  If a 'define_expand' is used, one of three things happens,
1 based on the condition logic.  The condition logic may manually create
1 new insns for the insn list, say via 'emit_insn()', and invoke 'DONE'.
1 For certain named patterns, it may invoke 'FAIL' to tell the compiler to
1 use an alternate way of performing that task.  If it invokes neither
1 'DONE' nor 'FAIL', the template given in the pattern is inserted, as if
1 the 'define_expand' were a 'define_insn'.
1 
1  Once the insn list is generated, various optimization passes convert,
1 replace, and rearrange the insns in the insn list.  This is where the
1 'define_split' and 'define_peephole' patterns get used, for example.
1 
1  Finally, the insn list's RTL is matched up with the RTL templates in
1 the 'define_insn' patterns, and those patterns are used to emit the
1 final assembly code.  For this purpose, each named 'define_insn' acts
1 like it's unnamed, since the names are ignored.
1