SlideShare a Scribd company logo
1 of 11
Bangladesh University
Department of Computer Science & Engineering
Subject: Compiler Design
Course code: CSE-3201
Issues in The Design of Code Generator
Presented By:
 Md. Sabbir Hossen
Id: 202011056022
 Md. Saiduzzaman Sojib Id:
202011056021
 Taslima Patwary Id:
202011056028
Submitted To:
 Md Nazim Uddin
Lecturer,
Department of CSE
Bangladesh University
Tuesday, March 14, 2023
©All Right Reserved by Sabbir Hossen
Code Generator
 Code generator converts the intermediate representation of the source
program and produces as output an equivalent program.
 Code generator received optimized code from code optimizer and convert
into a expected assembly code.
 Its not necessary that code generator always will accept optimized code, it
also can accept 3 address codes from intermediate code generator.
 The final phase in compiler model is the code generator.
 Designing of the code generator should be done in such a way so that it
can be easily implemented, tested and maintained.
Tuesday, March 14, 2023
©All Right Reserved by Sabbir Hossen
2
Lets have a look at the position of a Code generator
During this operation some issues arise which will be discussed further.
Tuesday, March 14, 2023
©All Right Reserved by Sabbir Hossen
3
Intermediate Code
Generator
Code Optimizer Target Code
Generator
Symbol table
3 address code
Intermediate
representation
Target Program
Figure 1: Position of Code Generator
The following issues arise during code generation
Tuesday, March 14, 2023
©All Right Reserved by Sabbir Hossen
4
Code
Generator
Register
Allocation
Issue
Target Program
Input to code
generator
Instruction
Selection Issue
Evaluation
Order
Memory
Management
Input to Code Generator
 Input to code generator is nothing but you will get the intermediate code.
 Intermediate code will be look like linear representation like:
* Postfix Expression
* Three Address Code
* DAG (Directed Acyclic Graph)
* Prior to Code Generation
 Make sure the input is free of errors by performing the type checking.
Tuesday, March 14, 2023
©All Right Reserved by Sabbir Hossen
5
Target Program
 Target program is nothing but output. The output may be in many forms like:
* Absolute Machine Language
* Relocatable Machine Language
* Assembly Language
 Absolute machine language as an output has advantage that is can be placed in a fixed
memory location and can be immediately executed.
 Relocatable object files which are used linkers.
 Assembly language facilities the debuggers. We can generate symbolic instructions and use
macro facilities of assembler is generating code.
Tuesday, March 14, 2023
©All Right Reserved by Sabbir Hossen
6
Compiler
Source Program Target Program
Memory Management
 The mapping names in the square program to address of data object is done by the front end
and back end also.
 So, here everything the information stored in the symbol table. Symbol table here consisting of
relative address. Whenever the backend it calls just take. The information and place into symbol
table. So, with the help of the relative address it find out variable in the symbol table and
execute the operation.
Tuesday, March 14, 2023
©All Right Reserved by Sabbir Hossen
7
Source Program
Back End
Mapping
Symbol Table
Front End
Instruction Selection Issue
 The code generator takes intermediate representation as input and convert into target machine
instruction set.
 To choose an appropriate instruction its responsibility for code generator.
 The quality of the generated code determined by its speed and size.
 The former statement can be translated into the letter statement as shown below.
Tuesday, March 14, 2023
©All Right Reserved by Sabbir Hossen
8
𝒕𝟏 = 𝒊𝒅𝟑 ∗ 60.0
𝒊𝒅𝟏= 𝒊𝒅𝟐 + 𝒕𝟏
Target Code Generator
LD 𝑹𝟏, 𝒊𝒅𝟑
MUL 𝑹𝟏, 𝑹𝟏, #60.0
𝑹𝟐 𝒊𝒅𝟐
𝑹𝟐 𝑹𝟐 + 𝑹𝟏
LD 𝑹𝟐, 𝒊𝒅𝟐
ADD 𝑹𝟐, 𝑹𝟐, 𝑹𝟏
ST 𝒊𝒅𝟏, 𝑹𝟐
𝑹𝟏 𝒊𝒅𝟑
𝑹𝟏 𝑹𝟏, * 60.0
Register Allocation Issue
 Register is faster than memory element which hold operand in a expression for some short
