90 likes | 219 Views
Fast Copy Coalescing and Live-Range Identification. by Ken Kennedy Zoran Budimlic Keith D. Cooper Timothy J. Harvey Timothy S. Oberg Steven W. Reeves Dept. of Computer Science, Rice University. The paper does the following things:.
E N D
Fast Copy Coalescing and Live-Range Identification by Ken Kennedy Zoran Budimlic Keith D. Cooper Timothy J. Harvey Timothy S. Oberg Steven W. Reeves Dept. of Computer Science, Rice University
The paper does the following things: • Find the interference relationship in a program efficiently without using an interference graph. • Minimize the copy insertions needed for phi node instantiations. • Perform copy folding efficiently. • Compare the usage of memory needed for compiling. • Compare the optimizing time.
Which choice is it anway ... • Copy folding with SSA can eliminate all copies in a program. However copies are needed to instantiate phi functions. • How about coalescing SSA names using an interference graph?This normally requires a data structure that is quadratic in the number of names and might not be good for JIT compilation. The paper suggests an algorithm that achieves the greens and reduces the effects of the reds as much as possible.
Previous Work (Chaitin/Briggs) It takes a pessimistic approach. This approach assumes that all copies are necessary and then creates an interference graph to fold certain copies. This Paper It takes a more optimistic approach. It assumes that no copies are needed unless proven elsewise by the interference relationship.
Basic idea behind the algorithm: • Find the union of the phi node parameters and the names of the nodes themselves. • Search for interferences between the members and if found split the set and insert appropriate copies. • Give unique names to the various steps formed. • Rewrite the modified code.
Interesting Features of the Algorithm: • Tries to detect interference early instead of letting it propogate. • Uses a fast set of tests (not exhaustive) to detect possible interference. • Uses the concept of a dominance forest to detect interference (really neat !). • Has an interesting re-naming policy where a global view is taken instead of a local view.
Does it work? • On an average executes 1% less copies. • Does a better job in terms of both memory and time in building the interference graph. • Compiling time and memory usage is more for this algorithm when it tries to do the copy-coalesce (due to the additional analysis).
My humble views: • Really neat idea of finding an approximate interference relation in a fast way. • However, though the interference information is gathered fast, the copy coalesceing takes more time and memory and might not be a good thing to use for JIT compilers. I somehow feel that the two ideas are different and should not be combined. • The paper suggests using the same ideas for register allocation. Might be a nice thing for JIT compilers.
Your valuable views on: • 1% less copies vs 20-40% more memory usage – does it make sense? • Does anybody see any problems in using this idea for register allocation? • Shouldn't the authors give performance of programmes after the algorithm?