SlideShare a Scribd company logo
1 of 21
RESHMA R
AP/CSE/FOE
Compiler Design
Outline
 Scope of the course
 Disciplines involved in it
 Abstract view for a compiler
 Front-end and back-end tasks
Course scope
 Aim:
 To learn techniques of a modern compiler
 Main reference:
 Compilers – Principles, Techniques and Tools, Second
Edition by Alfred V. Aho, Ravi Sethi, Jeffery D. Ullman
 Supplementary references:
 Modern compiler construction in Java 2nd edition
 Advanced Compiler Design and Implementation by
Muchnick
Sub Modules
 Lexical analysis (Scanning)
 Syntax Analysis (Parsing)
 Syntax Directed Translation
 Intermediate Code Generation
 Run-time environments
 Code Generation
 Machine Independent Optimization
Compiler learning
 Isn’t it an old discipline?
 Yes, it is a well-established discipline
 Algorithms, methods and techniques are researched and
developed in early stages of computer science growth
 There are many compilers around and many tools to
generate them automatically
 So, why we need to learn it?
 Although you may never write a full compiler
 But the techniques we learn is useful in many tasks like
writing an interpreter for a scripting language, validation
checking for forms and so on
Terminology
 Compiler:
 a program that translates an executable program in one
language into an executable program in another language
 we expect the program produced by the compiler to be
better, in some way, than the original
 Interpreter:
 a program that reads an executable program and
produces the results of running that program
 usually, this involves executing the source program in
some fashion
 Our course is mainly about compilers but many of
the same issues arise in interpreters
Disciplines involved
 Algorithms
 Languages and machines
 Operating systems
 Computer architectures
Abstract view
 Recognizes legal (and illegal) programs
 Generate correct code
 Manage storage of all variables and code
 Agreement on format for object (or assembly)
code
Compiler
Source
code
Machine
code
errors
Front-end, Back-end division
 Front end maps legal code into IR
 Back end maps IR onto target machine
 Simplify retargeting
 Allows multiple front ends
 Multiple passes -> better code
Front end
Source
code
Machine
code
errors
IR
Back end
Front end
 Recognize legal code
 Report errors
 Produce IR
 Preliminary storage maps
Scanner
Source
code
IR
errors
tokens
Parser
Front end
 Scanner:
 Maps characters into tokens – the basic unit of
syntax
 x = x + y becomes <id, x> = <id, x> + <id, y>
 Typical tokens: number, id, +, -, *, /, do, end
 Eliminate white space (tabs, blanks, comments)
 A key issue is speed so instead of using a tool
like LEX it sometimes needed to write your
own scanner
Scanner
Source
code
IR
errors
tokens
Parser
Front end
 Parser:
 Recognize context-free syntax
 Guide context-sensitive analysis
 Construct IR
 Produce meaningful error messages
 Attempt error correction
 There are parser generators like YACC which
automates much of the work
Scanner
Source
code
IR
errors
tokens
Parser
Front end
 Context free grammars are used to represent
programming language syntaxes:
<expr> ::= <expr> <op> <term> | <term>
<term> ::= <number> | <id>
<op> ::= + | -
Front end
 A parser tries to map a
program to the syntactic
elements defined in the
grammar
 A parse can be represented
by a tree called a parse or
syntax tree
Front end
 A parse tree can be
represented more compactly
referred to as Abstract
Syntax Tree (AST)
 AST is often used as IR
between front end and back
end
Back end
 Translate IR into target machine code
 Choose instructions for each IR operation
 Decide what to keep in registers at each point
 Ensure conformance with system interfaces
Instruction
selection
IR
Machine code
errors
Register
Allocation
Back end
 Produce compact fast code
 Use available addressing modes
Instruction
selection
IR
Machine code
errors
Register
Allocation
Back end
 Have a value in a register when used
 Limited resources
 Optimal allocation is difficult
Instruction
selection
IR
Machine code
errors
Register
Allocation
Traditional three pass compiler
 Code improvement analyzes and change IR
 Goal is to reduce runtime
Front end
Source
code
Machine
code
errors
IR
Back end
Middle
end
IR
Middle end (optimizer)
 Modern optimizers are usually built as a set of passes
 Typical passes
 Constant propagation
 Common sub-expression elimination
 Redundant store elimination
 Dead code elimination
01. Introduction.ppt

More Related Content

Similar to 01. Introduction.ppt

Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfDrIsikoIsaac
 
Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to ProgrammingChaffey College
 
COMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxCOMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxRossy719186
 
Computer and programing basics.pptx
Computer and programing basics.pptxComputer and programing basics.pptx
Computer and programing basics.pptxgaafergoda
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and developmentAli Raza
 
Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic conceptsAbdul Khan
 
Lecture1 compilers
Lecture1 compilersLecture1 compilers
Lecture1 compilersAftab Ahmad
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processorsRebaz Najeeb
 
Language translators
Language translatorsLanguage translators
Language translatorsAditya Sharat
 
SSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdfSSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdfJacobDragonette
 
Lecture 10 software development
Lecture 10 software developmentLecture 10 software development
Lecture 10 software developmentJehanzaib Yousuf
 
compiler construction tool in computer science .
compiler construction tool in computer science .compiler construction tool in computer science .
compiler construction tool in computer science .RanitHalder
 

Similar to 01. Introduction.ppt (20)

Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdf
 
