引用本文:高秉玉,姚梦雨,王子铭,李锭,陈向群,郭耀.GCC编译优化选项关系的分析应用.软件学报,,():1-22
【打印本页】   【下载PDF全文】   查看/发表评论  【EndNote】   【RefMan】   【BibTex】
←前一篇|后一篇→ 过刊浏览    高级检索
本文已被:浏览 350次   下载 135 本文二维码信息
码上扫一扫!
分享到: 微信 更多
GCC编译优化选项关系的分析应用
高秉玉1,2, 姚梦雨1,2, 王子铭1,2, 李锭1,2, 陈向群1,2, 郭耀1,2
1.高可信软件技术教育部重点实验室 (北京大学), 北京 100871;2.北京大学 计算机学院 软件研究所, 北京 100871
摘要:
编译优化选项作为编译器与开发者之间的核心交互接口, 其合理配置直接影响软件质量与开发效率. 然而, 编译选项的数量庞大且关系复杂, 优化效果同时受到程序特征和机器架构的动态影响, 官方文档难以满足实际应用场景的配置指导需求. 针对上述挑战, 结合静态和动态分析技术, 基于GCC编译器源码深入探讨影响编译器选项效果的两类关系: 内部约束关系和外部环境依赖关系. 首先基于静态分析识别出选项间68对内部约束关系(涉及84个选项)以及103对外部环境依赖关系(包括51个机器架构敏感选项与52个程序特征敏感选项), 并进一步基于动态分析技术验证选项在不同外部环境下的有效性. 然后, 将选项关系的分析结果应用于3个编译相关技术场景: 1)提高选项自动调优效率, 设计基于选项关系感知的遗传调优算法, 相较于不考虑选项关系的其他算法(如遗传算法), 性能平均提升3.65%; 2)提高编译器测试效率, 设计基于选项关系的测试序列生成方法, 生成效率相较于随机方法提升了51.7%; 3)为开发者提供更有效的选项配置方案, 帮助其合理使用选项以达到预期优化目标. 通过这3个应用, 表明编译选项关系在自动调优、编译器测试及实际配置中具有关键作用.
关键词:  编译优化  编译选项  编译自动调优  编译器测试
DOI:10.13328/j.cnki.jos.007644
分类号:TP314
基金项目:国家重点研发计划(2022YFB4501802); 北京市自然科学基金-小米创新联合基金(L243010); 酱酒行业数字化转型联合实验室
Analysis and Application of Relationships Among GCC Compiler Optimization Options
GAO Bing-Yu1,2, YAO Meng-Yu1,2, WANG Zi -Ming1,2, LI Ding1,2, CHEN Xiang-Qun1,2, GUO Yao1,2
1.Key Laboratory of High Confidence Software Technologies (Peking University), Ministry of Education, Beijing 100871, China;2.Software Engineering Institute, School of Computer Science, Peking University, Beijing 100871, China
Abstract:
Compiler optimization options serve as a core interface between the compiler and developers, and their proper configuration directly impacts software quality and development efficiency. However, there are a large number of options with complex interrelations, and their optimization effects are dynamically influenced by program features and target machines. The official documentation is also insufficient to provide the configuration guidance needed for practical application scenarios. To address these challenges, this study combines static and dynamic analysis techniques applied to the GCC source code and investigates two types of relationships that affect the effectiveness of compiler options: internal constraint relationships and external environment dependencies. First, 68 pairs of internal constraint relationships (involving 84 options) and 103 pairs of external environment dependencies (including 51 architecture-sensitive options and 52 program feature-sensitive options) are identified through static analysis, and the effectiveness of these options in different external environments is further validated through dynamic analysis. Finally, the analysis results of option relationships are applied to three compiler-related scenarios: 1) improving the effectiveness of compiler auto-tuning by designing a relationship-aware genetic auto-tuning algorithm, which achieves an average performance improvement of 3.65% compared with algorithms that do not consider option relationships, such as the genetic algorithm; 2) improving the effectiveness of compiler testing by proposing a option sequence test case generation method based on option relationships, achieving a 51.7% increase in generation efficiency compared to random methods; 3) providing developers with more effective option configuration schemes to help them use options properly to achieve their desired optimization goals. These three applications demonstrate the key role of compiler option relationships in compiler auto-tuning, compiler testing, and practical configuration.
Key words:  compiler optimization  compiler option  compiler auto-tuning  compiler testing