Top Banner
1 DF00100 Advanced Compiler Construction, VT 2012 DF00100 Advanced Compiler Construction Organizational issues Christoph Kessler, IDA, Linköpings universitet, 2012. www.ida.liu.se/~chrke/courses/ACC Staff Lectures / Presentation session / Examination Christoph Kessler, IDA, Linköpings universitet Christoph Kessler, IDA, Linköpings universitet chrke \at ida.liu.se Welf Löwe, Linné-universitetet, Växjö, welf.lowe \at vxu.se (guest lecturer / examiner) Lessons Erik Hansson, IDA, eriha \at ida.liu.se Labs (LLVM) Erik Hansson Course administrator 2 TDDC86 Compiler Optimizations and Code Generation C. Kessler, IDA, Linköpings universitet. Course administrator Anne Moe, IDA, annes \at ida.liu.se Course moments (total: 9 hp) Lectures and exam 2 lecture blocks (week 5+ week 8, monday-thursday) See course web page for schedule, contents Written/oral exam __ march 2012 14:00-18:00, 4.5hp Mandatory presence 50% of the lectures + lessons for admission to presentation and exam Labs,3 hp (could be done in groups of 2) Labs,3 hp (could be done in groups of 2) LLVM open-source compiler framework, llvm.org Lab part 1: IR and program analysis, 1.5hp Lab part 2: Code generation, 1.5hp Presentation 9 march 2012 09:15-…(whole day), 1.5hp 3 TDDC86 Compiler Optimizations and Code Generation C. Kessler, IDA, Linköpings universitet. Presentation 9 march 2012 09:15-…(whole day), 1.5hp of a recent compiler research paper Opposition on another presentation Written summary with your own words, ca. 2 pages Lessons and Labs Lessons: Theory exercises, good as preparation for the written exam Theory exercises, good as preparation for the written exam To get out most of the lessons for yourself: Prepare your solutions well ahead of time Present your solution in class Labs: Lab introduction tomorrow (Tuesday) at 11:00 Mission critical, attendance is highly recommended 4 TDDC86 Compiler Optimizations and Code Generation C. Kessler, IDA, Linköpings universitet. Mission critical, attendance is highly recommended Why Another Compiler Course? (1) Focus of traditional compiler courses (e.g., TDDB44, TDDD16): (e.g., TDDB44, TDDD16): Understand concepts of programming languages Syntax, semantics Good application of formal languages and automata theory and automata theory Lexing, parsing Toy languages and toy target architectures Front-end, Parser generators, symbol table, AST, syntax- 5 TDDC86 Compiler Optimizations and Code Generation C. Kessler, IDA, Linköpings universitet. driven translation, quadruples, simple code generation Technology well-established since 1970s Why Another Compiler Course? (2) Current compiler technology R&D has a different focus: Rate of language introduction is low Rate of language introduction is low Few students will be hired to write industrial frontends Rate of architectural change and variety is high Embedded pr., uC, DSP, NP, superscalar, VLIW/EPIC, SIMD, GPU, SMP, Cluster, Multicore, SoC, MPSoC, reconfigurable, FPGA, … A new computer architecture does not sell without a (~C) compiler Optimizing compilers vs. Manual low-level coding and tuning High requirements on code Execution time, Realtime constr., Code size, Energy consumption Hot issues: Automatic program optimization, vectorization and 6 TDDC86 Compiler Optimizations and Code Generation C. Kessler, IDA, Linköpings universitet. Hot issues: Automatic program optimization, vectorization and parallelization, high-quality target code generation Necessary for this: Static analysis of programs Also hot, but not covered here: Static analysis for correctness and security properties
2

DF00100 Advanced Compiler Construction - ida.liu.sechrke55/courses/ACC/PDF-2012/ACC-F0intro.pdf · DF00100Advanced Compiler Construction, VT 2012 ... Toy languages and toy target

Mar 05, 2018

Download

Documents

vutuyen
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: DF00100 Advanced Compiler Construction - ida.liu.sechrke55/courses/ACC/PDF-2012/ACC-F0intro.pdf · DF00100Advanced Compiler Construction, VT 2012 ... Toy languages and toy target

1

DF00100 Advanced Compiler Construction, VT 2012

DF00100

Advanced Compiler Construction

Organizational issues

Christoph Kessler, IDA,Linköpings universitet, 2012.

www.ida.liu.se/~chrke/courses/ACC

Staff

Lectures / Presentation session / Examination

Christoph Kessler, IDA, Linköpings universitetChristoph Kessler, IDA, Linköpings universitetchrke \at ida.liu.se

Welf Löwe, Linné-universitetet, Växjö, welf.lowe \at vxu.se(guest lecturer / examiner)

LessonsLessons

Erik Hansson, IDA, eriha \at ida.liu.se

Labs (LLVM)

Erik Hansson

Course administrator

2 TDDC86 Compiler Optimizations and Code GenerationC. Kessler, IDA, Linköpings universitet.

Course administrator

Anne Moe, IDA, annes \at ida.liu.se

Course moments (total: 9 hp)

Lectures and exam

2 lecture blocks (week 5 + week 8, monday-thursday)2 lecture blocks (week 5 + week 8, monday-thursday)

See course web page for schedule, contents

