Font Size: a A A

Implementation And Optimization Of LLVM Global Instruction Selection For Sunway Platform

Posted on:2022-08-07Degree:MasterType:Thesis
Country:ChinaCandidate:Z F HuangFull Text:PDF
GTID:2518306326952489Subject:Software engineering
Abstract/Summary:PDF Full Text Request
Instruction selection converts the intermediate representation of the compiler into a series of target platform machine instructions optimized for various compilation goals.It is an important part of the classic compiler back-end to effectively improve the execution performance of scientific computing programs.High-quality instruction selection pairs generate The size and quality of the code have a big impact.In 2019,the LLVM Global Developers Conference set global instruction selection as the theme of the conference.In the past two years,global instruction selection has become a research hotspot in the mainstream back-end architecture of LLVM.The realization and optimization of the LLVM global instruction selection technology on the Sunway platform is of great significance to further improving the Sunway compiler system.The main work and innovations of this thesis are as follows:(1)Realize the LLVM global instruction selection technology for Sunway platform.Currently,Sunway LLVM can support two instruction selection technologies: fast instruction selection and DAG-based instruction selection,but it faces problems such as low instruction selection compilation efficiency,small optimization granularity,and poor module reusability.The global instruction selection has the advantages of the above two instruction selections.The entire function is downgraded in the form of SSA graph coverage.Combined with the structural characteristics of the Sunway processor,the LLVM-IR downgrade,legalization,and legalization for the Sunway platform is designed and implemented.The LLVM global instruction selection technology of register bank selection and instruction selection effectively solves the current problems of Sunway LLVM in the instruction selection process.(2)Realize the optimization of LLVM global instruction selection for Sunway platform.First,a cost model-based instruction combine optimization method is proposed,which guides global instruction combining through an extended precise instruction cost benefit analysis model to realize the effective profit analysis of radical instruction combining;secondly,it implements an optimization based on global register bank selection Method,by analyzing the cost of allocating the register bank of the machine instruction in the function,minimize the cost of transferring data across the register bank of the machine instruction;finally,a global-based instruction locality optimization method is implemented,and the constant or constant is reduced through the instruction locality optimization algorithm.The active interval of certain variables is used to deal with the register overflow problem in the register allocation stage in advance.Through the test of SPEC CPU2006,the experimental results show that compared with the current two instruction selection technologies,the LLC compilation efficiency is increased by an average of 20%,and the entire compilation cycle is increased by an average of 6%-8%..Compared with the optimization work based on LLVM global instruction selection,the average speedup is 1.08 and the maximum speedup is 1.36.
Keywords/Search Tags:LLVM, Global instruction selection, Instruction combine, Register bank selection, Instruction locality optimization
PDF Full Text Request
Related items