Treffer: 基于源代码迁移的编译器优化方法研究.
Weitere Informationen
Compiler optimization aims to enhance the efficiency of code execution on target platforms by applying a series of transformations to the intermediate representation (IR) language. Traditional methods typically rely on machine learning to analyze IR features and predict the optimal combination of LLVM compiler optimization passes. However, these methods are limited by their reliance on existing compiler optimization strategies and insufficient use of global information, which limits their scalability. This study adopts deep learning to automatically translate function-level IR from an unoptimized state to the O2 optimization level, treating this optimization process as a translation task. By integrating a dense data flow graph (DDFG), this method is able to extract the global structural information from the IR code, thereby guiding the model to learn code semantics more comprehensively. Experiments using the Transformer model demonstrate that this method can effectively train IR at the O2 level, and 86.15% of the function-level optimized code can execute correctly on the compiler while ensuring semantic integrity. [ABSTRACT FROM AUTHOR]
编译器优化旨在通过在中间代码IR语言上进行一系列变换,提高代码在目标平台上的运行 效率。传统方法通常依赖机器学习来分析IR特征,并预测LLVM 编译器优化通道的最佳组合。然而,这 些方法因受限于编译器现有优化策略和对全局信息的有限利用,其扩展性受限。采用深度学习自动将函 数级IR从未优化状态转换至O2级别优化,并将此优化过程视为翻译任务。通过引入密集数据流图 DDFG,能够提取IR代码的全局结构信息,从而引导模型更全面地学习代码语义。使用Transformer模 型进行的实验表明,所提方法的模型能在O2级别有效训练IR,且86.15%的函数级优化代码能在保证语 义完整性的同时,在编译器上正确执行。 [ABSTRACT FROM AUTHOR]