SlideShare a Scribd company logo
Compiler Optimization
Speaker :呂宗螢
Adviser :梁文耀 老師
Date : 2006/10/11
Embedded and Parallel Systems Lab2
The Structure of Recent
Front end per
language
High-level
optimizations
Global optimizer
Code generator
Intermediate
representation
Dependencies Function
Language Dependent machine
independent
Transform language to
common intermediate form
Largely machine independent For example, procedure
inlineing (also called
procedure intergration)
Small language dependencies
machine dependencies slight
(e.g., register count/types)
Including global and local
optimizations + register
allocation
Highly machine dependent
Language independent
Detailed instruction selection
and machine-dependent
optimizations
May include or be followed
by assembler
Embedded and Parallel Systems Lab3
Major types of optimizations
Embedded and Parallel Systems Lab4
Procedure integration
 Replace procedure call by procedure body
Int a;
void up(){
a=a+1;
}
Void main(){
a=10;
up();
b=a+5;
}
Int a;
Void main(){
a=10;
a=a+1;
b=a+5;
}
Embedded and Parallel Systems Lab5
Common subexpression elimination
 Replace two instances of same
computation by single copy
a = b * c + g;
d = b * c * d;
tmp = b * c;
a = tmp + g;
d = tmp * d;
Embedded and Parallel Systems Lab6
Constant propagation
 Replace all instances of a variable that is
assigned a constant with the constant
int x = 14;
int y = 7 - x / 2;
return y * (28 / x + 2);
int x = 14;
int y = 7 - 14 / 2;
return y * (28 / 14 +
2);
int x = 14;
int y = 0;
return y * 4;
Embedded and Parallel Systems Lab7
Stack height reduction
 Rearrange expression tree to minimize resources needed for
expression evaluation
ADD R6,R2,R3
ADD R7,R6,R4
ADD R8,R7,R5
ADD R6,R2,R3
ADD R7,R4,R5
ADD R8,R7,R6
I1
I2
I3
I1 I2
I3
R8=((R2+R3)+R4)+R5 R8=(R2+R3)+(R4+R5)
Embedded and Parallel Systems Lab8
Copy propagation
 Replace all instances of a variable A that
has been assigned X (i.e., A = X) with X
y = x ;
z = 3 + y;
z = 3 + x
Embedded and Parallel Systems Lab9
Code motion
 Remove code from a loop that computes
same value each iteration of the loop
 Loop-invariant code
while (j < maximum - 1) {
x=1;
j = j + 4 * a;
}
int maxval = maximum - 1;
int calcval = 4 * a;
x=1;
while (j < maxval) {
j = j + calcval;
}
Embedded and Parallel Systems Lab10
Induction variable elimination
 Simplify / eliminate array addressing
calculations within loops
Int i=0;
while( i<10){
i=i+1;
p = 4*i ;
do some things;
}
Int p=0;
while( p<40){
p=p+4;
do some things;
}
Embedded and Parallel Systems Lab11
Strength reduction
 Such as , replace multiply by constant
with adds and shifts
for (i=0 ; i<n ; i++){
z = i * x;
do some things;
}
for (i=0 ; i<n ; i++){
z = z + x;
do some things;
}
Embedded and Parallel Systems Lab12
Branch offset optimization
 Choose the shortest branch displacement
that reaches target
if( a ){
statement 1
}
else {
goto L1;
}
statement 2
L1:
statement 3
if( !a ){
goto L1;
}
statement 1
statement 2
L1:
statement 3
Embedded and Parallel Systems Lab13
dead (unreachable) code elimination
 Remove instructions that will not affect the
behavior of the program.
Int func( int a){
int b, c;
b=a*2;
c=a*3;
return b;
}
Int func( int a){
int b, c;
b=a*2;
return b;
}
Embedded and Parallel Systems Lab14
Boolean Expression
If( a=0 || b=0 || c=0) {
statement 1;
}
If( a=0) {
statement 1;
}else if( b=0){
statement 1;
}else if( c=0){
statement 1;
}
Embedded and Parallel Systems Lab15
Loop unrolling
int i;
for (i = 0; i < 5; i++){
function(i);
}
function(0);
function(1);
function(2);
function(3);
function(4);
 Duplicates the body of the loop multiple times, in order to decrease
the number of times the loop condition is tested and the number of
jumps, which hurt performance by impairing the instruction pipeline
Embedded and Parallel Systems Lab16
 Thanks

More Related Content

What's hot (20)

