陳金娥 黃勝兵
摘 要:Open64是一個擁有GNU通用公共許可證的開源高性能編譯器,設計結構好,分析優化全面,是編譯器高級研究的理想平臺。本文針對BWDSP處理器所提供的高效特殊運算指令,在Open64基礎上研究并實現了面向BWDSP中的特殊指令合成策略。該策略通過擴展并重定向編譯器后端模塊,能夠充分地利用BWDSP中的復數指令、累加指令、乘累加指令和平方和指令等特殊指令。實驗結果表明,本文提出的特殊指令合成策略能夠很大程度上提高程序的性能。
關鍵詞:Open64編譯器;特殊指令合成;超長指令字
中圖分類號:TP311.54 文獻標識碼:A
Abstract:As an open-source high-performance compiler with GNU General Public License (GPL),Open64 is a good compiler for advanced research.Aiming at the special instructions provided by BWDSP,the paper researches and implements the special instruction synthesis strategy based on Open64.Extending and redirecting the compiler back-end,the strategy fully utilizes the special instructions of BWDSP,including complex,accumulation,multiply accumulation and sum-of-squares operations.The experimental results show that the program performance can be greatly improved with this special instruction synthesis strategy proposed in this paper.
Keywords:Open64 compiler;special instruction synthesis;Very Long Instruction Word (VLIW)
1 引言(Introduction)
BWDSP是一款采用分簇架構、支持SIMD的16發射的VLIW數字信號處理器。根據其面向的計算領域提供了大量的特殊指令[1,2],包括復數指令、累加指令、乘累加指令和平方和指令等。
本文以Open64作為面向BWDSP體系結構的編譯器研究框架。Open64是一個運行在Linux下的C、C++、Fortran編譯器基礎設施[3],其前端將源程序轉化為中間表示WHIRL,后端讀入中間語言WHIRL,經過翻譯生成CG階段(Code Generation)的中間表示(CGIR),再經過一系列優化,最終CGIR經過代碼輸出生成匯編程序[4]。Open64編譯器的架構如圖1所示。
本文主要解決如何將高級程序語言代碼通過編譯器直接生成BWDSP指令系統中的特殊指令,并在Open64編譯基礎設施上提出并實現了面向BWDSP體系結構的特殊指令合成策略,能夠較好地利用BWDSP的特殊指令來提高應用程序的性能。
2 特殊指令合成策略(Special instruction synthesis strategy)
2.1 復數指令合成
原Open64編譯基礎設施內部提供了浮點復數類型,因此編譯器前端能夠直接處理浮點復數類型源代碼。……