11.10.1 Unnecessary Loads

11.10.2 Branch (to a) (around a) Branch

11.10.3 Cross Jumping

11.10.4 Recognizing Special Instruction or Modes

11.10 Peephole Optimization

Peephole optimization is actually a family of optimizations that looks at a small number of outlines of output code, looking for a pattern. It is so easy to do many of these that it is not unreasonable to put out poor code initially. It simplifies the code generation phase. Compiler designers look at the code produced when a compiler is up and running. This is called profiling. As they find new patterns actually produced, they keep adding optimization routines.