Logical micro-operations
Logical micro-operationsLogical micro-operations
Logical micro-operations
VATSAL TRIVEDI
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processing
Kamal Acharya
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptx
SKUP1
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
Kuppusamy P
 
5 STM32's TIMER.ppt
5 STM32's TIMER.ppt5 STM32's TIMER.ppt
5 STM32's TIMER.ppt
MdRayhanTanvir
 
Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture
S. Hasnain Raza
 
Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)
guest251d9a
 
Code generation
Code generationCode generation
Code generation
Aparna Nayak
 
Register transfer language
Register transfer languageRegister transfer language
Register transfer language
Sanjeev Patel
 
Arithmetic micro operations
Arithmetic micro operationsArithmetic micro operations
Arithmetic micro operations
lavanya marichamy
 
8085 lab
8085 lab8085 lab
8085 lab
Nithin Mohan
 
Function C++
Function C++ Function C++
Function C++
Shahzad Afridi
 
Pipelining , structural hazards
Pipelining , structural hazardsPipelining , structural hazards
Pipelining , structural hazards
Munaam Munawar
 
Cs6503 theory of computation november december 2015 be cse anna university q...
Cs6503 theory of computation november december 2015  be cse anna university q...Cs6503 theory of computation november december 2015  be cse anna university q...
Cs6503 theory of computation november december 2015 be cse anna university q...
appasami
 
Embedded C - Lecture 1
Embedded C - Lecture 1Embedded C - Lecture 1
Embedded C - Lecture 1
Mohamed Abdallah
 
compiler ppt on symbol table
 compiler ppt on symbol table compiler ppt on symbol table
compiler ppt on symbol table
nadarmispapaulraj
 
Unit 1 intro-embedded
Unit 1 intro-embeddedUnit 1 intro-embedded
Unit 1 intro-embedded
Pavithra S
 
Diagnostic in Adaptive AUTOSAR
Diagnostic in Adaptive AUTOSARDiagnostic in Adaptive AUTOSAR
Diagnostic in Adaptive AUTOSAR
Bernhard Wagner
 
Expression and Operartor In C Programming
Expression and Operartor In C Programming Expression and Operartor In C Programming
Expression and Operartor In C Programming
Kamal Acharya
 
RECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSINGRECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSING
Jothi Lakshmi
 
Logical micro-operations
Logical micro-operationsLogical micro-operations
Logical micro-operations
VATSAL TRIVEDI
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processing
Kamal Acharya
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptx
SKUP1
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
Kuppusamy P
 
Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture
S. Hasnain Raza
 
Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)
guest251d9a
 
Register transfer language
Register transfer languageRegister transfer language
Register transfer language
Sanjeev Patel
 
Pipelining , structural hazards
Pipelining , structural hazardsPipelining , structural hazards
Pipelining , structural hazards
Munaam Munawar
 
Cs6503 theory of computation november december 2015 be cse anna university q...
Cs6503 theory of computation november december 2015  be cse anna university q...Cs6503 theory of computation november december 2015  be cse anna university q...
Cs6503 theory of computation november december 2015 be cse anna university q...
appasami
 
compiler ppt on symbol table
 compiler ppt on symbol table compiler ppt on symbol table
compiler ppt on symbol table
nadarmispapaulraj
 
Unit 1 intro-embedded
Unit 1 intro-embeddedUnit 1 intro-embedded
Unit 1 intro-embedded
Pavithra S
 
Diagnostic in Adaptive AUTOSAR
Diagnostic in Adaptive AUTOSARDiagnostic in Adaptive AUTOSAR
Diagnostic in Adaptive AUTOSAR
Bernhard Wagner
 
Expression and Operartor In C Programming
Expression and Operartor In C Programming Expression and Operartor In C Programming
Expression and Operartor In C Programming
Kamal Acharya
 
RECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSINGRECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSING
Jothi Lakshmi
 

Viewers also liked (18)

Engranajes fotos
Engranajes fotosEngranajes fotos
Engranajes fotos
Juan Carlos Pingus C Pingus
 
Fiqih icha
Fiqih ichaFiqih icha
Fiqih icha
ichaa17
 
Tik allisya smpit rpi
Tik allisya smpit rpiTik allisya smpit rpi
Tik allisya smpit rpi
ichaa17
 
Creative & Digital Business Briefing - October 2016
Creative & Digital Business Briefing - October 2016Creative & Digital Business Briefing - October 2016
Creative & Digital Business Briefing - October 2016
The Knowledge Transfer Network Creative, Digital & Design
 