period of time.
 The use of registers are subdivided into two subproblems:
Register Allocation – The set of variables that will reside the registers at a point in the
program is selected.
Register Assignment – The specific register that a value picked.
 Certain machine requires even-odd register pairs for some operands and results.
For Example:
 This types of multiplicative instruction involve register pairs where ‘a’ the multiplicand is an
even register and ‘b’ the multiplier is the odd register of even-odd register pair.
Tuesday, March 14, 2023
©All Right Reserved by Sabbir Hossen
9
M a, b
Evaluation Order
 The order in which computations are performed can effect the efficiency of the target code.
 When instructions are independent their evaluation order can be change.
 When reorder the statements number of TAG (Three Address Code) statements remain same
but converted assembly code statements can reduce or increase.
Tuesday, March 14, 2023
©All Right Reserved by Sabbir Hossen
10
Have you any Questions?
Feel Free to Ask.
THANKYOU
Tuesday, March 14, 2023
©All Right Reserved by Sabbir Hossen
11

More Related Content

Similar to Issues in the Design of a Code Generator.pptx

Lesson 26. Optimization of 64-bit programs
Lesson 26. Optimization of 64-bit programsLesson 26. Optimization of 64-bit programs
Lesson 26. Optimization of 64-bit programsPVS-Studio
 
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer KitAmit Kumer Podder
 
01 surya bpc_script_ppt
01 surya bpc_script_ppt01 surya bpc_script_ppt
01 surya bpc_script_pptSurya Padhi
 
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
 
unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfDrIsikoIsaac
 
Intermediate Representation in Compiler Construction
Intermediate Representation in Compiler ConstructionIntermediate Representation in Compiler Construction
Intermediate Representation in Compiler Constructiontheizm1
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programmingMakerere university
 
IRJET- Generation of HTML Code using Machine Learning Techniques from Mock-Up...
IRJET- Generation of HTML Code using Machine Learning Techniques from Mock-Up...IRJET- Generation of HTML Code using Machine Learning Techniques from Mock-Up...
IRJET- Generation of HTML Code using Machine Learning Techniques from Mock-Up...IRJET Journal
 
IRJET- Designing of OCR Tool Box for Decoding Vehicle Number Plate using MATLAB
IRJET- Designing of OCR Tool Box for Decoding Vehicle Number Plate using MATLABIRJET- Designing of OCR Tool Box for Decoding Vehicle Number Plate using MATLAB
IRJET- Designing of OCR Tool Box for Decoding Vehicle Number Plate using MATLABIRJET Journal
 
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
 
Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03desta_gebre
 
What is SObjectizer 5.7 (at v.5.7.0)
What is SObjectizer 5.7 (at v.5.7.0)What is SObjectizer 5.7 (at v.5.7.0)
What is SObjectizer 5.7 (at v.5.7.0)Yauheni Akhotnikau
 
IRJET - Code Compiler Shell
IRJET -  	  Code Compiler ShellIRJET -  	  Code Compiler Shell
IRJET - Code Compiler ShellIRJET Journal
 
MIGHTY MACROS AND POWERFUL PARAMETERS: MAXIMIZING EFFICIENCY AND FLEXIBILITY ...
MIGHTY MACROS AND POWERFUL PARAMETERS: MAXIMIZING EFFICIENCY AND FLEXIBILITY ...MIGHTY MACROS AND POWERFUL PARAMETERS: MAXIMIZING EFFICIENCY AND FLEXIBILITY ...
MIGHTY MACROS AND POWERFUL PARAMETERS: MAXIMIZING EFFICIENCY AND FLEXIBILITY ...VLSICS Design
 
Interview with Anatoliy Kuznetsov, the author of BitMagic C++ library
Interview with Anatoliy Kuznetsov, the author of BitMagic C++ libraryInterview with Anatoliy Kuznetsov, the author of BitMagic C++ library
Interview with Anatoliy Kuznetsov, the author of BitMagic C++ libraryPVS-Studio
 

