International Journal of Computer Applications |
Foundation of Computer Science (FCS), NY, USA |
Volume 112 - Number 10 |
Year of Publication: 2015 |
Authors: Prathibha A. Ballal, H. Sarojadevi, Harsha P S |
10.5120/19701-0938 |
Prathibha A. Ballal, H. Sarojadevi, Harsha P S . Compiler Optimization: A Genetic Algorithm Approach. International Journal of Computer Applications. 112, 10 ( February 2015), 9-13. DOI=10.5120/19701-0938
Compiler optimization is the technique of minimizing or maximizing some features of an executable code by tuning the output of a compiler. Minimizing the execution time of the code generated is a priority in optimization; other attributes include minimizing the size of the executable code. The generation of fast executables begins at code design phase up until the compilation process is complete. Even though compilers are at the tail end of generating fast executables, the right flag used during compilation, would provide substantial performance gain. Though, compilers provide a large number of flags(GNU compiler) to control optimization, often the programmer opts for the simpler method, which is to merely choose the optimization level. The choice of optimization level automatically dictates the flags chosen by the compiler. In this paper, we access at the gain provided by using optimization levels, also we propose a genetic algorithm to determine the combination of flags, that could be used, to generate efficient executable in terms of time. The input population to the genetic algorithm is the set of compiler flags that can be used to compile a program and the best chromosome corresponding to the best combination of flags is derived over generations, based on the time taken to compile and execute, as the fitness function. The experimental analysis shows that genetic algorithm is a suitable candidate to find an optimal solution if the solution space is large, which otherwise would have been very difficult to identify, due to the large set of flags available in the GCC compiler for optimization alone. Also the best combination of flags is application dependent.