1 / 15

380C

Last Time Course organization Read Backus et al. Announcements Hadi lab Q&A Wed 1-2 in Painter 5.38N UT Texas Learning Center: 5 hours of free writing consultation, $13per hour. Today Questions on course organization? What’s a compiler? How does it work?. 380C. What is a compiler? .

alexia
Download Presentation

380C

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Last Time Course organization Read Backus et al. Announcements Hadi lab Q&A Wed 1-2 in Painter 5.38N UT Texas Learning Center: 5 hours of free writing consultation, $13per hour Today Questions on course organization? What’s a compiler? How does it work? 380C CS 380C

  2. What is a compiler? • A program that translates a program in one language to another language • The essential interface between applications & architectures • Typically lowers the level of abstraction • analyzes and reasons about the program & architecture • We expect the program to be optimized, i.e., better than the original • ideally exploiting architectural strengths and hiding weaknesses CS 380C

  3. When should we compile? Ahead-of-time: before you run the program Offline profiling: compile several times compile/run/profile.... then run again Just-in-time: while you run the program required for dynamic class loading, i.e., Java, Python, etc. CS 380C

  4. Aren’t compilers a solved problem? “Optimization for scalar machines is a problem that was solved ten years ago.” David Kuck, Fall 1990 CS 380C

  5. Aren’t compilers a solved problem? “Optimization for scalar machines is a problem that was solved ten years ago.” David Kuck, Fall 1990 • Architectures keep changing • Languages keep changing • Applications keep changing - SPEC CPU? • When to compile keeps changing CS 380C

  6. Role of compilers Bridge complexity and evolution in architecture, languages, & applications Help programmers with correctness, reliability, program understanding Compiler optimizations can significantly improve performance • 1 to 10x on conventional processors Performance stability:one line change can dramatically alter performance • unfortunate, but true CS 380C

  7. Optimization What should it do? CS 380C

  8. Optimization What should it do? • improve running time, or • decrease space requirements • decrease power consumption How does it do it? CS 380C

  9. Analysis Scope of program analysis • within a basic block (local) • within a method (global) • across methods (interprocedural) Analysis • control flow graph - dominators, loops, etc. • dataflow analysis - flow of values • static-single-assignment – transform programs such that each variable has a unique definition • alias analysis - pointer memory usage • dependence analysis - array memory usage CS 380C

  10. Example optimizations Division of optimizations • Machine independent • Machine dependent Faster code optimizations • common subexpression elimination • constant folding • dead code elimination • register allocation • scheduling • loop transformations CS 380C

  11. Basic Compiler Structure Higher to lower level representations, analyses, & transformations Machine code Program Structural inlining unrolling loop perm Scalar cse constants expressions Memory scalar repl ptrs Reg. Alloc Scheduling peephole CS 380C

  12. Exciting times Compiler New and changing architectures • Hitting the microprocessor wall • multicore, tiled architectures, tiled memory systems Object-oriented languages becoming dominant paradigm • Java and C# coming to your OS soon - Jnode, Singularity • Security and reliability, ease of programming Key challenges and approaches • Latency & parallelism still key to performance • Language & runtime implementation efficiency • Orchestrating a new software/hardware dance • Break down artificial system boundaries Feedback H/S Profiling Programmer Code Code Runtime Specification Future behavior CS 380C

  13. Questions? CS 380C

  14. Programming Assignment #1 • 380C Lab 1 • Due: Friday 9/11 5pm • Translate from 3 address code to C • We provide a high-level language: • SC: a C-Subset that has functions, recursion, one type of integer (long==8 bytes), arrays, structs, no floating point, no pointers, etc. • We provide “csc” a C-subset compiler that translates from SC to valid 3 address code • You translate it back to C code • Hadi will be available for Q&A Wednesday 9/2 1-2pm (special location). CS 380C

  15. Today Introduction to compilers Next Time program representation control flow Read wiki--No critique on wiki reading! Overview CS 380C

More Related