Similar to Issues in the Design of a Code Generator.pptx (20)

Lesson 26. Optimization of 64-bit programs
Lesson 26. Optimization of 64-bit programsLesson 26. Optimization of 64-bit programs
Lesson 26. Optimization of 64-bit programs
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
 
01 surya bpc_script_ppt
01 surya bpc_script_ppt01 surya bpc_script_ppt
01 surya bpc_script_ppt
 
Loaders
LoadersLoaders
Loaders
 
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
 
unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdf
 
Intermediate Representation in Compiler Construction
Intermediate Representation in Compiler ConstructionIntermediate Representation in Compiler Construction
Intermediate Representation in Compiler Construction
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programming
 
IRJET- Generation of HTML Code using Machine Learning Techniques from Mock-Up...
IRJET- Generation of HTML Code using Machine Learning Techniques from Mock-Up...IRJET- Generation of HTML Code using Machine Learning Techniques from Mock-Up...
IRJET- Generation of HTML Code using Machine Learning Techniques from Mock-Up...
 
IRJET- Designing of OCR Tool Box for Decoding Vehicle Number Plate using MATLAB
IRJET- Designing of OCR Tool Box for Decoding Vehicle Number Plate using MATLABIRJET- Designing of OCR Tool Box for Decoding Vehicle Number Plate using MATLAB
IRJET- Designing of OCR Tool Box for Decoding Vehicle Number Plate using MATLAB
 
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
 
Vedic Calculator
Vedic CalculatorVedic Calculator
Vedic Calculator
 
Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03
 
What is SObjectizer 5.7 (at v.5.7.0)
What is SObjectizer 5.7 (at v.5.7.0)What is SObjectizer 5.7 (at v.5.7.0)
What is SObjectizer 5.7 (at v.5.7.0)
 
IRJET - Code Compiler Shell
IRJET -  	  Code Compiler ShellIRJET -  	  Code Compiler Shell
IRJET - Code Compiler Shell
 
Org-&-Arch-2.ppt
Org-&-Arch-2.pptOrg-&-Arch-2.ppt
Org-&-Arch-2.ppt
 
Paper Publication
Paper PublicationPaper Publication
Paper Publication
 
MIGHTY MACROS AND POWERFUL PARAMETERS: MAXIMIZING EFFICIENCY AND FLEXIBILITY ...
MIGHTY MACROS AND POWERFUL PARAMETERS: MAXIMIZING EFFICIENCY AND FLEXIBILITY ...MIGHTY MACROS AND POWERFUL PARAMETERS: MAXIMIZING EFFICIENCY AND FLEXIBILITY ...
MIGHTY MACROS AND POWERFUL PARAMETERS: MAXIMIZING EFFICIENCY AND FLEXIBILITY ...
 
Interview with Anatoliy Kuznetsov, the author of BitMagic C++ library
Interview with Anatoliy Kuznetsov, the author of BitMagic C++ libraryInterview with Anatoliy Kuznetsov, the author of BitMagic C++ library
Interview with Anatoliy Kuznetsov, the author of BitMagic C++ library
 

