A compiler converts a human readable high level program into a corresponding machine language program. This invention improves data-flow analysis. A compiler implementing data-flow analysis typically relies on an iterative algorithm for data-flow analysis. According to the prior art determination of the exact number of loop iterations required for convergence was believed impractical. The prior art selected a maximum number of data-flow analysis iterations relatively arbitrarily. This invention calculates the number of iterations for convergence using backedges in a control flow graph of the source program. This permits the data-flow analysis to be run for exactly the number of iterations needed for convergence. In the event of convergence, an extra, useless iteration is avoided. In the event of non-convergence, valid data can be separated from invalid data, whereas all data was previously discarded.
展开▼