Search code examples
gcccompiler-optimizationcompiler-optionspeephole-optimization

Difference between Peephole and Peephole 2 in GCC


I am going through the machine description file for ARM target in GCC. And while looking into it i found that the peephole definition(define_peephole2) it support is peephole2 and not the peephole.

So could some please let me know the difference between peephole and peephole2?


Solution

  • The difference is when that optimization pass happens. A brief description: https://gcc.gnu.org/onlinedocs/gccint/Peephole-Definitions.html