Recently uploaded

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Recently uploaded (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

Issues in the Design of a Code Generator.pptx

  • 1. Bangladesh University Department of Computer Science & Engineering Subject: Compiler Design Course code: CSE-3201 Issues in The Design of Code Generator Presented By:  Md. Sabbir Hossen Id: 202011056022  Md. Saiduzzaman Sojib Id: 202011056021  Taslima Patwary Id: 202011056028 Submitted To:  Md Nazim Uddin Lecturer, Department of CSE Bangladesh University Tuesday, March 14, 2023 ©All Right Reserved by Sabbir Hossen
  • 2. Code Generator  Code generator converts the intermediate representation of the source program and produces as output an equivalent program.  Code generator received optimized code from code optimizer and convert into a expected assembly code.  Its not necessary that code generator always will accept optimized code, it also can accept 3 address codes from intermediate code generator.  The final phase in compiler model is the code generator.  Designing of the code generator should be done in such a way so that it can be easily implemented, tested and maintained. Tuesday, March 14, 2023 ©All Right Reserved by Sabbir Hossen 2
  • 3. Lets have a look at the position of a Code generator During this operation some issues arise which will be discussed further. Tuesday, March 14, 2023 ©All Right Reserved by Sabbir Hossen 3 Intermediate Code Generator Code Optimizer Target Code Generator Symbol table 3 address code Intermediate representation Target Program Figure 1: Position of Code Generator
  • 4. The following issues arise during code generation Tuesday, March 14, 2023 ©All Right Reserved by Sabbir Hossen 4 Code Generator Register Allocation Issue Target Program Input to code generator Instruction Selection Issue Evaluation Order Memory Management
  • 5. Input to Code Generator  Input to code generator is nothing but you will get the intermediate code.  Intermediate code will be look like linear representation like: * Postfix Expression * Three Address Code * DAG (Directed Acyclic Graph) * Prior to Code Generation  Make sure the input is free of errors by performing the type checking. Tuesday, March 14, 2023 ©All Right Reserved by Sabbir Hossen 5
  • 6. Target Program  Target program is nothing but output. The output may be in many forms like: * Absolute Machine Language * Relocatable Machine Language * Assembly Language  Absolute machine language as an output has advantage that is can be placed in a fixed memory location and can be immediately executed.  Relocatable object files which are used linkers.  Assembly language facilities the debuggers. We can generate symbolic instructions and use macro facilities of assembler is generating code. Tuesday, March 14, 2023 ©All Right Reserved by Sabbir Hossen 6 Compiler Source Program Target Program
  • 7. Memory Management  The mapping names in the square program to address of data object is done by the front end and back end also.  So, here everything the information stored in the symbol table. Symbol table here consisting of relative address. Whenever the backend it calls just take. The information and place into symbol table. So, with the help of the relative address it find out variable in the symbol table and execute the operation. Tuesday, March 14, 2023 ©All Right Reserved by Sabbir Hossen 7 Source Program Back End Mapping Symbol Table Front End
  • 8. Instruction Selection Issue  The code generator takes intermediate representation as input and convert into target machine instruction set.  To choose an appropriate instruction its responsibility for code generator.  The quality of the generated code determined by its speed and size.  The former statement can be translated into the letter statement as shown below. Tuesday, March 14, 2023 ©All Right Reserved by Sabbir Hossen 8 𝒕𝟏 = 𝒊𝒅𝟑 ∗ 60.0 𝒊𝒅𝟏= 𝒊𝒅𝟐 + 𝒕𝟏 Target Code Generator LD 𝑹𝟏, 𝒊𝒅𝟑 MUL 𝑹𝟏, 𝑹𝟏, #60.0 𝑹𝟐 𝒊𝒅𝟐 𝑹𝟐 𝑹𝟐 + 𝑹𝟏 LD 𝑹𝟐, 𝒊𝒅𝟐 ADD 𝑹𝟐, 𝑹𝟐, 𝑹𝟏 ST 𝒊𝒅𝟏, 𝑹𝟐 𝑹𝟏 𝒊𝒅𝟑 𝑹𝟏 𝑹𝟏, * 60.0
  • 9. Register Allocation Issue  Register is faster than memory element which hold operand in a expression for some short period of time.  The use of registers are subdivided into two subproblems: Register Allocation – The set of variables that will reside the registers at a point in the program is selected. Register Assignment – The specific register that a value picked.  Certain machine requires even-odd register pairs for some operands and results. For Example:  This types of multiplicative instruction involve register pairs where ‘a’ the multiplicand is an even register and ‘b’ the multiplier is the odd register of even-odd register pair. Tuesday, March 14, 2023 ©All Right Reserved by Sabbir Hossen 9 M a, b
  • 10. Evaluation Order  The order in which computations are performed can effect the efficiency of the target code.  When instructions are independent their evaluation order can be change.  When reorder the statements number of TAG (Three Address Code) statements remain same but converted assembly code statements can reduce or increase. Tuesday, March 14, 2023 ©All Right Reserved by Sabbir Hossen 10
  • 11. Have you any Questions? Feel Free to Ask. THANKYOU Tuesday, March 14, 2023 ©All Right Reserved by Sabbir Hossen 11