Creative & Digital Business Briefing - November 2016
Creative & Digital Business Briefing - November 2016Creative & Digital Business Briefing - November 2016
Creative & Digital Business Briefing - November 2016
The Knowledge Transfer Network Creative, Digital & Design
 
tentang menu toolbar pada microsoft word
tentang menu toolbar pada microsoft wordtentang menu toolbar pada microsoft word
tentang menu toolbar pada microsoft word
ichaa17
 
Programme on Ms Excel For Managerial Computing
Programme on Ms Excel For Managerial ComputingProgramme on Ms Excel For Managerial Computing
Programme on Ms Excel For Managerial Computing
vamnicom123
 
An Opinion Without Support Is Not An Appraisal
An Opinion Without Support Is Not An AppraisalAn Opinion Without Support Is Not An Appraisal
An Opinion Without Support Is Not An Appraisal
James Regnere
 
Digital business briefing January 2015
Digital business briefing January 2015Digital business briefing January 2015
Digital business briefing January 2015
The Knowledge Transfer Network Creative, Digital & Design
 
Health supervision policy for the workplace
Health supervision policy for the workplaceHealth supervision policy for the workplace
Health supervision policy for the workplace
Jane Coombs
 
Ramya mmwt
Ramya mmwtRamya mmwt
Ramya mmwt
Ramya Aggarwal
 
English research report
English research reportEnglish research report
English research report
Jıa Yıı
 
Three Post - Media Production Capabilities
Three Post - Media Production CapabilitiesThree Post - Media Production Capabilities
Three Post - Media Production Capabilities
Three Post
 
Hukum newton gravitasi
Hukum newton gravitasiHukum newton gravitasi
Hukum newton gravitasi
Universitas Muhammadiyah Surakarta
 
Psy 1
Psy 1Psy 1
Psy 1
Jıa Yıı
 
Fit notes and work
Fit notes and workFit notes and work
Fit notes and work
Jane Coombs
 
Epc slides (part1)
Epc slides (part1)Epc slides (part1)
Epc slides (part1)
Jıa Yıı
 
Life insurance after retirement
Life insurance after retirementLife insurance after retirement
Life insurance after retirement
InfiniteYou
 

Similar to Compiler optimization (20)

Compiler optimization techniques
Compiler optimization techniquesCompiler optimization techniques
Compiler optimization techniques
Hardik Devani
 
Compiler presention
Compiler presentionCompiler presention
Compiler presention
Faria Priya
 
Compiler optimization
Compiler optimizationCompiler optimization
Compiler optimization
Karthik Vivek
 
SPCC_Sem6_Chapter 6_Code Optimization part
SPCC_Sem6_Chapter 6_Code Optimization partSPCC_Sem6_Chapter 6_Code Optimization part
SPCC_Sem6_Chapter 6_Code Optimization part
NiramayKolalle
 
Loop Unroll_ACA_CS505.ppt
Loop Unroll_ACA_CS505.pptLoop Unroll_ACA_CS505.ppt
Loop Unroll_ACA_CS505.ppt
HassanJavaid48
 
Optimization Techniques
Optimization TechniquesOptimization Techniques
Optimization Techniques
Joud Khattab
 
Instruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler TechniquesInstruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler Techniques
Dilum Bandara
 
complier design unit 5 for helping students
complier design unit 5 for helping studentscomplier design unit 5 for helping students
complier design unit 5 for helping students
aniketsugandhi1
 
Code optmize.pptx which is related to coding
Code optmize.pptx which is related to codingCode optmize.pptx which is related to coding
Code optmize.pptx which is related to coding
vamami6395
 
ERTS UNIT 3.ppt
ERTS UNIT 3.pptERTS UNIT 3.ppt
ERTS UNIT 3.ppt
Pavithra525349
 
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
Dr.K. Thirunadana Sikamani
 
T3_Embedded programing_07072022T3_Embedded programing_07072022.pptx
T3_Embedded programing_07072022T3_Embedded programing_07072022.pptxT3_Embedded programing_07072022T3_Embedded programing_07072022.pptx
T3_Embedded programing_07072022T3_Embedded programing_07072022.pptx
HuyTrn352093
 
Fundamental principles of optimization and loop optimization techniques
Fundamental principles of optimization and loop optimization techniquesFundamental principles of optimization and loop optimization techniques
Fundamental principles of optimization and loop optimization techniques
ssharmilasharmila23
 
