摘要
编译器中通常采用各种优化方法来提高目标代码的质量,为了实现较好的效果,一些编译优化算法通常十分复杂,很容易给可靠性和安全性带来隐患.现有的编译器缺陷大部分是由优化阶段引起的.传统的编译优化正确性研究大部分只关注优化算法的正确性,但是只有该算法被正确的实现了才能确保实际运行的优化过程是正确的.本文提出一种基于模拟关系的方法来验证编译优化实现的正确性.在每次优化结束后,我们通过建立优化前代码和优化后代码之间的模拟关系生成优化正确应满足的逻辑条件,然后验证逻辑条件是否成立从而判定编译优化的实现是否正确性.以优化编译中的常量折叠优化和变量替换的验证作为示例显示了本方法的有效性和可靠性.
Many optimization methods are used to raise the quality of target code in the process of compiling.Because some optimization methods for compiling are too complicated,hidden dangers won′t be avoided for reliability and security of compiling.The existing defects of compiler are usually caused at the optimization phase.Mostly traditional correctness of compiling optimization only focus on correctness of optimization algorithm,but only when the algorithm is implemented correctly,the optimization process run in practice can be proved to be correct.This paper proposes a method based on simulation relation to verify correctness of compiling optimization realization.We build up simulation relation between code before optimization and code after optimization to generate logic condition that the correctness optimization should satisfy,and then we verify it if logic condition is satisfied or not to judge if compiling optimization realization is correct or not after each optimization is finished.The method is proved to be effective and reliable by verifying statement exchange and variable substitution in the process of optimization compiling.
出处
《电子学报》
EI
CAS
CSCD
北大核心
2012年第11期2171-2176,共6页
Acta Electronica Sinica
基金
国家自然科学基金重点项目(No.91118003)
国家自然科学基金面上项目(No.61170022)
关键词
编译优化
正确性
模拟关系
定理证明
compiling optimization
correctness
simulation relation
theorem proving