Data-Flow Analysis and Optimisation
摘要
Most compilers perform some optimisations on the code that is generated by the main phases of the compiler. These optimisations often follow a common recipe: First, the code is analysed to find opportunities for applying a specific optimisation, and then the optimisation is applied in the instances that are found. The analysis that collects the information is called a data-flow analysis. As the name indicates, a data-flow analysis analyses flow of information through a program. This information can be an approximation of values calculated during execution, but it can also be information about where values are stored, if values are going to be used later during execution, information about whether a piece of code is ever going to be executed, or any kind of information that can be useful for optimisation.