Advanced Compiler Design CSE 231 Instructor: Sorin Lerner.

Slides:



Advertisements
Similar presentations
Control-Flow Graphs & Dataflow Analysis CS153: Compilers Greg Morrisett.
Advertisements

Intro to CIT 594
Object Oriented Programming in Java George Mason University Fall 2011
COP3330 Object Oriented Programming in C++ Syllabus
Introduction to Computer Programming I CSE 113
Intro to CIT 594
Recap from last time We saw various different issues related to program analysis and program transformations You were not expected to know all of these.
Recap from last time We saw various different issues related to program analysis and program transformations You were not expected to know all of these.
Administrative info Subscribe to the class mailing list –instructions are on the class web page, click on “Course Syllabus” –if you don’t subscribe by.
Advanced Compilers CSE 231 Instructor: Sorin Lerner.
Administrative info Subscribe to the class mailing list –instructions are on the class web page, which is accessible from my home page, which is accessible.
CS 331 / CMPE 334 – Intro to AI CS 531 / CMPE AI Course Outline.
Names and Scopes CS 351. Program Binding We should be familiar with this notion. A variable is bound to a method or current block e.g in C++: namespace.
Advanced Compilers CSE 231 Instructor: Sorin Lerner.
4/25/08Prof. Hilfinger CS164 Lecture 371 Global Optimization Lecture 37 (From notes by R. Bodik & G. Necula)
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2004 Project.
CS 410 Applied Algorithms Applied Algorithms Lecture #1 Introduction, class information, first problems.
Advanced Compilers CSE 231 Instructor: Sorin Lerner.
Class 1: What this course is about. Assignments Reading: Chapter 1, pp 1-33 Do in Class 1: –Exercises on pages 13, 14, 22, 28 To hand in in Class 2: –Exercises.
Recap from last time We saw various different issues related to program analysis and program transformations You were not expected to know all of these.
7/3/2015Data Structures and Algorithms1 Dick Steflik Fall 2012.
Recap from last time We saw various different issues related to program analysis and program transformations You were not expected to know all of these.
EECS 395/495 Algorithmic Techniques for Bioinformatics General Introduction 9/27/2012 Ming-Yang Kao 19/27/2012.
Intro to CIT 594
COP4020/CGS5426 Programming languages Syllabus. Instructor Xin Yuan Office: 168 LOV Office hours: T, H 10:00am – 11:30am Class website:
Computer Science 102 Data Structures and Algorithms V Fall 2009 Lecture 1: administrative details Professor: Evan Korth New York University 1.
Welcome to CompSci 100! As You Arrive… Make sure you grab a syllabus packet. Read through it. I will be covering the most essential points in my talk,
CPSC 388 – Compiler Design and Construction Lecture: MWF 11:00am-12:20pm, Room 106 Colton.
Syllabus CS 765: Introduction to Database Management Systems Fall 2008 Text Database Management Systems Ramakrishnan/Gehrke, 3rd.
Cpt S 471/571: Computational Genomics Spring 2015, 3 cr. Where: Sloan 9 When: M WF 11:10-12:00 Instructor weekly office hour for Spring 2015: Tuesdays.
COMP 111 Programming Languages 1 First Day. Course COMP111 Dr. Abdul-Hameed Assawadi Office: Room AS15 – No. 2 Tel: Ext. ??
EECE 310 Software Engineering Lecture 0: Course Orientation.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2011 Course Overview John Cavazos University.
CSCA48 Course Summary.
Salman Marvasti Sharif University of Technology Fall 2014.
Welcome to CS 115! Introduction to Programming. Class URL Write this down!
Computer Science 102 Data Structures and Algorithms CSCI-UA.0102 Fall 2012 Lecture 1: administrative details Professor: Evan Korth New York University.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Advanced Compilers CMPSCI 710 Spring 2004 Lecture 1 Emery Berger University of Massachusetts,
Principles of Computer Science I Honors Section Note Set 1 CSE 1341 – H 1.
Research Topics CSC Parallel Computing & Compilers CSC 3990.
Course Information Andy Wang CIS 5930 Computer Systems Performance Analysis.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 3, Lecture 1.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Overview of Compilers and JikesRVM John.
An Undergraduate Course on Software Bug Detection Tools and Techniques Eric Larson Seattle University March 3, 2006.
Compiler Construction (CS-636)
Intro to CIT 594
CMSC 2021 CMSC 202 Computer Science II for Majors Spring 2002 Sections Ms. Susan Mitchell.
CMSC 2021 CMSC 202 Computer Science II for Majors Spring 2003 Mr. Frey (0101 – 0104) Mr. Raouf (0201 – 0204)
Data Structures and Algorithms in Java AlaaEddin 2012.
CS 161 Introduction to Computer Science I Winter, 2014: 112 Spring, 2014: 131 Summer, 2014: 132.
Principles of Imperative Computation Lecture 1 January 15 th, 2012.
Course topics Representing programs Analyzing and transforming programs Applications of these techniques.
PROBLEM SOLVING AND PROGRAMMING ISMAIL ABUMUHFOUZ | CS 170.
Welcome! Simone Campanoni
Computer Science I ISMAIL ABUMUHFOUZ | CS 180. CS 180 Description BRIEF SUMMARY: This course covers a study of the algorithmic approach and the object.
Course Information Andy Wang CIS 5930 Computer Systems Performance Analysis.
A Single Intermediate Language That Supports Multiple Implemtntation of Exceptions Delvin Defoe Washington University in Saint Louis Department of Computer.
Andy Wang Object Oriented Programming in C++ COP 3330
CS6501 Advanced Topics in Information Retrieval Course Policy
Advanced Compiler Design
CSE 662 – Languages and Databases Class Overview
Advanced Compilers CMPSCI 710 Spring 2003 Lecture 1
Cpt S 471/571: Computational Genomics
Course Overview - Database Systems
Welcome to CS 1340! Computing for scientists.
Andy Wang Object Oriented Programming in C++ COP 3330
Advanced Compiler Design
Optimizing Compilers CISC 673 Spring 2009 Course Overview
Academic Integrity.
Advanced Compiler Design
Presentation transcript:

Advanced Compiler Design CSE 231 Instructor: Sorin Lerner

Let’s look at a compiler if (…) { x := …; } else { y := …; } …; Exec Compiler Parser Code Gen Compiler Optimizer

Parser Code Gen Compiler Let’s look at a compiler Optimizer

Advanced Optimizer Design CSE 231 Instructor: Sorin Lerner

What does an optimizer do? 1.Compute information about a program 2.Use that information to perform program transformations (with the goal of improving some metric, e.g. performance) Optimizer

What do these tools have in common? Bug finders Program verifiers Code refactoring tools Garbage collectors Runtime monitoring system And… optimizers

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 programs We will learn about the techniques underlying all these tools

Program Analyses, Transformations, and Applications CSE 231 Instructor: Sorin Lerner

Course goals Understand basic techniques –cornerstone of a variety of program analysis tools –useful no matter what your future path Get a feel for compiler research/implementation –useful if you don’t have a research area picked –also useful if you have a research area picked

Course topics Representing programs Analyzing and transforming programs Applications of these techniques

Course topics (more details) Representations –Abstract Syntax Tree –Control Flow Graph –Dataflow Graph –Static Single Assignment –Control Dependence Graph –Program Dependence Graph –Call Graph

Course topics (more details) Analysis/Transformation Algorithms –Dataflow Analysis –Interprocedural analysis –Pointer analysis –Rule-based analyses and transformations –Constraint-based analysis

Course topics (more details) Applications –Scalar optimizations –Loop optimizations –Object oriented optimizations –Program verification –Bug finding

Course pre-requisites No compilers background necessary No familiarity with lattices –I will review what is necessary in class Familiarity with functional/OO programming –Optimization techniques for these kinds of languages Standard ugrad cs curriculum likely enough –Talk to me if you’re concerned

Course work In-class midterm (30%) Take-home final (30%) Course project (35%) Class readings (5%)

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 Three 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

Course project Groups of 3 (make groups by this Friday) Pick something to advance your personal enrichment goals Eg: Pick something related to your research, something that you want to learn about Milestones –Project proposal (due end of week 2) –Mid-point status report (5 weeks in) –Final presentation/written report (end of quarter)

Readings Paper readings throughout the quarter Seminal papers and state of the art Will give you a feel for what research looks like

Administrative info Class web page is up – –(or Google “Sorin Lerner”, follow “Teaching Now”) –Will post lectures, readings, project info, etc. Piazza link on web page –Use for questions, answers –Especially LLVM/project Q&A

Academic Integrity Governed by Policy on Integrity of Scholarship ( Manual/Appendices/2) Allegations are handled by Academic Integrity Office ( Course penalty for any cheating in 231 will be a failing grade for the entire class Cheaters may be subsect to additional administrative sanctions

Questions?

Program Analyzer Issues (discuss) Program Analyzer InputOutput

Program Analyzer Issues (discuss) Program Analyzer InputOutput

Program Analyzer Issues (discuss) Program Analyzer InputOutput

Input issues Input is a program, but… What language is the program written in? –imperative vs. functional vs. object-oriented? maybe even declarative? –what pointer model does the language use? –reflection, exceptions, continuations? –type system trusted or not? –one often analyzes an intermediate language... how does one design such a language? Instructor’s discussion notes Program Analyzer InputOutput

Input issues How much of the program do we see? –all? –one file at a time? –one library at a time? –reflection… Any additional inputs? –any human help? –profile info? Instructor’s discussion notes Program Analyzer InputOutput

Analysis issues Analysis/compilation model –Separate compilation/analysis quick, but no opportunities for interprocedural analysis –Link-time allows interprocedural and whole program analysis but what about shared precompiled libraries? and what about compile-time? –Run-time best optimization/analysis potential (can even use run-time state as additional information) can handle run-time extensions to the program but severe pressure to limit compilation time –Selective run-time compilation choose what part of compilation to delay until run-time can balance compile-time/benefit tradeoffs Instructor’s discussion notes Program Analyzer InputOutput

Analysis issues Does running-time matter? –for use in IDE? –or in overnight compile? Instructor’s discussion notes Program Analyzer InputOutput

Output issues Form of output varies widely, depending on analysis –alias information –constantness information –loop terminates/does not terminate Correctness of analysis results –depends on what the results are used for –are we attempting to design algorithms for solving undecidable problems? –notion of approximation –statistical output Instructor’s discussion notes Program Analyzer InputOutput

Program Transformation Issues (discuss) Program Transformer InputOutput

Input issues A program, and … Program analysis results Profile info? Environment: # of CPUs, # of cores/CPU, cache size, etc. Anything else? Instructor’s discussion notes Program Transformer InputOutput

Transformation issues What is profitable? What order to perform transformations? What happens to the program representation? What happens to the computed information? For example alias information? Need to recompute? Instructor’s discussion notes Program Transformer InputOutput

Output issues Output in same IL as input? Should the output program behave the same way as the input program? Instructor’s discussion notes Program Transformer InputOutput