advanced compilers cse 231 instructor: sorin lerner
Post on 20-Dec-2015
225 views
TRANSCRIPT
![Page 1: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/1.jpg)
Advanced Compilers
CSE 231
Instructor: Sorin Lerner
![Page 2: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/2.jpg)
Let’s look at a compiler
if (…) { x := …;} else { y := …;}…;
ExecCompilerParserCodeGen
Compiler
Optimizer
![Page 3: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/3.jpg)
ParserParserCodeCodeGenGen
CompilerCompiler
ParserCodeGen
Compiler
Let’s look at a compiler
Optimizer
![Page 4: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/4.jpg)
Advanced Optimizers
CSE 231
Instructor: Sorin Lerner
![Page 5: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/5.jpg)
What does an optimizer do?
1. 2.
ParserParserCodeCodeGenGen
CompilerCompiler
Optimizer
![Page 6: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/6.jpg)
What does an optimizer do?
1.Compute information about a program2.Use that information to perform program
transformations (with the goal of improving some metric, e.g. performance)
ParserParserCodeCodeGenGen
CompilerCompiler
Optimizer
![Page 7: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/7.jpg)
What do these tools have in common?
• Bug finders
• Program verifiers
• Code refactoring tools
• Garbage collectors
• Runtime monitoring system
• And… optimizers
![Page 8: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/8.jpg)
What do these tools have in common?
• Bug finders
• Program verifiers
• Code refactoring tools
• Garbage collectors
• Runtime monitoring system
• And… optimizers
They all analyze and transform programsWe will learn about the techniques underlying all these tools
![Page 9: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/9.jpg)
Program Analyses, Transformations,and Applications
CSE 231
Instructor: Sorin Lerner
![Page 10: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/10.jpg)
Course goals
• Understand basic techniques for doing program analyses and transformations– these techniques are the cornerstone of a variety of program
analysis tools– they may come in handy, no matter what research you end up
doing
• Get a feeling for what research is like in the area by reading research papers, and getting your feet wet in a small research project– useful if you don’t have a research area picked– also useful if you have a research area picked: seeing what
research is like in other fields will give you a broader perspective
![Page 11: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/11.jpg)
Course topics
• Techniques for representing programs
• Techniques for analyzing and transforming programs
• Applications of these techniques
![Page 12: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/12.jpg)
Course topics (more details)
• Representations– Abstract Syntax Tree– Control Flow Graph– Dataflow Graph– Static Single Assignment– Control Dependence Graph– Program Dependence Graph– Call Graph
![Page 13: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/13.jpg)
Course topics (more details)
• Analysis/Transformation Algorithms– Dataflow Analysis– Interprocedural analysis – Pointer analysis– Abstract interpretation– Rule-based analyses and transformations– Constraint-based analysis– Interaction between transformations and analyses– Maintaining the program representation intact
![Page 14: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/14.jpg)
Course topics (more details)
• Applications– Scalar optimizations– Loop optimizations– Object oriented optimizations– Program verification– Bug finding
![Page 15: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/15.jpg)
Course pre-requisites
• No compilers background necessary
• Some familiarity with lattices– I will review what is necessary in class, but it helps if you know it
already
• Some familiarity with functional programming and object-oriented programming– we will look at optimization techniques for these kinds of
languages
• A standard undergrad cs curriculum will most likely cover the above– Talk to me if you think you don’t have the pre-requisites
![Page 16: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/16.jpg)
Course work
• Participation in class (10%)
• Take-home midterm and final (45%)
• Course project (45%)
![Page 17: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/17.jpg)
Course project
• Goal of the project– Get some hands on experience with compilers
and/or Get a feel for what research is like in PL
• Two kinds of projects:– research-y: explore some interesting ideas and try
them out.– implementation-y: pick some existing idea out there,
and implement it – paper-y: read 10 good papers on a topic, and write a
report summarizing and integrating
![Page 18: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/18.jpg)
Course project
• Groups of 2-3 (1 ok in some cases)
• I encourage you to pick something that (is related to)/(will advance) your research outside of this class
• Milestones– Project proposal (due 2 weeks in)– Mid-point status report (5 weeks in)– Final presentation/written report (end of quarter)
![Page 19: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/19.jpg)
Administrative info
• Class web page:– http://cseweb.ucsd.edu/classes/fa11/cse231-a/
• Will post lectures, project info, etc.
![Page 20: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/20.jpg)
Questions?
![Page 21: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/21.jpg)
Program Analyzer Issues (discuss)
ProgramAnalyzerInput Output
![Page 22: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/22.jpg)
Program Analyzer Issues (discuss)
ProgramAnalyzerInput Output
![Page 23: Advanced Compilers CSE 231 Instructor: Sorin Lerner](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d475503460f94a22a0b/html5/thumbnails/23.jpg)
Program Analyzer Issues (discuss)
ProgramAnalyzerInput Output