Optimizing code size at constant execution time with function-level phase ordering in GCC
Автор: Lebedev G.K., Efanov N.N., Chernysh M.V.
Журнал: Труды Московского физико-технического института @trudy-mipt
Рубрика: Информатика и управление
Статья в выпуске: 1 (65) т.17, 2025 года.
Бесплатный доступ
Due to the increasing prevalence of embedded systems that have limited memory resources, there is a need for reducing the size of code while maintaining execution time. This issue has not been widely explored in the literature. The GCC compiler remains a popular tool for compiling software for embedded devices. However, research on optimization phase ordering within GCC has stagnated since the release of the Milepost GCC abd current research on GCC auto-tuning focuses solely on flag settings. In this paper, we explore the phase ordering space in GCC for code size reduction at constant execution time. Previous studies have focused on optimizing entire programs, whereas our approach focuses on finegrained tuning at the function level. We propose a framework for investigating optimization sequences in GCC, using code size constrained by constant execution time as the objective function. Additionally, we introduce the concept of a function optimization cache, a mapping of functions to optimization sequences that can be used to augment an optimizing compiler. Through experiments, we obtain the probability that a randomly selected sequence of optimizations exceeds the standard GCC 02 sequence, as well as the distribution of these probabilities and their dependence on the function being optimized. Finally, we propose further research directions: exploring collaborative interaction between optimization passes, guided search space exploration, and adaptive compilation strategies.
Gcc
Короткий адрес: https://sciup.org/142245206
IDR: 142245206