高级检索

    带类型恢复的编译器源源翻译技术

    A Source-to-Source Translation Method with Type Restoration in a Compiler

    • 摘要: 源源翻译是使编译器的分析和优化可重定向的一种重要方式.它被广泛用来支持并行语言扩展或者各种体系结构无关的优化,并且可以帮助程序员进行正确性或者性能的调试.在多核/众核时代,程序分析和优化倾向于让用户更多地参与,这种平台无关而且用户友好的代码生成方式也越来越受到欢迎.在简单的编译器中添加源源翻译的支持很容易,但在实现了复杂的程序分析和激进的优化的编译器中,却很少有编译器提供健壮的源源翻译支持.优化对程序结构的改变是造成翻译困难的首要原因.结合大量出错实例对优化给源源翻译带来的困难进行分析,提出了一套基于类型恢复的翻译技术,并在Open64编译器中实现了这种方法.通过supertest和spec2000测试集的测试,验证了这种方法对源源翻译的健壮性有很大改善.该方法的实现模块集成在源源翻译器内,与编译器各种分析优化模块独立,所以该方法容易移植到其他编译器中.

       

      Abstract: Source-to-source translation is an important way to make analysis and optimization in a compiler retargetable. It is widely used to support various parallel programming language extensions and platform independent optimizations, and it can help programmers to validate the program correctness and to tune the performance. In the multi-core and many-core times, users are more eagerly demanded to get involved in program analysis and optimization. Source-to-source code generation, which is platform independent and user friendly, is increasingly welcomed. Source-to-source is easy to implement in a simple compiler, but difficult to implement in a compiler with complex program analysis and aggressive optimizations. Therefore few production quality compilers provided robust source-to-source translation. It is found that transformation produced by optimization is the leading cause of the difficulty. The problems are analyzed in the source-to-source translation based on a lot of error cases, and a translation technique with type restoration is provided to solve the problem. Then the authors implement the technique in the Open64 compiler, evaluate it via supertest and spec2000 benchmarks and prove that it greatly improves the robustness of the source-to-source translation. The method in the paper is integrated in the source-to-source translator module and separated from various optimizations, so it is easy to be used in other compilers.

       

    /

    返回文章
    返回