SlideShare a Scribd company logo
1 of 19
Presented by,
M.Selva Vinitha
B.E/CSE
M.Kumarasamy college of engineering
Karur.
Code generator
 Final phase of compiler design
 Optimized intermediate code is provided as input
 It generates target code
2/27/2015 2Issues in design of code generator
Code generation and Instruction Selection
4
Symbol
table
input output
Front
end
Intermediate
Code
generator
Code
generator
2/27/2015 Issues in design of code generator
Contd…
 output code must be correct
 output code must be of high quality
 code generator should run efficiently
2/27/2015 4Issues in design of code generator
Pre-requisites
 Instruction set of target machine.
 Instruction addressing modes.
 No. of registers.
 Configuration of ALU
2/27/2015 5Issues in design of code generator
Issues in the design of a code
generator
 Input to the code generator
 Memory management
 Target programs
 Instruction selection
 Register allocation
 Evaluation order
 Approaches to code generation
2/27/2015 6Issues in design of code generator
Input to the code generator
 The intermediate representation of the source program
produced by the front end
 Several choices for the intermediate language
 Linear - postfix nottion
 3 address - quadruples
 Virtual machie - stack machine code
 Graphical - syntax tree &dags
2/27/2015 7Issues in design of code generator
Memory management
 Mapping names in the source program to addresses of data
objects in run-time memory
 Done by the front end and the code generator.
 A name in a three- address statement refers to a symbol-
table entry for the name.
 A relative address can be determined
2/27/2015 8Issues in design of code generator
Target programs
 Absolute machine language
Relocatable machine language
 Assembly language
2/27/2015 9Issues in design of code generator
Contd..
Absolute machine language:
 Produce an absolute machine language program
 can be placed in a fixed location in memory and
immediately executed.
2/27/2015 10Issues in design of code generator
Contd..
Relocatable machine language:
Producing a relocatable machine language program
subprograms to be compiled separately.
relocatable object modules can be linked together and loaded
for execution by a linking loader.
must provide explicit relocation information to the loader, to
link the separately compiled program segments.
2/27/2015 11Issues in design of code generator
Contd…
Assembly language:
Producing an assembly language program
makes the process of code generation easier
2/27/2015 12Issues in design of code generator
Instruction selection
The factors to be considered during instruction selection are:
 The uniformity and completeness of the instruction set.
 Instruction speed and machine idioms.
 Size of the instruction set.
2/27/2015 13Issues in design of code generator
Contd…
Eg., for the following address code is:
a := b + c
d := a + e
inefficient assembly code is:
MOV b, R0 R0 ← b
ADD c, R0 R0 ← c + R0
MOV R0, a a ← R0
MOV a, R0 R0 ← a
ADD e, R0 R0 ← e + R0
MOV R0 , d d ← R0
Here the fourth statement is redundant, and so is the third
statement if ,
'a' is not subsequently used.
2/27/2015 14Issues in design of code generator
Register allocation
• Instructions with register operands are usually shorter and
faster
• Efficient utilization of registers is important in
generating good code.
2/27/2015 15Issues in design of code generator
Contd..
Register allocation phase:
• Select the set of variables that will reside in registers
Register assignment phase:
• Pick the specific register that a variable will reside in.
2/27/2015 16Issues in design of code generator
Evaluation order
 The order in which computations are performed
 Affect the efficiency of the target code.
 Some computation orders require fewer registers to hold
intermediate results
2/27/2015 17Issues in design of code generator
Approaches to code generation
 Most important criteria for code generator is that it
produces correct code
 Correctness takes on special signification
 It contains a straightforward code generation algorithm
 The output of such code generator can be improved by
peephole optimization technique
2/27/2015 18Issues in design of code generator
Conclusion
Output of code generator phase is dependent on:
 Target language
 Operating system
 Memory management system
 Instruction selection
 Register allocation
 Evaluation order
2/27/2015 19Issues in design of code generator

More Related Content

What's hot

Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)swapnac12
 
Register allocation and assignment
Register allocation and assignmentRegister allocation and assignment
Register allocation and assignmentKarthi Keyan
 
Type checking in compiler design
Type checking in compiler designType checking in compiler design
Type checking in compiler designSudip Singh
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler DesignShine Raj
 
Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)   Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design) Tasif Tanzim
 
