An Overview of Compilation

Similar documents
The Design and Implementation of Gnu Compiler Collection

Compiler Design (40-414)

An Overview to Compiler Design. 2008/2/14 \course\cpeg421-08s\topic-1a.ppt 1

specrtl: A Language for GCC Machine Descriptions

Compiler Design. Computer Science & Information Technology (CS) Rank under AIR 100

Compilers and Code Optimization EDOARDO FUSELLA

The Compiler So Far. CSC 4181 Compiler Construction. Semantic Analysis. Beyond Syntax. Goals of a Semantic Analyzer.

Intermediate Code Generation

Compiler Theory. (Semantic Analysis and Run-Time Environments)

LECTURE NOTES ON COMPILER DESIGN P a g e 2

What is a compiler? var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done

Alternatives for semantic processing

CS 415 Midterm Exam Spring SOLUTION

Fall Compiler Principles Lecture 6: Intermediate Representation. Roman Manevich Ben-Gurion University of the Negev

CST-402(T): Language Processors

Intermediate Code & Local Optimizations

CS5363 Final Review. cs5363 1

Crafting a Compiler with C (II) Compiler V. S. Interpreter

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

CS 4201 Compilers 2014/2015 Handout: Lab 1

GCC Internals: A Conceptual View Part II

Syntax-Directed Translation. Lecture 14

The role of semantic analysis in a compiler

COMP 303 Computer Architecture Lecture 3. Comp 303 Computer Architecture

What is a compiler? Xiaokang Qiu Purdue University. August 21, 2017 ECE 573

CA Compiler Construction

Fall Compiler Principles Lecture 5: Intermediate Representation. Roman Manevich Ben-Gurion University of the Negev

Compiler Design Overview. Compiler Design 1

CSE 401 Midterm Exam Sample Solution 11/4/11

Working of the Compilers

Anatomy of a Compiler. Overview of Semantic Analysis. The Compiler So Far. Why a Separate Semantic Analysis?

5. Semantic Analysis!

Incremental Machine Descriptions for GCC

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILING

CS152 Programming Language Paradigms Prof. Tom Austin, Fall Syntax & Semantics, and Language Design Criteria

Time : 1 Hour Max Marks : 30

Semantic Analysis. Compiler Architecture

Undergraduate Compilers in a Day

Formats of Translated Programs

Code Generation. Frédéric Haziza Spring Department of Computer Systems Uppsala University

COLLEGE OF ENGINEERING, NASHIK. LANGUAGE TRANSLATOR

