Peephole Optimization Strategies for Intermediate Code in the Compilation Process
Yuheng Guan, Jing Yun, Pengfei Sun, Xiaoming Su · Advances in transdisciplinary engineering · 2025
In the design of modern compilers, the generation and optimization of intermediate code play a crucial role. Serving as a bridge between source code and target machine code, intermediate code provides ample opportunities for optimization. This paper focuses on porthole optimization techniques, proposing a new optimization strategy aimed at reducing unnecessary computations and memory accesses by analyzing control and data flows within intermediate code, thereby enhancing program execution efficiency. We first outline the various stages of the compilation process, followed by a detailed exploration of the basic principles and implementation methods of porthole optimization. Finally, we validate the effectiveness and advantages of this optimization strategy through experiments. The experimental results indicate significant improvements in the execution performance of intermediate code after the adoption of porthole optimization, providing new insights and directions for compiler optimization.