Substitution techniques
Substitution techniquesSubstitution techniques
Substitution techniquesvinitha96
 
Translation of expression(copmiler construction)
Translation of expression(copmiler construction)Translation of expression(copmiler construction)
Translation of expression(copmiler construction)IrtazaAfzal3
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingArvind Kumar
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translationAkshaya Arunan
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysisDattatray Gandhmal
 
Message Authentication Code & HMAC
Message Authentication Code & HMACMessage Authentication Code & HMAC
Message Authentication Code & HMACKrishna Gehlot
 

What's hot (20)

Recognition-of-tokens
Recognition-of-tokensRecognition-of-tokens
Recognition-of-tokens
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Compiler Design Unit 4
Compiler Design Unit 4Compiler Design Unit 4
Compiler Design Unit 4
 
Register allocation and assignment
Register allocation and assignmentRegister allocation and assignment
Register allocation and assignment
 
Type checking in compiler design
Type checking in compiler designType checking in compiler design
Type checking in compiler design
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler Design
 
Role-of-lexical-analysis
Role-of-lexical-analysisRole-of-lexical-analysis
Role-of-lexical-analysis
 
Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)   Intermediate code generation (Compiler Design)
Intermediate code generation (Compiler Design)
 
Loop optimization
Loop optimizationLoop optimization
Loop optimization
 
Daa notes 3
Daa notes 3Daa notes 3
Daa notes 3
 
Code generation
Code generationCode generation
Code generation
 
Substitution techniques
Substitution techniquesSubstitution techniques
Substitution techniques
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
 
Translation of expression(copmiler construction)
Translation of expression(copmiler construction)Translation of expression(copmiler construction)
Translation of expression(copmiler construction)
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translation
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
 
Types of Parser
Types of ParserTypes of Parser
Types of Parser
 
Message Authentication Code & HMAC
Message Authentication Code & HMACMessage Authentication Code & HMAC
Message Authentication Code & HMAC
 

Similar to Issues in design_of_code_generator

issuesindesignofcodegenerator-150227091230-conversion-gate01
issuesindesignofcodegenerator-150227091230-conversion-gate01issuesindesignofcodegenerator-150227091230-conversion-gate01
issuesindesignofcodegenerator-150227091230-conversion-gate01vinithapanneer
 
IRJET- Build a Secure Web based Code Editor for C Programming Language
IRJET-  	  Build a Secure Web based Code Editor for C Programming LanguageIRJET-  	  Build a Secure Web based Code Editor for C Programming Language
IRJET- Build a Secure Web based Code Editor for C Programming LanguageIRJET Journal
 
Review Paper on Online Java Compiler
Review Paper on Online Java CompilerReview Paper on Online Java Compiler
Review Paper on Online Java CompilerIRJET Journal
 
Reversing and Patching Machine Code
Reversing and Patching Machine CodeReversing and Patching Machine Code
Reversing and Patching Machine CodeTeodoro Cipresso
 
UrbanCode Deploy course and product overview slides
UrbanCode Deploy course and product overview slidesUrbanCode Deploy course and product overview slides
UrbanCode Deploy course and product overview slidesIBM Rational software
 
Ch 1.pptx
Ch 1.pptxCh 1.pptx
Ch 1.pptxwoldu2
 
MongoDB World 2019: Building Flexible and Secure Customer Applications with M...
MongoDB World 2019: Building Flexible and Secure Customer Applications with M...MongoDB World 2019: Building Flexible and Secure Customer Applications with M...
MongoDB World 2019: Building Flexible and Secure Customer Applications with M...MongoDB
 
Rhapsody Software
Rhapsody SoftwareRhapsody Software
Rhapsody SoftwareBill Duncan
 
DAVE: Free development platform for XMC code generation
DAVE: Free development platform for XMC code generationDAVE: Free development platform for XMC code generation
DAVE: Free development platform for XMC code generationInfineon4Engineers
 
UNIT-III EMBEDDED FIRMWARE DESIGNEmbedded Firmware design
UNIT-III  EMBEDDED FIRMWARE DESIGNEmbedded Firmware designUNIT-III  EMBEDDED FIRMWARE DESIGNEmbedded Firmware design
UNIT-III EMBEDDED FIRMWARE DESIGNEmbedded Firmware designSattiBabu16
 