Compilers. Intermediate representations and code generation. Yannis Smaragdakis, U. Athens (original slides by Sam

Principles of Compiler Design

PSD3A Principles of Compiler Design Unit : I-V. PSD3A- Principles of Compiler Design

CSE 582 Autumn 2002 Exam 11/26/02

Introduction to Compiler Construction

Project Compiler. CS031 TA Help Session November 28, 2011

Compiling Regular Expressions COMP360

Code Genera*on for Control Flow Constructs

Final Examination May 5, 2005

Compilers CS S-08 Code Generation

Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan

RYERSON POLYTECHNIC UNIVERSITY DEPARTMENT OF MATH, PHYSICS, AND COMPUTER SCIENCE CPS 710 FINAL EXAM FALL 96 INSTRUCTIONS

The Structure of a Syntax-Directed Compiler

IR Optimization. May 15th, Tuesday, May 14, 13

CS 432 Fall Mike Lam, Professor. Code Generation

Chapter 2 A Quick Tour

About the Authors... iii Introduction... xvii. Chapter 1: System Software... 1

Syntax-directed translation. Context-sensitive analysis. What context-sensitive questions might the compiler ask?

What do Compilers Produce?

Semantic actions for expressions

Introduction to Compiler Construction

CS 415 Midterm Exam Spring 2002


CS 406/534 Compiler Construction Putting It All Together

COMP 181. Prelude. Intermediate representations. Today. High-level IR. Types of IRs. Intermediate representations and code generation

Semantic Analysis and Type Checking

Comp 204: Computer Systems and Their Implementation. Lecture 22: Code Generation and Optimisation

5. Semantic Analysis. Mircea Lungu Oscar Nierstrasz

Parsing III. CS434 Lecture 8 Spring 2005 Department of Computer Science University of Alabama Joel Jones

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

LECTURE 3. Compiler Phases

CSI32 Object-Oriented Programming

9/5/17. The Design and Implementation of Programming Languages. Compilation. Interpretation. Compilation vs. Interpretation. Hybrid Implementation

Programming Language Processor Theory

COMPILER DESIGN. For COMPUTER SCIENCE

Syntax and Grammars 1 / 21

Retargeting GCC to Spim: A Recap

CSc 453. Code Generation I Christian Collberg. Compiler Phases. Code Generation Issues. Slide Compilers and Systems Software.

Where we are. What makes a good IR? Intermediate Code. CS 4120 Introduction to Compilers

Intermediate Code & Local Optimizations. Lecture 20

Compilers. Compiler Construction Tutorial The Front-end

Introduction. CSc 453. Compilers and Systems Software. 19 : Code Generation I. Department of Computer Science University of Arizona.

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler so far

MidTerm Papers Solved MCQS with Reference (1 to 22 lectures)

COMP455: COMPILER AND LANGUAGE DESIGN. Dr. Alaa Aljanaby University of Nizwa Spring 2013

GUJARAT TECHNOLOGICAL UNIVERSITY

CS415 Compilers. Intermediate Represeation & Code Generation

The Compiler So Far. Lexical analysis Detects inputs with illegal tokens. Overview of Semantic Analysis

Formal Languages and Compilers Lecture I: Introduction to Compilers

COMPILER CONSTRUCTION LAB 2 THE SYMBOL TABLE. Tutorial 2 LABS. PHASES OF A COMPILER Source Program. Lab 2 Symbol table

Chapter 2. Instructions:

Compilers Crash Course

Syntax/semantics. Program <> program execution Compiler/interpreter Syntax Grammars Syntax diagrams Automata/State Machines Scanning/Parsing

PSD1C SYSTEM SOFTWAE UNIT: I - V PSD1C SYSTEM SOFTWARE

CS453 Compiler Construction

Data Structures and Algorithms in Compiler Optimization. Comp314 Lecture Dave Peixotto

Acknowledgement. CS Compiler Design. Semantic Processing. Alternatives for semantic processing. Intro to Semantic Analysis. V.

5. Semantic Analysis. Mircea Lungu Oscar Nierstrasz


Transcription:

An Overview of Compilation (www.cse.iitb.ac.in/ uday) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay January 2014

cs306 Compilation Overview: Outline 1/18 Outline Introduction compilation sequence compilation models

Part 1 Introduction to Compilation

cs306 Compilation Overview: Introduction to Compilation 2/18 Binding Nothing is known except the problem No.of unbound objects Time

cs306 Compilation Overview: Introduction to Compilation 2/18 Binding Overall strategy, algorithm, data structures etc. No.of unbound objects Conceptualisation Time

cs306 Compilation Overview: Introduction to Compilation 2/18 Binding No.of unbound objects Functions, variables, their types etc. Conceptualisation Coding Time

cs306 Compilation Overview: Introduction to Compilation 2/18 Binding No.of unbound objects Machine instructions, registers etc. Conceptualisation Coding Compiling Time

cs306 Compilation Overview: Introduction to Compilation 2/18 Binding No.of unbound objects Addresses of functions, external data etc. Conceptualisation Coding Compiling Linking Time

cs306 Compilation Overview: Introduction to Compilation 2/18 Binding No.of unbound objects Actual addresses of code and data Conceptualisation Coding Compiling Linking Loading Time

cs306 Compilation Overview: Introduction to Compilation 2/18 Binding No.of unbound objects Values of variables Conceptualisation Coding Compiling Linking Loading Execution Time

cs306 Compilation Overview: Introduction to Compilation 2/18 Binding No.of unbound objects We will look at different binding times related to compiling Conceptualisation Coding Compiling Linking Loading Execution Time

cs306 Compilation Overview: Introduction to Compilation 3/18 Implementation Mechanisms Source Program Translator Target Program Machine

cs306 Compilation Overview: Introduction to Compilation 3/18 Implementation Mechanisms Source Program Translator Input Data Target Program Machine

cs306 Compilation Overview: Introduction to Compilation 3/18 Implementation Mechanisms Source Program Input Data Source Program Translator Target Program Machine Interpreter Machine

cs306 Compilation Overview: Introduction to Compilation 4/18 Implementation Mechanisms as Bridges Gap between the levels of program specification and execution Program Specification Machine

cs306 Compilation Overview: Introduction to Compilation 4/18 Implementation Mechanisms as Bridges Gap between the levels of program specification and execution Program Specification Translation Machine

cs306 Compilation Overview: Introduction to Compilation 4/18 Implementation Mechanisms as Bridges Gap between the levels of program specification and execution Program Specification Translation Interpretation Machine

cs306 Compilation Overview: Introduction to Compilation 4/18 Implementation Mechanisms as Bridges Gap between the levels of program specification and execution Program Specification State : Variables Operations: Expressions, Control Flow Translation Interpretation Machine State : Memory, Registers Operations: Machine Instructions

cs306 Compilation Overview: Introduction to Compilation 5/18 High and Low Level Abstractions Input C statement a = b<10?b:c; Spim Assembly Equivalent lw $t0, 4($fp) ; t0 <- b # Is b smaller slti $t0, $t0, 10 ; t0 <- t0 < 10 # than 10? not $t0, $t0 ; t0 <-!t0 bgtz $t0, L0: ; if t0>0 goto L0 lw $t0, 4($fp) ; t0 <- b # YES b L1: ; goto L1 L0: lw $t0, 8($fp) ;L0: t0 <- c # NO L1: sw 0($fp), $t0 ;L1: a <- t0

cs306 Compilation Overview: Introduction to Compilation 5/18 High and Low Level Abstractions Input C statement a = b<10?b:c; Spim Assembly Equivalent Conditional jump Condition False Part True Part Fall through lw $t0, 4($fp) ; t0 <- b # Is b smaller slti $t0, $t0, 10 ; t0 <- t0 < 10 # than 10? not $t0, $t0 ; t0 <-!t0 bgtz $t0, L0: ; if t0>0 goto L0 lw $t0, 4($fp) ; t0 <- b # YES b L1: ; goto L1 L0: lw $t0, 8($fp) ;L0: t0 <- c # NO L1: sw 0($fp), $t0 ;L1: a <- t0

cs306 Compilation Overview: Introduction to Compilation 5/18 High and Low Level Abstractions NOT Condition Input C statement a = b<10?b:c; Spim Assembly Equivalent True Part False Part lw $t0, 4($fp) ; t0 <- b # Is b smaller slti $t0, $t0, 10 ; t0 <- t0 < 10 # than 10? not $t0, $t0 ; t0 <-!t0 bgtz $t0, L0: ; if t0>0 goto L0 lw $t0, 4($fp) ; t0 <- b # YES b L1: ; goto L1 L0: lw $t0, 8($fp) ;L0: t0 <- c # NO L1: sw 0($fp), $t0 ;L1: a <- t0

cs306 Compilation Overview: Introduction to Compilation 5/18 High and Low Level Abstractions Input C statement a = b<10?b:c; Spim Assembly Equivalent Conditional jump NOT Condition True Part False Part Fall through lw $t0, 4($fp) ; t0 <- b # Is b smaller slti $t0, $t0, 10 ; t0 <- t0 < 10 # than 10? not $t0, $t0 ; t0 <-!t0 bgtz $t0, L0: ; if t0>0 goto L0 lw $t0, 4($fp) ; t0 <- b # YES b L1: ; goto L1 L0: lw $t0, 8($fp) ;L0: t0 <- c # NO L1: sw 0($fp), $t0 ;L1: a <- t0

cs306 Compilation Overview: Introduction to Compilation 6/18 Implementation Mechanisms Translation = Analysis + Synthesis Interpretation = Analysis + Execution

cs306 Compilation Overview: Introduction to Compilation 6/18 Implementation Mechanisms Translation = Analysis + Synthesis Interpretation = Analysis + Execution Translation Instructions Equivalent Instructions

cs306 Compilation Overview: Introduction to Compilation 6/18 Implementation Mechanisms Translation = Analysis + Synthesis Interpretation = Analysis + Execution Translation Instructions Equivalent Instructions Interpretation Instructions Actions Implied by Instructions

cs306 Compilation Overview: Introduction to Compilation 7/18 Language Implementation Models Synthesis Compilation Analysis Execution Interpretation

cs306 Compilation Overview: Introduction to Compilation 8/18 Language Processor Models Front End Optimizer Back End Virtual Machine C,C++ Java, C#

Part 2 An Overview of Compilation Phases

cs306 Compilation Overview: An Overview of Compilation Phases 9/18 The Structure of a Simple Compiler Parser Scanner Source Program Semantic Analyser Symtab Handler

cs306 Compilation Overview: An Overview of Compilation Phases 9/18 The Structure of a Simple Compiler Parser AST Instruction Selector Insn Assembly Emitter Scanner Semantic Analyser Symtab Handler Register Allocator Assembly Program Source Program

cs306 Compilation Overview: An Overview of Compilation Phases 9/18 The Structure of a Simple Compiler Front End Back End Parser AST Instruction Selector Insn Assembly Emitter Scanner Semantic Analyser Symtab Handler Register Allocator Assembly Program Source Program

cs306 Compilation Overview: An Overview of Compilation Phases 10/18 Translation Sequence in Our Compiler: Parsing a=b<10?b:c; Input

cs306 Compilation Overview: An Overview of Compilation Phases 10/18 Translation Sequence in Our Compiler: Parsing a=b<10?b:c; Input AsgnStmnt Lhs = E ; E? E : E E < E Issues: num Parse Tree Grammar rules, terminals, non-terminals Order of application of grammar rules eg. is it (a = b<10?) followed by (b:c)? Values of terminal symbols eg. string 10 vs. integer number 10.

cs306 Compilation Overview: An Overview of Compilation Phases 11/18 Translation Sequence in Our Compiler: Semantic Analysis a=b<10?b:c; Input AsgnStmnt Lhs = E ; E? E : E E < E num Parse Tree

cs306 Compilation Overview: An Overview of Compilation Phases 11/18 Translation Sequence in Our Compiler: Semantic Analysis a=b<10?b:c; Input AsgnStmnt Lhs = E ; (a,int) =?: (int) E < E E? E : E num Parse Tree < (bool) (b,int) (c,int) num (b,int) (10,int) Abstract Syntax Tree (with attributes) Issues: Symbol tables Have variables been declared? What are their types? What is their scope? Type consistency of operators and operands The result of computing b<10? is bool and not int

cs306 Compilation Overview: An Overview of Compilation Phases 12/18 Translation Sequence in Our Compiler: IR Generation a=b<10?b:c; Input AsgnStmnt Lhs = E E < E E? E : E num Parse Tree ; (a,int) = < (bool)?: (int) (b,int) (c,int) num (b,int) (10,int) Abstract Syntax Tree (with attributes)

cs306 Compilation Overview: An Overview of Compilation Phases 12/18 Translation Sequence in Our Compiler: IR Generation a=b<10?b:c; Input T 0 Tree List = Not < b 10 IfGoto T 0 = T 1 L0: T 1 L1: a Goto L1: = = L0: b c T 1 AsgnStmnt Lhs = E E < E Issues: E? E : E num Parse Tree ; (a,int) = < (bool)?: (int) (b,int) (c,int) num (b,int) (10,int) Abstract Syntax Tree (with attributes) Convert to maximal trees which can be implemented without altering control flow Simplifies instruction selection and scheduling, register allocation etc. Linearise control flow by flattening nested control constructs

cs306 Compilation Overview: An Overview of Compilation Phases 13/18 Translation Sequence in Our Compiler: Instruction Selection a=b<10?b:c; Input T 0 Tree List = Not < b 10 IfGoto T 0 = L0: AsgnStmnt Lhs = E E < E E? E : E num Parse Tree ; (a,int) = < (bool)?: (int) (b,int) (c,int) num (b,int) (10,int) Abstract Syntax Tree (with attributes) T 1 L0: T 1 L1: a Goto L1: = = b c T 1

cs306 Compilation Overview: An Overview of Compilation Phases 13/18 Translation Sequence in Our Compiler: Instruction Selection a=b<10?b:c; Input T 0 Tree List = Not < b 10 IfGoto T 0 = T 1 L0: T 1 L1: a Goto L1: = = L0: b c T 1 AsgnStmnt Lhs = E E < E E? E : E num Parse Tree ; Instruction List T 0 b T 0 T 0 < 10 T 0! T 0 if T 0 > 0 goto L0: T 1 b goto L1: L0: T 1 c L1: a T 1 Issues: (a,int) = < (bool)?: (int) (b,int) (c,int) num (b,int) (10,int) Abstract Syntax Tree (with attributes) Cover trees with as few machine instructions as possible Use temporaries and local registers

cs306 Compilation Overview: An Overview of Compilation Phases 13/18 Translation Sequence in Our Compiler: Instruction Selection a=b<10?b:c; Input T 0 Tree List = Not < b 10 IfGoto T 0 = T 1 L0: T 1 L1: a Goto L1: = = L0: b c T 1 AsgnStmnt Lhs = E E < E E? E : E num Parse Tree ; Instruction List T 0 b T 0 T 0 < 10 T 0! T 0 if T 0 > 0 goto L0: T 1 b goto L1: L0: T 1 c L1: a T 1 Issues: (a,int) = < (bool)?: (int) (b,int) (c,int) num (b,int) (10,int) Abstract Syntax Tree (with attributes) Cover trees with as few machine instructions as possible Use temporaries and local registers

cs306 Compilation Overview: An Overview of Compilation Phases 14/18 Translation Sequence in Our Compiler: Emitting Instructions a=b<10?b:c; Input T 0 Tree List = Not < b 10 IfGoto T 0 = T 1 L0: T 1 L1: a Goto L1: = = L0: b c T 1 AsgnStmnt Lhs = E E < E E? E : E num Parse Tree ; Instruction List T 0 b T 0 T 0 < 10 T 0! T 0 if T 0 > 0 goto L0: T 1 b goto L1: L0: T 1 c L1: a T 1 (a,int) = < (bool)?: (int) (b,int) (c,int) num (b,int) (10,int) Abstract Syntax Tree (with attributes)

cs306 Compilation Overview: An Overview of Compilation Phases 14/18 Translation Sequence in Our Compiler: Emitting Instructions a=b<10?b:c; Input T 0 Tree List = Not < b 10 IfGoto T 0 = T 1 L0: T 1 L1: a Goto L1: = = L0: b c T 1 AsgnStmnt Lhs Issues: = E Offsets E of? E variables : E in the stack frame E < E Actual register numbers andnum assembly mnemonics Code Parseto Tree construct and discard activation records Instruction List T 0 b T 0 T 0 < 10 T 0! T 0 if T 0 > 0 goto L0: T 1 b goto L1: L0: T 1 c L1: a T 1 ; (a,int) = < (bool)?: (int) (b,int) (c,int) num (b,int) (10,int) Abstract Syntax Tree (with attributes) Assembly Code lw $t0, 4($fp) slti $t0, $t0, 10 not $t0, $t0 bgtz $t0, L0: lw $t0, 4($fp) b L1: L0: lw $t0, 8($fp) L1: sw 0($fp), $t0

Part 3 Compilation Models

cs306 Compilation Overview: Compilation Models 15/18 Aho Ullman Model Compilation Models Davidson Fraser Model

cs306 Compilation Overview: Compilation Models 15/18 Aho Ullman Model Front End Compilation Models Input Source Program Davidson Fraser Model AST

cs306 Compilation Overview: Compilation Models 15/18 Aho Ullman Model Front End Compilation Models Input Source Program Davidson Fraser Model AST Optimizer Target Indep. IR

cs306 Compilation Overview: Compilation Models 15/18 Aho Ullman Model Front End Compilation Models Input Source Program Davidson Fraser Model AST Optimizer Target Indep. IR Code Generator Target Program

cs306 Compilation Overview: Compilation Models 15/18 Aho Ullman Model Front End Compilation Models Input Source Program Davidson Fraser Model Front End AST AST Optimizer Target Indep. IR Code Generator Target Program

cs306 Compilation Overview: Compilation Models 15/18 Aho Ullman Model Front End Compilation Models Input Source Program Davidson Fraser Model Front End AST Optimizer Target Indep. IR AST Expander Register Transfers Code Generator Target Program

cs306 Compilation Overview: Compilation Models 15/18 Aho Ullman Model Front End Compilation Models Input Source Program Davidson Fraser Model Front End AST Optimizer Target Indep. IR Code Generator AST Expander Register Transfers Optimizer Register Transfers Target Program

cs306 Compilation Overview: Compilation Models 15/18 Aho Ullman Model Front End Compilation Models Input Source Program Davidson Fraser Model Front End AST Optimizer Target Indep. IR Code Generator Target Program AST Expander Register Transfers Optimizer Register Transfers Recognizer Target Program

cs306 Compilation Overview: Compilation Models 15/18 Aho Ullman Model Front End AST Optimizer Target Indep. IR Code Generator Target Program Compilation Models Aho Ullman: Instruction selection over optimized IR using cost based tree tiling matching Davidson Fraser: Instruction selection over AST using simple full tree matching based algorithms that generate naive code which is target dependent, and is optimized subsequently Davidson Fraser Model Front End AST Expander Register Transfers Optimizer Register Transfers Recognizer Target Program

cs306 Compilation Overview: Compilation Models 16/18 Typical Front Ends Parser

cs306 Compilation Overview: Compilation Models 16/18 Typical Front Ends Source Program Parser Tokens Scanner

cs306 Compilation Overview: Compilation Models 16/18 Typical Front Ends Source Program Scanner Tokens Parser Parse Tree AST AST or Linear IR + Symbol Table Semantic Analyzer

cs306 Compilation Overview: Compilation Models 16/18 Typical Front Ends Source Program Scanner Tokens Parser Parse Tree AST AST or Linear IR + Symbol Table Semantic Analyzer Symtab Handler Error Handler

cs306 Compilation Overview: Compilation Models 17/18 Typical Back Ends in Aho Ullman Model m/c Ind. IR m/c Ind. Optimizer m/c Ind. IR Compile time evaluations Eliminating redundant computations

cs306 Compilation Overview: Compilation Models 17/18 Typical Back Ends in Aho Ullman Model m/c Ind. IR m/c Ind. Optimizer m/c Ind. IR Code Generator m/c Dep. IR Compile time evaluations Eliminating redundant computations Instruction Selection Local Reg Allocation Choice of Order of Evaluation

cs306 Compilation Overview: Compilation Models 17/18 Typical Back Ends in Aho Ullman Model m/c Ind. IR m/c Ind. Optimizer m/c Ind. IR Code Generator m/c Dep. IR m/c Dep. Optimizer Compile time evaluations Eliminating redundant computations Instruction Selection Local Reg Allocation Choice of Order of Evaluation Assembly Code

cs306 Compilation Overview: Compilation Models 17/18 Typical Back Ends in Aho Ullman Model m/c Ind. IR Register Allocator m/c Ind. Optimizer m/c Ind. IR Code Generator m/c Dep. IR Instruction Scheduler Compile time evaluations Eliminating redundant computations Instruction Selection Local Reg Allocation Choice of Order of Evaluation Peephole Optimizer Assembly Code

cs306 Compilation Overview: Compilation Models 18/18 Retargetability in Aho Ullman and Davidson Fraser Models Instruction Selection Aho Ullman Model Davidson Fraser Model Machine independent IR is expressed in the form of trees Machine instructions are described in the form of trees Trees in the IR are covered using the instruction trees Optimization

cs306 Compilation Overview: Compilation Models 18/18 Retargetability in Aho Ullman and Davidson Fraser Models Instruction Selection Aho Ullman Model Davidson Fraser Model Machine independent IR is expressed in the form of trees Machine instructions are described in the form of trees Trees in the IR are covered using the instruction trees Cost based tree pattern matching Optimization

cs306 Compilation Overview: Compilation Models 18/18 Retargetability in Aho Ullman and Davidson Fraser Models Instruction Selection Aho Ullman Model Davidson Fraser Model Machine independent IR is expressed in the form of trees Machine instructions are described in the form of trees Trees in the IR are covered using the instruction trees Cost based tree pattern Structural tree pattern matching matching Optimization

cs306 Compilation Overview: Compilation Models 18/18 Retargetability in Aho Ullman and Davidson Fraser Models Instruction Selection Aho Ullman Model Davidson Fraser Model Machine independent IR is expressed in the form of trees Machine instructions are described in the form of trees Trees in the IR are covered using the instruction trees Cost based tree pattern Structural tree pattern matching matching Optimization Machine independent

cs306 Compilation Overview: Compilation Models 18/18 Retargetability in Aho Ullman and Davidson Fraser Models Instruction Selection Aho Ullman Model Davidson Fraser Model Machine independent IR is expressed in the form of trees Machine instructions are described in the form of trees Trees in the IR are covered using the instruction trees Cost based tree pattern Structural tree pattern matching matching Machine dependent Optimization Machine independent

cs306 Compilation Overview: Compilation Models 18/18 Retargetability in Aho Ullman and Davidson Fraser Models Instruction Selection Aho Ullman Model Davidson Fraser Model Machine independent IR is expressed in the form of trees Machine instructions are described in the form of trees Trees in the IR are covered using the instruction trees Cost based tree pattern Structural tree pattern matching matching Machine dependent Optimization Machine independent Key Insight: Register transfers are target specific but their form is target independent