Compilers
CompilersCompilers
Compilers
 
Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to Programming
 
COMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxCOMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptx
 
Computer and programing basics.pptx
Computer and programing basics.pptxComputer and programing basics.pptx
Computer and programing basics.pptx
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and development
 
Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic concepts
 
1._Introduction_.pptx
1._Introduction_.pptx1._Introduction_.pptx
1._Introduction_.pptx
 
Lecture1 compilers
Lecture1 compilersLecture1 compilers
Lecture1 compilers
 
df
dfdf
df
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Language translators
Language translatorsLanguage translators
Language translators
 
SS UI Lecture 1
SS UI Lecture 1SS UI Lecture 1
SS UI Lecture 1
 
Ss ui lecture 1
Ss ui lecture 1Ss ui lecture 1
Ss ui lecture 1
 
SSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdfSSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdf
 
UNIT 2 ECSE-2.pptx
UNIT 2 ECSE-2.pptxUNIT 2 ECSE-2.pptx
UNIT 2 ECSE-2.pptx
 
Lecture 10 software development
Lecture 10 software developmentLecture 10 software development
Lecture 10 software development
 
Compiler Design Material
Compiler Design MaterialCompiler Design Material
Compiler Design Material
 
compiler construction tool in computer science .
compiler construction tool in computer science .compiler construction tool in computer science .
compiler construction tool in computer science .
 

Recently uploaded

VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 

01. Introduction.ppt

  • 2. Outline  Scope of the course  Disciplines involved in it  Abstract view for a compiler  Front-end and back-end tasks
  • 3. Course scope  Aim:  To learn techniques of a modern compiler  Main reference:  Compilers – Principles, Techniques and Tools, Second Edition by Alfred V. Aho, Ravi Sethi, Jeffery D. Ullman  Supplementary references:  Modern compiler construction in Java 2nd edition  Advanced Compiler Design and Implementation by Muchnick
  • 4. Sub Modules  Lexical analysis (Scanning)  Syntax Analysis (Parsing)  Syntax Directed Translation  Intermediate Code Generation  Run-time environments  Code Generation  Machine Independent Optimization
  • 5. Compiler learning  Isn’t it an old discipline?  Yes, it is a well-established discipline  Algorithms, methods and techniques are researched and developed in early stages of computer science growth  There are many compilers around and many tools to generate them automatically  So, why we need to learn it?  Although you may never write a full compiler  But the techniques we learn is useful in many tasks like writing an interpreter for a scripting language, validation checking for forms and so on
  • 6. Terminology  Compiler:  a program that translates an executable program in one language into an executable program in another language  we expect the program produced by the compiler to be better, in some way, than the original  Interpreter:  a program that reads an executable program and produces the results of running that program  usually, this involves executing the source program in some fashion  Our course is mainly about compilers but many of the same issues arise in interpreters
  • 7. Disciplines involved  Algorithms  Languages and machines  Operating systems  Computer architectures
  • 8. Abstract view  Recognizes legal (and illegal) programs  Generate correct code  Manage storage of all variables and code  Agreement on format for object (or assembly) code Compiler Source code Machine code errors
  • 9. Front-end, Back-end division  Front end maps legal code into IR  Back end maps IR onto target machine  Simplify retargeting  Allows multiple front ends  Multiple passes -> better code Front end Source code Machine code errors IR Back end
  • 10. Front end  Recognize legal code  Report errors  Produce IR  Preliminary storage maps Scanner Source code IR errors tokens Parser
  • 11. Front end  Scanner:  Maps characters into tokens – the basic unit of syntax  x = x + y becomes <id, x> = <id, x> + <id, y>  Typical tokens: number, id, +, -, *, /, do, end  Eliminate white space (tabs, blanks, comments)  A key issue is speed so instead of using a tool like LEX it sometimes needed to write your own scanner Scanner Source code IR errors tokens Parser
  • 12. Front end  Parser:  Recognize context-free syntax  Guide context-sensitive analysis  Construct IR  Produce meaningful error messages  Attempt error correction  There are parser generators like YACC which automates much of the work Scanner Source code IR errors tokens Parser
  • 13. Front end  Context free grammars are used to represent programming language syntaxes: <expr> ::= <expr> <op> <term> | <term> <term> ::= <number> | <id> <op> ::= + | -
  • 14. Front end  A parser tries to map a program to the syntactic elements defined in the grammar  A parse can be represented by a tree called a parse or syntax tree
  • 15. Front end  A parse tree can be represented more compactly referred to as Abstract Syntax Tree (AST)  AST is often used as IR between front end and back end
  • 16. Back end  Translate IR into target machine code  Choose instructions for each IR operation  Decide what to keep in registers at each point  Ensure conformance with system interfaces Instruction selection IR Machine code errors Register Allocation
  • 17. Back end  Produce compact fast code  Use available addressing modes Instruction selection IR Machine code errors Register Allocation
  • 18. Back end  Have a value in a register when used  Limited resources  Optimal allocation is difficult Instruction selection IR Machine code errors Register Allocation
  • 19. Traditional three pass compiler  Code improvement analyzes and change IR  Goal is to reduce runtime Front end Source code Machine code errors IR Back end Middle end IR
  • 20. Middle end (optimizer)  Modern optimizers are usually built as a set of passes  Typical passes  Constant propagation  Common sub-expression elimination  Redundant store elimination  Dead code elimination