Leveraging REST APIs for Infrastructure Management using FME
Leveraging REST APIs for Infrastructure Management using FMELeveraging REST APIs for Infrastructure Management using FME
Leveraging REST APIs for Infrastructure Management using FMESafe Software
 
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDE
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDESAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDE
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDEMarkus Van Kempen
 
Auto conversion of serial C code to CUDA code
Auto conversion of serial C code to CUDA codeAuto conversion of serial C code to CUDA code
Auto conversion of serial C code to CUDA codeIRJET Journal
 
GPCE16: Automatic Non-functional Testing of Code Generators Families
GPCE16: Automatic Non-functional Testing of Code Generators FamiliesGPCE16: Automatic Non-functional Testing of Code Generators Families
GPCE16: Automatic Non-functional Testing of Code Generators FamiliesMohamed BOUSSAA
 

Similar to Issues in design_of_code_generator (20)

issuesindesignofcodegenerator-150227091230-conversion-gate01
issuesindesignofcodegenerator-150227091230-conversion-gate01issuesindesignofcodegenerator-150227091230-conversion-gate01
issuesindesignofcodegenerator-150227091230-conversion-gate01
 
IRJET- Build a Secure Web based Code Editor for C Programming Language
IRJET-  	  Build a Secure Web based Code Editor for C Programming LanguageIRJET-  	  Build a Secure Web based Code Editor for C Programming Language
IRJET- Build a Secure Web based Code Editor for C Programming Language
 
Review Paper on Online Java Compiler
Review Paper on Online Java CompilerReview Paper on Online Java Compiler
Review Paper on Online Java Compiler
 
Reversing and Patching Machine Code
Reversing and Patching Machine CodeReversing and Patching Machine Code
Reversing and Patching Machine Code
 
SW_Cost_Estimation.ppt
SW_Cost_Estimation.pptSW_Cost_Estimation.ppt
SW_Cost_Estimation.ppt
 
Overview
OverviewOverview
Overview
 
Dalvik jit
Dalvik jitDalvik jit
Dalvik jit
 
UrbanCode Deploy course and product overview slides
UrbanCode Deploy course and product overview slidesUrbanCode Deploy course and product overview slides
UrbanCode Deploy course and product overview slides
 
Chap01-Intro.ppt
Chap01-Intro.pptChap01-Intro.ppt
Chap01-Intro.ppt
 
Ch 1.pptx
Ch 1.pptxCh 1.pptx
Ch 1.pptx
 
Compiler design
Compiler designCompiler design
Compiler design
 
MongoDB World 2019: Building Flexible and Secure Customer Applications with M...
MongoDB World 2019: Building Flexible and Secure Customer Applications with M...MongoDB World 2019: Building Flexible and Secure Customer Applications with M...
MongoDB World 2019: Building Flexible and Secure Customer Applications with M...
 
Rhapsody Software
Rhapsody SoftwareRhapsody Software
Rhapsody Software
 
DAVE: Free development platform for XMC code generation
DAVE: Free development platform for XMC code generationDAVE: Free development platform for XMC code generation
DAVE: Free development platform for XMC code generation
 
UNIT-III EMBEDDED FIRMWARE DESIGNEmbedded Firmware design
UNIT-III  EMBEDDED FIRMWARE DESIGNEmbedded Firmware designUNIT-III  EMBEDDED FIRMWARE DESIGNEmbedded Firmware design
UNIT-III EMBEDDED FIRMWARE DESIGNEmbedded Firmware design
 
Leveraging REST APIs for Infrastructure Management using FME
Leveraging REST APIs for Infrastructure Management using FMELeveraging REST APIs for Infrastructure Management using FME
Leveraging REST APIs for Infrastructure Management using FME
 
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDE
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDESAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDE
SAPTechED 2015 UX114 -Building custom SAP Fiori Apps Using SAP Web IDE
 
Auto conversion of serial C code to CUDA code
Auto conversion of serial C code to CUDA codeAuto conversion of serial C code to CUDA code
Auto conversion of serial C code to CUDA code
 
