16.18 Machine-Specific Peephole Optimizers
The combiner does not notice certain peephole optimizations when the data flow in the program does not suggest that it should try them. For example, sometimes two consecutive insns related in purpose can be combined even though the second one does not appear to use a register computed in the first one. A machine-specific peephole optimizer can detect such opportunities.
There are two forms of peephole definitions that may be used. The
define_peephole is run at assembly output time to
match insns and substitute assembly text. Use of
define_peephole2 matches insns and substitutes new
peephole2 pass is run after register allocation
but before scheduling, which may result in much better code for
targets that do scheduling.