Downlaod Wise Registry Cleaner Pro Crack
Downlaod Wise Registry Cleaner Pro CrackDownlaod Wise Registry Cleaner Pro Crack
Downlaod Wise Registry Cleaner Pro Crack
tomcross837
 
Autodesk CFD Ultimate Crack Latest Version
Autodesk CFD Ultimate Crack Latest VersionAutodesk CFD Ultimate Crack Latest Version
Autodesk CFD Ultimate Crack Latest Version
losbeten
 
Download RarmaRadio Pro Crack Latest [2025]
Download RarmaRadio Pro Crack Latest [2025]Download RarmaRadio Pro Crack Latest [2025]
Download RarmaRadio Pro Crack Latest [2025]
wreeen464
 
Code_Optimization_Compiler_Design software .pptx
Code_Optimization_Compiler_Design software .pptxCode_Optimization_Compiler_Design software .pptx
Code_Optimization_Compiler_Design software .pptx
AmishaKumari97
 
NCH VideoPad Pro Cracked Version Download
NCH VideoPad Pro Cracked Version DownloadNCH VideoPad Pro Cracked Version Download
NCH VideoPad Pro Cracked Version Download
jasperjhin57
 
Download Artweaver Plus Cracked Version Free
Download Artweaver Plus Cracked Version FreeDownload Artweaver Plus Cracked Version Free
Download Artweaver Plus Cracked Version Free
adomalex314
 
Latest TreeSize Professional 9 Crack Download
Latest TreeSize Professional 9 Crack DownloadLatest TreeSize Professional 9 Crack Download
Latest TreeSize Professional 9 Crack Download
bentenkhan340
 
Compiler optimization techniques
Compiler optimization techniquesCompiler optimization techniques
Compiler optimization techniques
Hardik Devani
 
Compiler presention
Compiler presentionCompiler presention
Compiler presention
Faria Priya
 
Compiler optimization
Compiler optimizationCompiler optimization
Compiler optimization
Karthik Vivek
 
SPCC_Sem6_Chapter 6_Code Optimization part
SPCC_Sem6_Chapter 6_Code Optimization partSPCC_Sem6_Chapter 6_Code Optimization part
SPCC_Sem6_Chapter 6_Code Optimization part
NiramayKolalle
 
Loop Unroll_ACA_CS505.ppt
Loop Unroll_ACA_CS505.pptLoop Unroll_ACA_CS505.ppt
Loop Unroll_ACA_CS505.ppt
HassanJavaid48
 
Optimization Techniques
Optimization TechniquesOptimization Techniques
Optimization Techniques
Joud Khattab
 
Instruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler TechniquesInstruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler Techniques
Dilum Bandara
 
complier design unit 5 for helping students
complier design unit 5 for helping studentscomplier design unit 5 for helping students
complier design unit 5 for helping students
aniketsugandhi1
 
Code optmize.pptx which is related to coding
Code optmize.pptx which is related to codingCode optmize.pptx which is related to coding
Code optmize.pptx which is related to coding
vamami6395
 
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
Instruction Level Parallelism Compiler optimization Techniques Anna Universit...
Dr.K. Thirunadana Sikamani
 
T3_Embedded programing_07072022T3_Embedded programing_07072022.pptx
T3_Embedded programing_07072022T3_Embedded programing_07072022.pptxT3_Embedded programing_07072022T3_Embedded programing_07072022.pptx
T3_Embedded programing_07072022T3_Embedded programing_07072022.pptx
HuyTrn352093
 
Fundamental principles of optimization and loop optimization techniques
Fundamental principles of optimization and loop optimization techniquesFundamental principles of optimization and loop optimization techniques
Fundamental principles of optimization and loop optimization techniques
ssharmilasharmila23
 
Downlaod Wise Registry Cleaner Pro Crack
Downlaod Wise Registry Cleaner Pro CrackDownlaod Wise Registry Cleaner Pro Crack
Downlaod Wise Registry Cleaner Pro Crack
tomcross837
 
Autodesk CFD Ultimate Crack Latest Version
Autodesk CFD Ultimate Crack Latest VersionAutodesk CFD Ultimate Crack Latest Version
Autodesk CFD Ultimate Crack Latest Version
losbeten
 
Download RarmaRadio Pro Crack Latest [2025]
Download RarmaRadio Pro Crack Latest [2025]Download RarmaRadio Pro Crack Latest [2025]
Download RarmaRadio Pro Crack Latest [2025]
wreeen464
 
