Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 1CS 380C 1 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:

Similar presentations


Presentation on theme: "Lecture 1CS 380C 1 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:"— Presentation transcript:

1 Lecture 1CS 380C 1 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?

2 Lecture 1CS 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

3 Lecture 1CS 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.

4 Lecture 1CS 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

5 Lecture 1CS 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

6 Lecture 1CS 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

7 Lecture 1CS 380C 7 Optimization What should it do?

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

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

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

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

12 Lecture 1CS 380C 12 Exciting times 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 Compiler ProgrammerRuntime Code SpecificationFuture behavior Feedback H/S Profiling

13 Lecture 1CS 380C 13 Questions?

14 Lecture 1CS 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).

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


Download ppt "Lecture 1CS 380C 1 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:"

Similar presentations


Ads by Google