Written/oral exam __ march 2012 14:00-18:00, 4.5hp

Mandatory presence 50% of the lectures + lessons foradmission to presentation and exam

Labs, 3 hp (could be done in groups of 2)Labs, 3 hp (could be done in groups of 2)

LLVM open-source compiler framework, llvm.org

Lab part 1: IR and program analysis, 1.5hp

Lab part 2: Code generation, 1.5hp

Presentation 9 march 2012 09:15-… (whole day), 1.5hp

3 TDDC86 Compiler Optimizations and Code GenerationC. Kessler, IDA, Linköpings universitet.

Presentation 9 march 2012 09:15-… (whole day), 1.5hp

of a recent compiler research paper

Opposition on another presentation

Written summary with your own words, ca. 2 pages

Lessons and Labs

Lessons:

Theory exercises, good as preparation for the written examTheory exercises, good as preparation for the written exam

To get out most of the lessons for yourself:

Prepare your solutions well ahead of time

Present your solution in classPresent your solution in class

Labs:

Lab introduction tomorrow (Tuesday) at 11:00

Mission critical, attendance is highly recommended

4 TDDC86 Compiler Optimizations and Code GenerationC. Kessler, IDA, Linköpings universitet.

Mission critical, attendance is highly recommended

Why Another Compiler Course? (1)

Focus of traditional compiler courses(e.g., TDDB44, TDDD16):(e.g., TDDB44, TDDD16):

Understand concepts of programming languages

Syntax, semantics

Good application of formal languagesand automata theoryand automata theory

Lexing, parsing

Toy languages and toy target architectures

Front-end, Parser generators, symbol table, AST, syntax-

5 TDDC86 Compiler Optimizations and Code GenerationC. Kessler, IDA, Linköpings universitet.

Front-end, Parser generators, symbol table, AST, syntax-driven translation, quadruples, simple code generation

Technology well-established since 1970s

Why Another Compiler Course? (2)

Current compiler technology R&D has a different focus:

Rate of language introduction is lowRate of language introduction is low

Few students will be hired to write industrial frontends

Rate of architectural change and variety is high

Embedded pr., uC, DSP, NP, superscalar, VLIW/EPIC, SIMD, GPU,SMP, Cluster, Multicore, SoC, MPSoC, reconfigurable, FPGA, …

A new computer architecture does not sell without a (~C) compiler

Optimizing compilers vs. Manual low-level coding and tuning

High requirements on code

Execution time, Realtime constr., Code size, Energy consumption

Hot issues: Automatic program optimization, vectorization and

6 TDDC86 Compiler Optimizations and Code GenerationC. Kessler, IDA, Linköpings universitet.

Hot issues: Automatic program optimization, vectorization andparallelization, high-quality target code generation

Necessary for this: Static analysis of programs

Also hot, but not covered here:Static analysis for correctness and security properties

Page 2: DF00100 Advanced Compiler Construction - ida.liu.sechrke55/courses/ACC/PDF-2012/ACC-F0intro.pdf · DF00100Advanced Compiler Construction, VT 2012 ... Toy languages and toy target

2

Contents

Advanced Intermediate Representation Design

Multi-Level IRs

Static Single Assignment (SSA) Form

Static Analysis of Programs

Control Flow Analysis

Data Flow Analysis

Abstract InterpretationAbstract Interpretation

Points-to Analysis

Dependence Analysis

Target-independent / High-Level Optimizations

Loop Optimizations e.g. for Data Locality; Loop Parallelization; …

Optimized Code Generation

7 TDDC86 Compiler Optimizations and Code GenerationC. Kessler, IDA, Linköpings universitet.

Optimized Code Generation

Instruction Selection, Instruction Scheduling, Register Allocation,Predication, …

Code Generation for embedded, DSP, and parallel target architectures

Autotuning and Other Issues (as time permits)

Literature

No single book covers the course contents completely.

Combine different book chapters and papers Combine different book chapters and papers

List on course homepage

In the library

8 TDDC86 Compiler Optimizations and Code GenerationC. Kessler, IDA, Linköpings universitet.

Literature (cont.)

C. Kessler: Compiling for VLIW Processors.Book chapter, in S. Bhattacharyya, E. Deprettere, R. LeupersBook chapter, in S. Bhattacharyya, E. Deprettere, R. Leupersand J. Takala, eds., Handbook of Signal Processing Systems,Springer, 2010. Ca. 41 pages.

Preprint handed out

Mandatory course literature for the code generation partMandatory course literature for the code generation part

TekNat-Library will have the complete book

9 TDDC86 Compiler Optimizations and Code GenerationC. Kessler, IDA, Linköpings universitet.

Prerequisites

A first course in compiler construction

TDDD16, TDDB44 or similarTDDD16, TDDB44 or similar

or read the Dragon book in advance

A course in computer architecture

Processor structure, pipelining, assembler language…

or read Hennessy/Patterson: Computer Architecture

Background in discrete maths, data structures and algorithms

Graphs, trees; depth-first search; connected components;backtracking, dynamic programming, branch-and-bound,…

10 TDDC86 Compiler Optimizations and Code GenerationC. Kessler, IDA, Linköpings universitet.

backtracking, dynamic programming, branch-and-bound,…

Some recapitulation materialavailable on course homepage