Code_Optimization_Compiler_Design software .pptx
Code_Optimization_Compiler_Design software .pptxCode_Optimization_Compiler_Design software .pptx
Code_Optimization_Compiler_Design software .pptx
AmishaKumari97
 
NCH VideoPad Pro Cracked Version Download
NCH VideoPad Pro Cracked Version DownloadNCH VideoPad Pro Cracked Version Download
NCH VideoPad Pro Cracked Version Download
jasperjhin57
 
Download Artweaver Plus Cracked Version Free
Download Artweaver Plus Cracked Version FreeDownload Artweaver Plus Cracked Version Free
Download Artweaver Plus Cracked Version Free
adomalex314
 
Latest TreeSize Professional 9 Crack Download
Latest TreeSize Professional 9 Crack DownloadLatest TreeSize Professional 9 Crack Download
Latest TreeSize Professional 9 Crack Download
bentenkhan340
 

More from ZongYing Lyu (16)

Vue.js
Vue.jsVue.js
Vue.js
ZongYing Lyu
 
Performance improvement techniques for software distributed shared memory
Performance improvement techniques for software distributed shared memoryPerformance improvement techniques for software distributed shared memory
Performance improvement techniques for software distributed shared memory
ZongYing Lyu
 
Architecture of the oasis mobile shared virtual memory system
Architecture of the oasis mobile shared virtual memory systemArchitecture of the oasis mobile shared virtual memory system
Architecture of the oasis mobile shared virtual memory system
ZongYing Lyu
 
A deep dive into energy efficient multi core processor
A deep dive into energy efficient multi core processorA deep dive into energy efficient multi core processor
A deep dive into energy efficient multi core processor
ZongYing Lyu
 
Libckpt transparent checkpointing under unix
Libckpt transparent checkpointing under unixLibckpt transparent checkpointing under unix
Libckpt transparent checkpointing under unix
ZongYing Lyu
 
Device Driver - Chapter 6字元驅動程式的進階作業
Device Driver - Chapter 6字元驅動程式的進階作業Device Driver - Chapter 6字元驅動程式的進階作業
Device Driver - Chapter 6字元驅動程式的進階作業
ZongYing Lyu
 
Device Driver - Chapter 3字元驅動程式
Device Driver - Chapter 3字元驅動程式Device Driver - Chapter 3字元驅動程式
Device Driver - Chapter 3字元驅動程式
ZongYing Lyu
 
Web coding principle
Web coding principleWeb coding principle
Web coding principle
ZongYing Lyu
 
提高 Code 品質心得
提高 Code 品質心得提高 Code 品質心得
提高 Code 品質心得
ZongYing Lyu
 
SCRUM
SCRUMSCRUM
SCRUM
ZongYing Lyu
 
Consistency protocols
Consistency protocolsConsistency protocols
Consistency protocols
ZongYing Lyu
 
MPI use c language
MPI use c languageMPI use c language
MPI use c language
ZongYing Lyu
 
Cvs
CvsCvs
Cvs
ZongYing Lyu
 
Parallel program design
Parallel program designParallel program design
Parallel program design
ZongYing Lyu
 
MPI
MPIMPI
MPI
ZongYing Lyu
 
OpenMP
OpenMPOpenMP
OpenMP
ZongYing Lyu
 
Performance improvement techniques for software distributed shared memory
Performance improvement techniques for software distributed shared memoryPerformance improvement techniques for software distributed shared memory
Performance improvement techniques for software distributed shared memory
ZongYing Lyu
 
Architecture of the oasis mobile shared virtual memory system
Architecture of the oasis mobile shared virtual memory systemArchitecture of the oasis mobile shared virtual memory system
Architecture of the oasis mobile shared virtual memory system
ZongYing Lyu
 
A deep dive into energy efficient multi core processor
A deep dive into energy efficient multi core processorA deep dive into energy efficient multi core processor
A deep dive into energy efficient multi core processor
ZongYing Lyu
 
Libckpt transparent checkpointing under unix
Libckpt transparent checkpointing under unixLibckpt transparent checkpointing under unix
Libckpt transparent checkpointing under unix
ZongYing Lyu
 
Device Driver - Chapter 6字元驅動程式的進階作業
Device Driver - Chapter 6字元驅動程式的進階作業Device Driver - Chapter 6字元驅動程式的進階作業
Device Driver - Chapter 6字元驅動程式的進階作業
ZongYing Lyu
 
Device Driver - Chapter 3字元驅動程式
Device Driver - Chapter 3字元驅動程式Device Driver - Chapter 3字元驅動程式
Device Driver - Chapter 3字元驅動程式
ZongYing Lyu
 