GPCE16: Automatic Non-functional Testing of Code Generators Families
GPCE16: Automatic Non-functional Testing of Code Generators FamiliesGPCE16: Automatic Non-functional Testing of Code Generators Families
GPCE16: Automatic Non-functional Testing of Code Generators Families
 
2.1.design center
2.1.design center2.1.design center
2.1.design center
 

Recently uploaded

Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 

Recently uploaded (20)

Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 

Issues in design_of_code_generator

  • 2. Code generator  Final phase of compiler design  Optimized intermediate code is provided as input  It generates target code 2/27/2015 2Issues in design of code generator
  • 3. Code generation and Instruction Selection 4 Symbol table input output Front end Intermediate Code generator Code generator 2/27/2015 Issues in design of code generator
  • 4. Contd…  output code must be correct  output code must be of high quality  code generator should run efficiently 2/27/2015 4Issues in design of code generator
  • 5. Pre-requisites  Instruction set of target machine.  Instruction addressing modes.  No. of registers.  Configuration of ALU 2/27/2015 5Issues in design of code generator
  • 6. Issues in the design of a code generator  Input to the code generator  Memory management  Target programs  Instruction selection  Register allocation  Evaluation order  Approaches to code generation 2/27/2015 6Issues in design of code generator
  • 7. Input to the code generator  The intermediate representation of the source program produced by the front end  Several choices for the intermediate language  Linear - postfix nottion  3 address - quadruples  Virtual machie - stack machine code  Graphical - syntax tree &dags 2/27/2015 7Issues in design of code generator
  • 8. Memory management  Mapping names in the source program to addresses of data objects in run-time memory  Done by the front end and the code generator.  A name in a three- address statement refers to a symbol- table entry for the name.  A relative address can be determined 2/27/2015 8Issues in design of code generator
  • 9. Target programs  Absolute machine language Relocatable machine language  Assembly language 2/27/2015 9Issues in design of code generator
  • 10. Contd.. Absolute machine language:  Produce an absolute machine language program  can be placed in a fixed location in memory and immediately executed. 2/27/2015 10Issues in design of code generator
  • 11. Contd.. Relocatable machine language: Producing a relocatable machine language program subprograms to be compiled separately. relocatable object modules can be linked together and loaded for execution by a linking loader. must provide explicit relocation information to the loader, to link the separately compiled program segments. 2/27/2015 11Issues in design of code generator
  • 12. Contd… Assembly language: Producing an assembly language program makes the process of code generation easier 2/27/2015 12Issues in design of code generator
  • 13. Instruction selection The factors to be considered during instruction selection are:  The uniformity and completeness of the instruction set.  Instruction speed and machine idioms.  Size of the instruction set. 2/27/2015 13Issues in design of code generator
  • 14. Contd… Eg., for the following address code is: a := b + c d := a + e inefficient assembly code is: MOV b, R0 R0 ← b ADD c, R0 R0 ← c + R0 MOV R0, a a ← R0 MOV a, R0 R0 ← a ADD e, R0 R0 ← e + R0 MOV R0 , d d ← R0 Here the fourth statement is redundant, and so is the third statement if , 'a' is not subsequently used. 2/27/2015 14Issues in design of code generator
  • 15. Register allocation • Instructions with register operands are usually shorter and faster • Efficient utilization of registers is important in generating good code. 2/27/2015 15Issues in design of code generator
  • 16. Contd.. Register allocation phase: • Select the set of variables that will reside in registers Register assignment phase: • Pick the specific register that a variable will reside in. 2/27/2015 16Issues in design of code generator
  • 17. Evaluation order  The order in which computations are performed  Affect the efficiency of the target code.  Some computation orders require fewer registers to hold intermediate results 2/27/2015 17Issues in design of code generator
  • 18. Approaches to code generation  Most important criteria for code generator is that it produces correct code  Correctness takes on special signification  It contains a straightforward code generation algorithm  The output of such code generator can be improved by peephole optimization technique 2/27/2015 18Issues in design of code generator
  • 19. Conclusion Output of code generator phase is dependent on:  Target language  Operating system  Memory management system  Instruction selection  Register allocation  Evaluation order 2/27/2015 19Issues in design of code generator