Welcome! Simone Campanoni

Slides:



Advertisements
Similar presentations
Software & Services Group, Developer Products Division Copyright© 2010, Intel Corporation. All rights reserved. *Other brands and names are the property.
Advertisements

ECE 454 Computer Systems Programming Compiler and Optimization (I) Ding Yuan ECE Dept., University of Toronto
CS 31003: Compilers Introduction to Phases of Compiler.
Introduction to Advanced Topics Chapter 1 Mooly Sagiv Schrierber
Intermediate Representation I High-Level to Low-Level IR Translation EECS 483 – Lecture 17 University of Michigan Monday, November 6, 2006.
Lecture 01 - Introduction Eran Yahav 1. 2 Who? Eran Yahav Taub 734 Tel: Monday 13:30-14:30
Teaching Programming Language Design and Implementation: Perspective From Two Roles Dan Grossman PLDI Panel 2011.
Representing programs Goals. Representing programs Primary goals –analysis is easy and effective just a few cases to handle directly link related things.
Cpeg421-08S/final-review1 Course Review Tom St. John.
COMS W1004 Introduction to Computer Science June 25, 2008.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
From Cooper & Torczon1 Implications Must recognize legal (and illegal) programs Must generate correct code Must manage storage of all variables (and code)
Compiler Construction
CS 153: Concepts of Compiler Design August 25 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Compiler Construction
CS 101 Problem Solving and Structured Programming in C Sami Rollins Spring 2003.
Building An Interpreter After having done all of the analysis, it’s possible to run the program directly rather than compile it … and it may be worth it.
Overview of program analysis Mooly Sagiv html://
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
1 Programming Languages Examples: C, Java, HTML, Haskell, Prolog, SAS Also known as formal languages Completely described and rigidly governed by formal.
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.
Topic #10: Optimization EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
ITEC 380 Organization of programming languages Dr. Andrew Ray.
COP4020 Programming Languages
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
Compiler course 1. Introduction. Outline Scope of the course Disciplines involved in it Abstract view for a compiler Front-end and back-end tasks Modules.
Project: ACM Compiler 2014 Shanghai Jiao Tong University Class ACM 2011 Dong Xie.
Elements of Computing Systems, Nisan & Schocken, MIT Press, 2005, Chapter 11: Compiler II: Code Generation slide 1www.idc.ac.il/tecs.
Research Topics CSC Parallel Computing & Compilers CSC 3990.
1.  10% Assignments/ class participation  10% Pop Quizzes  05% Attendance  25% Mid Term  50% Final Term 2.
CS453 LectureIntroduction1 CS453 Compiler Construction Instructor:Wim Bohm Computer Science Building 470 TA: tba
CS 671 Compilers Prof. Kim Hazelwood Spring 2008.
COP 4620 / 5625 Programming Language Translation / Compiler Writing Fall 2003 Lecture 1, 08/28/03 Prof. Roy Levow.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
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.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Chapter# 6 Code generation.  The final phase in our compiler model is the code generator.  It takes as input the intermediate representation(IR) produced.
Compiler Design Introduction 1. 2 Course Outline Introduction to Compiling Lexical Analysis Syntax Analysis –Context Free Grammars –Top-Down Parsing –Bottom-Up.
Compiler Optimizations ECE 454 Computer Systems Programming Topics: The Role of the Compiler Common Compiler (Automatic) Code Optimizations Cristiana Amza.
The Model of Compilation Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
CS412/413 Introduction to Compilers and Translators Spring ’99 Lecture 11: Functions and stack frames.
1 Compiler & its Phases Krishan Kumar Asstt. Prof. (CSE) BPRCE, Gohana.
CS453 LectureIntroduction1 CS453 Compiler Construction Original Design: Michelle Strout Instructor:Wim Bohm
C H A P T E R T W O Linking Syntax And Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
Data Structures and Algorithms in Java AlaaEddin 2012.
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
CSC 4181 Compiler Construction
CS 404Ahmed Ezzat 1 CS 404 Introduction to Compiler Design Lecture 10 Ahmed Ezzat.
1 Compiler Construction Vana Doufexi office CS dept.
LLVM Simone Campanoni
CS416 Compiler Design1. 2 Course Information Instructor : Dr. Ilyas Cicekli –Office: EA504, –Phone: , – Course Web.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Simone Campanoni LLVM Simone Campanoni
Advanced Computer Systems
Compiler Design (40-414) Main Text Book:
Simone Campanoni Welcome! Simone Campanoni
课程名 编译原理 Compiling Techniques
Compiler Lecture 1 CS510.
CS 536 / Fall 2017 Introduction to programming languages and compilers
CS416 Compiler Design lec00-outline September 19, 2018
An Overview to Compiler Design
CSE401 Introduction to Compiler Construction
Compiler Construction
CS416 Compiler Design lec00-outline February 23, 2019
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Compiler Construction
Lec00-outline May 18, 2019 Compiler Design CS416 Compiler Design.
Presentation transcript:

Welcome! Simone Campanoni

Outline Structure of the course Example of a code analysis and transformation (CAT) CAT and compilers CAT and computer architecture CAT and programming language

CAT in a nutshell About: understanding and transforming code automatically EECS 395/495 Satisfy the system depth for CS major Tuesday/Thursday 2:00pm – 3:20pm at L221 Tech (here ;)) Office hours: Friday 2:00pm – 5:00pm But feel free to stop by at my office any time CAT is on Canvas Materials/Calendar/Assignments/Grades on Canvas You’ll upload your assignments on Canvas

CAT materials Compilers: Principles, Techniques, and Tools Slides and assigned papers LLVM documentation

The CAT structure Topic & homework Topic & project Project discussion Today 11/12 11/19 12/3 12/8 12/10 Week TuesdayThursday Homework

The CAT structure Topic & homework Topic & project Project discussion Today 11/12 11/19 12/3 12/8 12/10 Week Tuesday Project Thursday Week TuesdayThursday

The CAT structure Topic & homework Topic & project Project discussion Today 11/12 11/19 12/3 12/8 12/10 Week Tuesday Whole class discussion Thursday Whole class discussion

The CAT grading Homework: 70 points 10 points per assignment Project: 20 points Final result Paper Final discussion: 10 points GradePoints A95 – 100 A -90 – 94 B +80 – 89 B61 – 79 C D25 – 49 F0 - 24

Rules for homework & final project No copying of code is allowed Tool, infrastructure help is allowed First try it on your own (google and tool documentation are your friend) You must report who helped you and how on your reports Avoid plagiarism If you don’t know, please ask

Summary My duties Teach you code analysis and transformation Your duties Learn code analysis and transformation Implement a few of them in LLVM Write code Write reports for each homework Implement a final project Write code Write a final document about your project Prepare a presentation and be ready for discussion No final exam

Structure & flexibility CAT is structured w/ topics Best way to learn is to be excited about a topic Interested in something? Speak I’ll do my best to include your topic on the fly

Week 1 The CAT structure Today Welcome/Structure Compiler/CAT F.E. M.E. B.E. Thursday LLVM Topic & homework Topic & project Project discussion

The role of compilers If there is no coffee, if I still have work to do, I’ll keep working, I’ll go to the coffee shop If there is no coffee{ if I still have work to do{ I’ll keep working; } I’ll go to the coffee shop; } ??? Compilers Code analysis and transformation

Theory Inter- fields Practice Compilers & CATs

Example of CAT varX = 5 … … … … print varX … What will it print?

Example of CAT varX = 5 … print 5 … What will it print? print varX

Example of CAT varX = 5 … print varX … Analysis Code Property Transformation Transformed code varX = 5 … print 5 … Is it worth transforming?

Designing CATs Choose a goal Performance, energy, finding bugs, discovering properties Design automatic analysis to obtain the required information Occasionally design the code transformation

Use of CATs Compilers Optimize performance energy efficiency code generation Developing tools Understanding code Computer architecture