Web coding principle
Web coding principleWeb coding principle
Web coding principle
ZongYing Lyu
 
提高 Code 品質心得
提高 Code 品質心得提高 Code 品質心得
提高 Code 品質心得
ZongYing Lyu
 
Consistency protocols
Consistency protocolsConsistency protocols
Consistency protocols
ZongYing Lyu
 
MPI use c language
MPI use c languageMPI use c language
MPI use c language
ZongYing Lyu
 
Parallel program design
Parallel program designParallel program design
Parallel program design
ZongYing Lyu
 

Recently uploaded (20)

Reducing Bugs With Static Code Analysis php tek 2025
Reducing Bugs With Static Code Analysis php tek 2025Reducing Bugs With Static Code Analysis php tek 2025
Reducing Bugs With Static Code Analysis php tek 2025
Scott Keck-Warren
 
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
HusseinMalikMammadli
 
AI and Gender: Decoding the Sociological Impact
AI and Gender: Decoding the Sociological ImpactAI and Gender: Decoding the Sociological Impact
AI and Gender: Decoding the Sociological Impact
SaikatBasu37
 
John Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 TalkJohn Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 Talk
Razin Mustafiz
 
Breaking it Down: Microservices Architecture for PHP Developers
Breaking it Down: Microservices Architecture for PHP DevelopersBreaking it Down: Microservices Architecture for PHP Developers
Breaking it Down: Microservices Architecture for PHP Developers
pmeth1
 
Introducing High Availability: Business Continuity for Every NAS User
Introducing High Availability: Business Continuity for Every NAS UserIntroducing High Availability: Business Continuity for Every NAS User
Introducing High Availability: Business Continuity for Every NAS User
QNAP Marketing
 
CloudStack + KVM: Your Local Cloud Lab
CloudStack + KVM:   Your Local Cloud LabCloudStack + KVM:   Your Local Cloud Lab
CloudStack + KVM: Your Local Cloud Lab
ShapeBlue
 
Stretching CloudStack over multiple datacenters
Stretching CloudStack over multiple datacentersStretching CloudStack over multiple datacenters
Stretching CloudStack over multiple datacenters
ShapeBlue
 
Agentic AI, A Business Overview - May 2025
Agentic AI, A Business Overview - May 2025Agentic AI, A Business Overview - May 2025
Agentic AI, A Business Overview - May 2025
Peter Morgan
 
Planetek Italia Corporate Profile Brochure
Planetek Italia Corporate Profile BrochurePlanetek Italia Corporate Profile Brochure
Planetek Italia Corporate Profile Brochure
Planetek Italia Srl
 
NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal...
NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal...NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal...
NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal...
derrickjswork
 
Managing Geospatial Open Data Serverlessly [AWS Community Day CH 2025]
Managing Geospatial Open Data Serverlessly [AWS Community Day CH 2025]Managing Geospatial Open Data Serverlessly [AWS Community Day CH 2025]
Managing Geospatial Open Data Serverlessly [AWS Community Day CH 2025]
Chris Bingham
 
Wondershare Filmora 14.3.2 Crack + License Key Free for Windows PC
Wondershare Filmora 14.3.2 Crack + License Key Free for Windows PCWondershare Filmora 14.3.2 Crack + License Key Free for Windows PC
Wondershare Filmora 14.3.2 Crack + License Key Free for Windows PC
Mudasir
 
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World TipsMuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
Patryk Bandurski
 
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCPMCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
Sambhav Kothari
 
"AI in the browser: predicting user actions in real time with TensorflowJS", ...
"AI in the browser: predicting user actions in real time with TensorflowJS", ..."AI in the browser: predicting user actions in real time with TensorflowJS", ...
"AI in the browser: predicting user actions in real time with TensorflowJS", ...
Fwdays
 
A simple Introduction to Algorithmic Fairness
A simple Introduction to Algorithmic FairnessA simple Introduction to Algorithmic Fairness
A simple Introduction to Algorithmic Fairness
Paolo Missier
 
Interactive SQL: SQL, Features of SQL, DDL & DML
Interactive SQL: SQL, Features of SQL,  DDL & DMLInteractive SQL: SQL, Features of SQL,  DDL & DML
Interactive SQL: SQL, Features of SQL, DDL & DML
IsakkiDeviP
 
PSEP - Salesforce Power of the Platform.pdf
PSEP - Salesforce Power of the Platform.pdfPSEP - Salesforce Power of the Platform.pdf
PSEP - Salesforce Power of the Platform.pdf
ssuser3d62c6
 
