Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Last Lecture Copyright 2011, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled in Comp 512 at Rice University have explicit permission.

Similar presentations


Presentation on theme: "The Last Lecture Copyright 2011, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled in Comp 512 at Rice University have explicit permission."— Presentation transcript:

1 The Last Lecture Copyright 2011, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled in Comp 512 at Rice University have explicit permission to make copies of these materials for their personal use. Faculty from other educational institutions may use these materials for nonprofit educational purposes, provided this copyright notice is preserved. Comp 512 Spring 2011

2 COMP 512, Fall 20032 Putting It All Together Key questions that a compiler writer must answer What should the optimizer & back end do? How should the compiler represent the program? Broad answers Figure out what the real problems are Learn everything you can about the target machine Attack each problem with a specific plan Separate concerns as long as possible

3 COMP 512, Fall 20033 Lessons Experience is a tough teacher Understand what the code looks like  On input to the compiler and on output from the compiler  Hard to see problems in large procedures A good compiler need not do everything  Study the code & figure out what’s needed  Do those things well & do them thoroughly Hand simulation before implementation pays off  Avoid implementing things that solve no problem Find the right level of abstraction for each optimization  Constant propagation can be done at source level  Redundancy elimination should be done at a low-level

4 COMP 512, Fall 20034 Lessons Experience is a tough teacher Intermediate representations are important  Determines level of exposed detail  Every pass traverses it, so efficient manipulation is critical Code shape and name spaces are important  Determine opportunities & size of data structures  Has large impact on effectiveness of algorithms Compile-time space counts  Limits size of procedures that can be compiled  Compiler touches all that space  More complex analyses take lots of space

5 COMP 512, Fall 20035 Lessons Experience is a tough teacher Separation of concerns is vital to progress  Resource constraints from rearrangement  Allocation from optimization  Parsing from code generation Separation of concerns interferes with optimization  Allocation & scheduling  Evaluation order & redundancy elimination  Code shape decisions affect later passes { Loop shape, case stmts. Annotations ( ILOC tags)

6 COMP 512, Fall 20036 Recap of Material COMP 512 had material in three distinct tracks Experience papers on influential compilers Static analysis of code Transformations intended to improve the code

7 COMP 512, Fall 20037 Recap of Material Experience papers 1. Fortran H Compiler 2. PL.8 Compiler 3. Deutsch-Schiffman Smalltalk-80 System 4. Dynamo 5. Our own work with adaptive compilation

8 COMP 512, Fall 20038 Recap of Material Static Analysis of Code Global CSE using A VAIL Iterative data-flow solvers Proliferation of data-flow problems Def-Use chains as a response to proliferation Building and using SSA form Wegman-Zadeck Constant Propagation ( SSCP, SCCP ) Interprocedural data-flow analysis

9 COMP 512, Fall 20039 Recap of Material Transformations intended to improve the code Value numbering ( LVN, SVN, DVNT ) Global CSE with AVAIL ( GCSE ) Lazy Code Motion ( LCM ) Alpern-Wegman-Zadeck partitioning algorithm ( AWZ ) Useless code elimination ( DEAD ) Control-flow simplification ( CLEAN ) Unreachable code elimination ( reachability, SCCP ) Constant propagation ( SSCP, SCCP ) Algebraic reassociation of expressions Operator strength reduction ( OSR ) Optimizing for energy consumption Eliminating array bounds checks

10 COMP 512, Fall 200310 Transformations intended to improve the code (continued ) 13. Inline substitution 14. Procedure cloning 15. Block cloning (including superblock cloning, fall-through branch optimization, & Wienskoksi’s scheme for software pipelining) 16. Loop unrolling 17. Loop unswitching 18. Loop fusion 19. Loop fission (distribution) 20. Loop interchange & permutation 21. Strip mining and tiling (or blocking) 22. Unroll and Jam 23. Scalar replacement 24. Register promotion Recap of Material

11 COMP 512, Fall 200311 Transformations intended to improve the code (continued ) 25. Adaptive blocksize choice (Waterman on MIPSPro) 26. Hoisting 27. Sinking (cross–jumping) 28. Procedure abstraction 29. Massalin’s Superoptimizer 30. Array linearization 31. Superlocal scheduling without code growth 32. Activation record merging 33. Dynamic code compression 34. Code motion of control structures 35. Profile-guided code positioning 36. Advanced topics in register allocation & scheduling Recap of Material

12 COMP 512, Fall 200312 And that’s the end of our story... Comp 512


Download ppt "The Last Lecture Copyright 2011, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled in Comp 512 at Rice University have explicit permission."

Similar presentations


Ads by Google