SlideShare a Scribd company logo
1 of 10
Three Adress Code
Generation
Presented by:
Rabin BK
CONTENTS
01
02
03
INTRODUCTION
TYPES
EXAMPLE
04 REFERENCES
INTRODUCTION
● An intermediate code (machine independent code) used by the optimizing
compilers
● A sequence of statements of the general form x = y op z
● where x, y, z are names, constants
● op stands for any operator (such as fixed or floating point arithmetic
operator or a logical operator on boolean valued data)
● Eliminates the need of a new full compiler for every unique machine by
keeping the analysis portion same for all the compilers.
● Assumes to have unlimited number of memory storage (register) to
generate code
TYPES OF 3 ADDRESS STATEMENTS
● Assignment statements
– Having the form x := y op z
– op --> binary arithmetic or logical operation
● Assignment Instructions
– Having the form x := op y
– op --> unary operation (unary plus, unary minus shift etc)
● Copy statements
● Having the form x := y
TYPES OF 3 ADDRESS STATEMENTS CONTD...
● Unconditional (Jump goto L)
– The three address statement with label L is the next to be executed
● Conditional Jumps (such as if x relop y goto L)
– applies a relational operator (<,>,<=,>=) to x and y
– if (condition satisfied) { execute the statement with label L } else {
execute the statement following, if x relop y goto L }
TYPES OF 3 ADDRESS STATEMENTS CONTD...
● param x and call p, n
– Used for procedure calls and return y(represents returned value)
– generated as a part of the three address code for call of the
procedure p(x1,x2,x3,....xn) where n are the number of variables
being sent to the procedure
param x1
param x2
.
.
param xn
call p,n
TYPES OF 3 ADDRESS STATEMENTS CONTD...
● Indexed copy instructions
x = y[i]
x[i] = y
● Address and pointer assignments
x = &y
x = *y
*x = y
EXAMPLE
if (a < b + c)
a = a - c;
c = b * c;
_t1 = b + c;
_t2 = a < _t1;
If Z _t2 Goto _L0;
_t3 = a - c;
a = _t3;
_L0: _t4 = b * c;
c = _t4;
int foo(int a, int b){
return a + b;
}
void main() {
int c;
int d;
foo(c, d);
}
foo:
BeginFunc 4;
_t0 = a + b;
Return _t0;
EndFunc;
main:
BeginFunc 12;
PushParam d;
PushParam c;
_t1 = LCall _foo;
PopParams 8;
EndFunc;
Number of bytes
for a function
Stack operation
REFERENCES
● https://web.stanford.edu/class/archive/cs/cs143/cs143.1128/handouts/24
0%20TAC%20Examples.pdf
● https://web.stanford.edu/class/archive/cs/cs143/cs143.1128/lectures/13/S
lides13.pdf
● https://www.tutorialspoint.com/compiler_design/compiler_design_interme
diate_code_generations.htm
● https://www.javatpoint.com/three-address-code
● http://cic.puj.edu.co/wiki/lib/exe/fetch.php?media=materias:compi:comp_
sesion21_aux1.pdf
QUERIES

More Related Content

What's hot

Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translationAkshaya Arunan
 
02. chapter 3 lexical analysis
02. chapter 3   lexical analysis02. chapter 3   lexical analysis
02. chapter 3 lexical analysisraosir123
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler designKuppusamy P
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generationrawan_z
 
Top down parsering and bottom up parsering.pptx
Top down parsering and bottom up parsering.pptxTop down parsering and bottom up parsering.pptx
Top down parsering and bottom up parsering.pptxLaibaFaisal3
 
Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignKuppusamy P
 
Chapter 6 intermediate code generation
Chapter 6   intermediate code generationChapter 6   intermediate code generation
Chapter 6 intermediate code generationVipul Naik
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & RecoveryAkhil Kaushik
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1Shashwat Shriparv
 
Chapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata TheoryChapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata TheoryTsegazeab Asgedom
 
Type checking in compiler design
Type checking in compiler designType checking in compiler design
Type checking in compiler designSudip Singh
 
Basic blocks - compiler design
Basic blocks - compiler designBasic blocks - compiler design
Basic blocks - compiler designhmnasim15
 

What's hot (20)

Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translation
 
02. chapter 3 lexical analysis
02. chapter 3   lexical analysis02. chapter 3   lexical analysis
02. chapter 3 lexical analysis
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Dataflow Analysis
Dataflow AnalysisDataflow Analysis
Dataflow Analysis
 
Top down parsering and bottom up parsering.pptx
Top down parsering and bottom up parsering.pptxTop down parsering and bottom up parsering.pptx
Top down parsering and bottom up parsering.pptx
 
Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler Design
 
Huffman coding
Huffman coding Huffman coding
Huffman coding
 
Pass Structure of Assembler
Pass Structure of AssemblerPass Structure of Assembler
Pass Structure of Assembler
 
Chapter 6 intermediate code generation
Chapter 6   intermediate code generationChapter 6   intermediate code generation
Chapter 6 intermediate code generation
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & Recovery
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1
 
Chapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata TheoryChapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata Theory
 
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
 
Input-Buffering
Input-BufferingInput-Buffering
Input-Buffering
 
Basic blocks - compiler design
Basic blocks - compiler designBasic blocks - compiler design
Basic blocks - compiler design
 
COMPILER DESIGN- Syntax Directed Translation
COMPILER DESIGN- Syntax Directed TranslationCOMPILER DESIGN- Syntax Directed Translation
COMPILER DESIGN- Syntax Directed Translation
 

Similar to Three address code generation

14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...venkatapranaykumarGa
 
Compiler chapter six .ppt course material
Compiler chapter six .ppt course materialCompiler chapter six .ppt course material
Compiler chapter six .ppt course materialgadisaAdamu
 
Chapter Eight(2)
Chapter Eight(2)Chapter Eight(2)
Chapter Eight(2)bolovv
 
Chapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdfChapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdfRAnwarpasha
 
Intermediate code representations
Intermediate code representationsIntermediate code representations
Intermediate code representationsahmed51236
 
Lecture 1- Python.pptxjhhhfdzdfdggcfffff
Lecture 1- Python.pptxjhhhfdzdfdggcfffffLecture 1- Python.pptxjhhhfdzdfdggcfffff
Lecture 1- Python.pptxjhhhfdzdfdggcfffffShivanyaGarg
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialTo Sum It Up
 
Lecture#6 functions in c++
Lecture#6 functions in c++Lecture#6 functions in c++
Lecture#6 functions in c++NUST Stuff
 
Programming fundamentals 2:pointers in c++ clearly explained
Programming fundamentals 2:pointers in c++ clearly explainedProgramming fundamentals 2:pointers in c++ clearly explained
Programming fundamentals 2:pointers in c++ clearly explainedhozaifafadl
 
Chapter Eight(1)
Chapter Eight(1)Chapter Eight(1)
Chapter Eight(1)bolovv
 
Lecture 2 coal sping12
Lecture 2 coal sping12Lecture 2 coal sping12
Lecture 2 coal sping12Rabia Khalid
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction FormatDhrumil Panchal
 
07-MIPS-Functions.pptx COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE
07-MIPS-Functions.pptx COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE07-MIPS-Functions.pptx COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE
07-MIPS-Functions.pptx COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGEMuhammadUmarAwanCSIT
 

Similar to Three address code generation (20)

14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
 
Chapter 6 Intermediate Code Generation
Chapter 6   Intermediate Code GenerationChapter 6   Intermediate Code Generation
Chapter 6 Intermediate Code Generation
 
Compiler notes--unit-iii
Compiler notes--unit-iiiCompiler notes--unit-iii
Compiler notes--unit-iii
 
Assignment12
Assignment12Assignment12
Assignment12
 
Interm codegen
Interm codegenInterm codegen
Interm codegen
 
Compiler chapter six .ppt course material
Compiler chapter six .ppt course materialCompiler chapter six .ppt course material
Compiler chapter six .ppt course material
 
Chapter Eight(2)
Chapter Eight(2)Chapter Eight(2)
Chapter Eight(2)
 
Chapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdfChapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdf
 
Intermediate code representations
Intermediate code representationsIntermediate code representations
Intermediate code representations
 
Lecture 1- Python.pptxjhhhfdzdfdggcfffff
Lecture 1- Python.pptxjhhhfdzdfdggcfffffLecture 1- Python.pptxjhhhfdzdfdggcfffff
Lecture 1- Python.pptxjhhhfdzdfdggcfffff
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study material
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
Lecture#6 functions in c++
Lecture#6 functions in c++Lecture#6 functions in c++
Lecture#6 functions in c++
 
Programming fundamentals 2:pointers in c++ clearly explained
Programming fundamentals 2:pointers in c++ clearly explainedProgramming fundamentals 2:pointers in c++ clearly explained
Programming fundamentals 2:pointers in c++ clearly explained
 
Unit iv(simple code generator)
Unit iv(simple code generator)Unit iv(simple code generator)
Unit iv(simple code generator)
 
Chapter Eight(1)
Chapter Eight(1)Chapter Eight(1)
Chapter Eight(1)
 
Lecture 2 coal sping12
Lecture 2 coal sping12Lecture 2 coal sping12
Lecture 2 coal sping12
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction Format
 
UNIT-3.pptx
UNIT-3.pptxUNIT-3.pptx
UNIT-3.pptx
 
07-MIPS-Functions.pptx COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE
07-MIPS-Functions.pptx COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE07-MIPS-Functions.pptx COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE
07-MIPS-Functions.pptx COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE
 

More from Rabin BK

Artificial Intelligence in E-commerce
Artificial Intelligence in E-commerceArtificial Intelligence in E-commerce
Artificial Intelligence in E-commerceRabin BK
 
Consumer Oriented Application, Mercantile process and Mercantile models
Consumer Oriented Application, Mercantile process and Mercantile modelsConsumer Oriented Application, Mercantile process and Mercantile models
Consumer Oriented Application, Mercantile process and Mercantile modelsRabin BK
 
Clang compiler `
Clang compiler `Clang compiler `
Clang compiler `Rabin BK
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer ProtocolRabin BK
 
HTML text formatting tags
HTML text formatting tagsHTML text formatting tags
HTML text formatting tagsRabin BK
 
Data encryption in database management system
Data encryption in database management systemData encryption in database management system
Data encryption in database management systemRabin BK
 
Object Relational Database Management System(ORDBMS)
Object Relational Database Management System(ORDBMS)Object Relational Database Management System(ORDBMS)
Object Relational Database Management System(ORDBMS)Rabin BK
 
Kolmogorov Smirnov
Kolmogorov SmirnovKolmogorov Smirnov
Kolmogorov SmirnovRabin BK
 
Job sequencing in Data Strcture
Job sequencing in Data StrctureJob sequencing in Data Strcture
Job sequencing in Data StrctureRabin BK
 
Stack Data Structure
Stack Data StructureStack Data Structure
Stack Data StructureRabin BK
 
Data Science
Data ScienceData Science
Data ScienceRabin BK
 
Graphics_3D viewing
Graphics_3D viewingGraphics_3D viewing
Graphics_3D viewingRabin BK
 
Neural Netwrok
Neural NetwrokNeural Netwrok
Neural NetwrokRabin BK
 
Watermarking in digital images
Watermarking in digital imagesWatermarking in digital images
Watermarking in digital imagesRabin BK
 
Heun's Method
Heun's MethodHeun's Method
Heun's MethodRabin BK
 
Mutual Exclusion
Mutual ExclusionMutual Exclusion
Mutual ExclusionRabin BK
 
Systems Usage
Systems UsageSystems Usage
Systems UsageRabin BK
 
Manager of a company
Manager of a companyManager of a company
Manager of a companyRabin BK
 
Profile of Organizations
Profile of OrganizationsProfile of Organizations
Profile of OrganizationsRabin BK
 

More from Rabin BK (20)

Artificial Intelligence in E-commerce
Artificial Intelligence in E-commerceArtificial Intelligence in E-commerce
Artificial Intelligence in E-commerce
 
Consumer Oriented Application, Mercantile process and Mercantile models
Consumer Oriented Application, Mercantile process and Mercantile modelsConsumer Oriented Application, Mercantile process and Mercantile models
Consumer Oriented Application, Mercantile process and Mercantile models
 
Clang compiler `
Clang compiler `Clang compiler `
Clang compiler `
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer Protocol
 
HTML text formatting tags
HTML text formatting tagsHTML text formatting tags
HTML text formatting tags
 
Data encryption in database management system
Data encryption in database management systemData encryption in database management system
Data encryption in database management system
 
Object Relational Database Management System(ORDBMS)
Object Relational Database Management System(ORDBMS)Object Relational Database Management System(ORDBMS)
Object Relational Database Management System(ORDBMS)
 
Kolmogorov Smirnov
Kolmogorov SmirnovKolmogorov Smirnov
Kolmogorov Smirnov
 
Job sequencing in Data Strcture
Job sequencing in Data StrctureJob sequencing in Data Strcture
Job sequencing in Data Strcture
 
Stack Data Structure
Stack Data StructureStack Data Structure
Stack Data Structure
 
Bluetooth
BluetoothBluetooth
Bluetooth
 
Data Science
Data ScienceData Science
Data Science
 
Graphics_3D viewing
Graphics_3D viewingGraphics_3D viewing
Graphics_3D viewing
 
Neural Netwrok
Neural NetwrokNeural Netwrok
Neural Netwrok
 
Watermarking in digital images
Watermarking in digital imagesWatermarking in digital images
Watermarking in digital images
 
Heun's Method
Heun's MethodHeun's Method
Heun's Method
 
Mutual Exclusion
Mutual ExclusionMutual Exclusion
Mutual Exclusion
 
Systems Usage
Systems UsageSystems Usage
Systems Usage
 
Manager of a company
Manager of a companyManager of a company
Manager of a company
 
Profile of Organizations
Profile of OrganizationsProfile of Organizations
Profile of Organizations
 

Recently uploaded

Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 

Recently uploaded (20)

Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 

Three address code generation

  • 3. INTRODUCTION ● An intermediate code (machine independent code) used by the optimizing compilers ● A sequence of statements of the general form x = y op z ● where x, y, z are names, constants ● op stands for any operator (such as fixed or floating point arithmetic operator or a logical operator on boolean valued data) ● Eliminates the need of a new full compiler for every unique machine by keeping the analysis portion same for all the compilers. ● Assumes to have unlimited number of memory storage (register) to generate code
  • 4. TYPES OF 3 ADDRESS STATEMENTS ● Assignment statements – Having the form x := y op z – op --> binary arithmetic or logical operation ● Assignment Instructions – Having the form x := op y – op --> unary operation (unary plus, unary minus shift etc) ● Copy statements ● Having the form x := y
  • 5. TYPES OF 3 ADDRESS STATEMENTS CONTD... ● Unconditional (Jump goto L) – The three address statement with label L is the next to be executed ● Conditional Jumps (such as if x relop y goto L) – applies a relational operator (<,>,<=,>=) to x and y – if (condition satisfied) { execute the statement with label L } else { execute the statement following, if x relop y goto L }
  • 6. TYPES OF 3 ADDRESS STATEMENTS CONTD... ● param x and call p, n – Used for procedure calls and return y(represents returned value) – generated as a part of the three address code for call of the procedure p(x1,x2,x3,....xn) where n are the number of variables being sent to the procedure param x1 param x2 . . param xn call p,n
  • 7. TYPES OF 3 ADDRESS STATEMENTS CONTD... ● Indexed copy instructions x = y[i] x[i] = y ● Address and pointer assignments x = &y x = *y *x = y
  • 8. EXAMPLE if (a < b + c) a = a - c; c = b * c; _t1 = b + c; _t2 = a < _t1; If Z _t2 Goto _L0; _t3 = a - c; a = _t3; _L0: _t4 = b * c; c = _t4; int foo(int a, int b){ return a + b; } void main() { int c; int d; foo(c, d); } foo: BeginFunc 4; _t0 = a + b; Return _t0; EndFunc; main: BeginFunc 12; PushParam d; PushParam c; _t1 = LCall _foo; PopParams 8; EndFunc; Number of bytes for a function Stack operation
  • 9. REFERENCES ● https://web.stanford.edu/class/archive/cs/cs143/cs143.1128/handouts/24 0%20TAC%20Examples.pdf ● https://web.stanford.edu/class/archive/cs/cs143/cs143.1128/lectures/13/S lides13.pdf ● https://www.tutorialspoint.com/compiler_design/compiler_design_interme diate_code_generations.htm ● https://www.javatpoint.com/three-address-code ● http://cic.puj.edu.co/wiki/lib/exe/fetch.php?media=materias:compi:comp_ sesion21_aux1.pdf