Build your own NES Emulator... with Kotlin
Build your own NES Emulator... with KotlinBuild your own NES Emulator... with Kotlin
Build your own NES Emulator... with Kotlin
Artur Skowroński
 
Reducing Bugs With Static Code Analysis php tek 2025
Reducing Bugs With Static Code Analysis php tek 2025Reducing Bugs With Static Code Analysis php tek 2025
Reducing Bugs With Static Code Analysis php tek 2025
Scott Keck-Warren
 
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
HusseinMalikMammadli
 
AI and Gender: Decoding the Sociological Impact
AI and Gender: Decoding the Sociological ImpactAI and Gender: Decoding the Sociological Impact
AI and Gender: Decoding the Sociological Impact
SaikatBasu37
 
John Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 TalkJohn Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 Talk
Razin Mustafiz
 
Breaking it Down: Microservices Architecture for PHP Developers
Breaking it Down: Microservices Architecture for PHP DevelopersBreaking it Down: Microservices Architecture for PHP Developers
Breaking it Down: Microservices Architecture for PHP Developers
pmeth1
 
Introducing High Availability: Business Continuity for Every NAS User
Introducing High Availability: Business Continuity for Every NAS UserIntroducing High Availability: Business Continuity for Every NAS User
Introducing High Availability: Business Continuity for Every NAS User
QNAP Marketing
 
CloudStack + KVM: Your Local Cloud Lab
CloudStack + KVM:   Your Local Cloud LabCloudStack + KVM:   Your Local Cloud Lab
CloudStack + KVM: Your Local Cloud Lab
ShapeBlue
 
Stretching CloudStack over multiple datacenters
Stretching CloudStack over multiple datacentersStretching CloudStack over multiple datacenters
Stretching CloudStack over multiple datacenters
ShapeBlue
 
Agentic AI, A Business Overview - May 2025
Agentic AI, A Business Overview - May 2025Agentic AI, A Business Overview - May 2025
Agentic AI, A Business Overview - May 2025
Peter Morgan
 
Planetek Italia Corporate Profile Brochure
Planetek Italia Corporate Profile BrochurePlanetek Italia Corporate Profile Brochure
Planetek Italia Corporate Profile Brochure
Planetek Italia Srl
 
NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal...
NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal...NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal...
NVIDIA’s Enterprise AI Factory and Blueprints_ Paving the Way for Smart, Scal...
derrickjswork
 
Managing Geospatial Open Data Serverlessly [AWS Community Day CH 2025]
Managing Geospatial Open Data Serverlessly [AWS Community Day CH 2025]Managing Geospatial Open Data Serverlessly [AWS Community Day CH 2025]
Managing Geospatial Open Data Serverlessly [AWS Community Day CH 2025]
Chris Bingham
 
Wondershare Filmora 14.3.2 Crack + License Key Free for Windows PC
Wondershare Filmora 14.3.2 Crack + License Key Free for Windows PCWondershare Filmora 14.3.2 Crack + License Key Free for Windows PC
Wondershare Filmora 14.3.2 Crack + License Key Free for Windows PC
Mudasir
 
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World TipsMuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
MuleSoft RTF & Flex Gateway on AKS – Setup, Insights & Real-World Tips
Patryk Bandurski
 
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCPMCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
MCP Dev Summit - Pragmatic Scaling of Enterprise GenAI with MCP
Sambhav Kothari
 
"AI in the browser: predicting user actions in real time with TensorflowJS", ...
"AI in the browser: predicting user actions in real time with TensorflowJS", ..."AI in the browser: predicting user actions in real time with TensorflowJS", ...
"AI in the browser: predicting user actions in real time with TensorflowJS", ...
Fwdays
 
A simple Introduction to Algorithmic Fairness
A simple Introduction to Algorithmic FairnessA simple Introduction to Algorithmic Fairness
A simple Introduction to Algorithmic Fairness
Paolo Missier
 
Interactive SQL: SQL, Features of SQL, DDL & DML
Interactive SQL: SQL, Features of SQL,  DDL & DMLInteractive SQL: SQL, Features of SQL,  DDL & DML
Interactive SQL: SQL, Features of SQL, DDL & DML
IsakkiDeviP
 
PSEP - Salesforce Power of the Platform.pdf
PSEP - Salesforce Power of the Platform.pdfPSEP - Salesforce Power of the Platform.pdf
PSEP - Salesforce Power of the Platform.pdf
ssuser3d62c6
 