Structure of a compiler Character stream (Source code) Lexical analysis int main (){ printf(“Hello World!\n”); return 0; } Tokens i nt m ai n … INT STRING SPACE … Syntactic & semantic analysis AST Function signature Return type INT Function name STRING

Structure of a compiler Character stream (Source code) Lexical analysis Tokens i nt m ai n … INT STRING SPACE … Syntactic & semantic analysis AST Function signature Return type INT Function name STRING

Structure of a compiler Syntactic & semantic analysis AST Function signature Return type INT Function name STRING IR code generation IR ; Function Attrs: nounwind uwtable define {

Structure of a compiler Front-end IR ; Function Attrs: nounwind uwtable define { Character stream (Source code) i nt m ai n … Middle-end IR ; Function Attrs: nounwind uwtable define { Code analysis and transformation Back-end Machine code EECS 322: Compiler Construction

Structure of a compiler Front-end IR Character stream (Source code) Middle-end IR Back-end Machine code Front-end Middle-end Back-end Character stream (Source code) Machine code

Structure of a compiler Front-end IR C Middle-end IR Back-end Machine code Front-end Middle-end Back-end Machine code C Java

Structure of a compiler Front-end IR C Middle-end IR Back-end Machine code Front-end Middle-end Back-end Machine code Java

Structure of a compiler Front-end IR C Middle-end IR Back-end Machine code Front-end Middle-end Back-end Machine code Java FE M2

Structure of a compiler Front-end IR C Middle-end IR Back-end Machine code Front-end Middle-end Back-end Java FE M2 BE

Structure of a compiler Front-end 1 IR L 1 Middle-end IR Back-end A M A L 2 Front-end 2 M B Back-end B

Multiple IRs Abstract Syntax Tree Register-based representation (three-address code) R1 = R2 add R3 Stack-based representation push 5; push 3; add; pop ; R1 R2R3 +

Example of IR define %argc, i8** %argv) { entry: %add = add i32 %argc, 1 ret i32 %add } LLVM

Multiple IRs used together Static compiler IR1 L1 Dynamic compiler FE IR2 Dynamic compiler BE Machine code

Multiple IRs used together Java compiler Java bytecode Java Java VM FE IR2 Java VM BE Machine code

CATs that we’ll focus on Semantics-preserving transformations Correctness guaranteed Goal: performance Automatic Efficient

Evolution of CATs (hardware point of view) Simple hardware (few resources), simple CATs Core Cache L1 Registers Memory Cache L2 Size Latency

Evolution of CATs (hardware point of view) Simple hardware (few resources), simple CATs More hardware resources available to compilers Opportunities to improve programs Challenging CATs Execution model mismatch between source code and hardware Challenging CATs Compilers/CATs are developed in the processor-design stage!

Evolution of CATs (hardware point of view) (2) ?: Complex instruction set computing (CISC) ?: Reduced instruction set computer (RISC)

Evolution of CATs (hardware point of view) (3) Superscalar Inst 1 Inst 2 Inst 3 Inst 4 Inst 5 Inst 6 Inst 7 Inst 8 Inst 1 Inst 2 Inst 3 Inst 4 Inst 5 Inst 6 Inst 7 Inst 8 Very long instruction word (VLIW) CATs

Evolution of CATs (PL point of view) Low level programming language, simple CATs Not very productive More abstraction in programming language, more work for CATs to reduce their performance impact CATs enable new programming languages

Evolution of CATs (PL point of view)(2) PL without procedures void main (){ String s1,s2; s1.append(‘c’); s2.append(‘c’); }

Evolution of CATs (PL point of view)(3) Let’s add procedures to our PL Call-by-Value void proc1 (int a){…} proc1(myVar1) Call-by-Reference void proc1 (String a){…} proc1(myString1)

Evolution of CATs (PL point of view)(2) void myProc (String s1, String s2){ s1.append(‘a’); s2.append(‘c’); }

Conclusion CATs used for multiple goals Enable PLs Enable hardware features CATs are effected by Their input language The target hardware

Ideal CATs Proved to be correct Improve performance of many important programs Minor compilation time Negligible implementation efforts

Demo time