Build your own NES Emulator... with Kotlin
Build your own NES Emulator... with KotlinBuild your own NES Emulator... with Kotlin
Build your own NES Emulator... with Kotlin
Artur Skowroński
 

Compiler optimization

  • 1. Compiler Optimization Speaker :呂宗螢 Adviser :梁文耀 老師 Date : 2006/10/11
  • 2. Embedded and Parallel Systems Lab2 The Structure of Recent Front end per language High-level optimizations Global optimizer Code generator Intermediate representation Dependencies Function Language Dependent machine independent Transform language to common intermediate form Largely machine independent For example, procedure inlineing (also called procedure intergration) Small language dependencies machine dependencies slight (e.g., register count/types) Including global and local optimizations + register allocation Highly machine dependent Language independent Detailed instruction selection and machine-dependent optimizations May include or be followed by assembler
  • 3. Embedded and Parallel Systems Lab3 Major types of optimizations
  • 4. Embedded and Parallel Systems Lab4 Procedure integration  Replace procedure call by procedure body Int a; void up(){ a=a+1; } Void main(){ a=10; up(); b=a+5; } Int a; Void main(){ a=10; a=a+1; b=a+5; }
  • 5. Embedded and Parallel Systems Lab5 Common subexpression elimination  Replace two instances of same computation by single copy a = b * c + g; d = b * c * d; tmp = b * c; a = tmp + g; d = tmp * d;
  • 6. Embedded and Parallel Systems Lab6 Constant propagation  Replace all instances of a variable that is assigned a constant with the constant int x = 14; int y = 7 - x / 2; return y * (28 / x + 2); int x = 14; int y = 7 - 14 / 2; return y * (28 / 14 + 2); int x = 14; int y = 0; return y * 4;
  • 7. Embedded and Parallel Systems Lab7 Stack height reduction  Rearrange expression tree to minimize resources needed for expression evaluation ADD R6,R2,R3 ADD R7,R6,R4 ADD R8,R7,R5 ADD R6,R2,R3 ADD R7,R4,R5 ADD R8,R7,R6 I1 I2 I3 I1 I2 I3 R8=((R2+R3)+R4)+R5 R8=(R2+R3)+(R4+R5)
  • 8. Embedded and Parallel Systems Lab8 Copy propagation  Replace all instances of a variable A that has been assigned X (i.e., A = X) with X y = x ; z = 3 + y; z = 3 + x
  • 9. Embedded and Parallel Systems Lab9 Code motion  Remove code from a loop that computes same value each iteration of the loop  Loop-invariant code while (j < maximum - 1) { x=1; j = j + 4 * a; } int maxval = maximum - 1; int calcval = 4 * a; x=1; while (j < maxval) { j = j + calcval; }
  • 10. Embedded and Parallel Systems Lab10 Induction variable elimination  Simplify / eliminate array addressing calculations within loops Int i=0; while( i<10){ i=i+1; p = 4*i ; do some things; } Int p=0; while( p<40){ p=p+4; do some things; }
  • 11. Embedded and Parallel Systems Lab11 Strength reduction  Such as , replace multiply by constant with adds and shifts for (i=0 ; i<n ; i++){ z = i * x; do some things; } for (i=0 ; i<n ; i++){ z = z + x; do some things; }
  • 12. Embedded and Parallel Systems Lab12 Branch offset optimization  Choose the shortest branch displacement that reaches target if( a ){ statement 1 } else { goto L1; } statement 2 L1: statement 3 if( !a ){ goto L1; } statement 1 statement 2 L1: statement 3
  • 13. Embedded and Parallel Systems Lab13 dead (unreachable) code elimination  Remove instructions that will not affect the behavior of the program. Int func( int a){ int b, c; b=a*2; c=a*3; return b; } Int func( int a){ int b, c; b=a*2; return b; }
  • 14. Embedded and Parallel Systems Lab14 Boolean Expression If( a=0 || b=0 || c=0) { statement 1; } If( a=0) { statement 1; }else if( b=0){ statement 1; }else if( c=0){ statement 1; }
  • 15. Embedded and Parallel Systems Lab15 Loop unrolling int i; for (i = 0; i < 5; i++){ function(i); } function(0); function(1); function(2); function(3); function(4);  Duplicates the body of the loop multiple times, in order to decrease the number of times the loop condition is tested and the number of jumps, which hurt performance by impairing the instruction pipeline
  • 16. Embedded and Parallel Systems Lab16  Thanks
  翻译: