SlideShare a Scribd company logo
GLOBAL CODE
SCHEDULING
B.SOUNDARYA ,
II M.SC(COMPUTER SCIENCE)
DEPARTMENT OF CS & IT
COMPILER DESIGN
NADAR SARASWATHI COLLEGE OF ART’S &SCIENCE
INTRODUCTION
• Definition
• Strategies
• Basic block
• Primitive code motion
• Upward code motion
• Downward code motion
• Global scheduling Algorithm
• Advanced code motion techniques
DEFINITION
• A list of scheduling algorithm is used to create the
schedule for each basic block.
• The algorithm keeps a list of candidate
instructions,candlnsts,which contains all instructions in the
candidate block.
• It creates the schedule clock by clock.
STRATEGIES:
• Strategies that contains more than one basic block at a time are referred to as global
scheduling.
CONDITIONS:
1. All instructions in the original program are executed in the optimised one.
2. While the optimized program may execute extra instructions speculatively,these
instructions must not have any unwanted side effects.
BASIC BLOCK
• A basic block is constituted by set of instructions in
which the control entre the block through the first
instructions and leaves the block via the last instruction
without any deterrence or jump/branch in between
them.
PRIMITIVE CODE MOTION
Source program :
• Its involved in moving
Operation around by
Way of simple.
If (a ==0) goto L
C ==b
e = d + d
UPWARD CODE MOTION
• It’s move as operation from block SRC up a control flow path to block dsk.
• Such a move does not violate any data deoendences and it makes the path through dst and
src run faster.
• Case 1:
if src does not postdominate dst
In this case there exits a path that passes through dst that does not reach src.
This code motion is illegal unless techoperation moved has no unwanted side effects.
CASE:2 If dst does not dominant src
In this case there exists a path that reach src without first going through dst.
CONSTRAINTS :
1. The operands of the operation must hold the same values as in the original.
2. The result does not overwrite a value that is still needed and,
3. If itself a not subsequently overwritten before reaching src.
DOWNWARD CODE MOTION
• If is moving an operation from block src down a control flow path to block dst.
• CASE 1: src does not dominate dst.
There exists a path to dst that does not passes through src.
• CASE 2: dst does not post dominant src.
There exists a path through src does not pass through dst.
EXAMPLE
• If (x== 0) a=b;
Else a= c;
d=a;
(X==0)
(a==c) (a==b)
(d==a)
UPDATING DATA DEPENDENCE
• Code motions can change data dependence relations between operations.
• Thus the data dependence
Just be updated after each
Code motion.
X=1 X=2
GLOBAL SCHEDULING ALGORITHM
• Region based scheduling
• Two easiest form of code motion
1. Moving Operation up to control equivalent basic blocks.
2. Moving operation Speculatively up one branch to a dominating
predecessor.
ALGORITHM
For (i=0;i<N;i++)
{
S(i);
}
Can be unrolled
For(i=0;i+4<N;i+=4)
{
S(i);
S(i+1);
S(i+2);
S(i+3);
}
Repeat
S;
Until C;
Can be unrolled as
Repeatt
{
S;
If ( C. ) break;
S;
If (C ) break;
S;
}
Until C ;
ADVANCED CODE MOTION TECHNIQUES
• Adding new basic block along the control flow edges originating from blocks with more
than one predecessor.
• The code to be executed in each basic block is scheduling once for all as each block is
visited, because algorithm only move operation up to dominating block.
• Implementing download code motion is harder is an algorithm that visit that topological
order.
Compiler design

More Related Content

PPTX
Basic Block Scheduling
PPTX
Chapter 3
PPT
Fundamentals of Computer Design including performance measurements & quantita...
PPTX
Pipeline & Nonpipeline Processor
PPTX
Arm modes
PPT
Putnam Resource allocation model.ppt
PDF
VLSI-Physical Design- Tool Terminalogy
PPTX
UVM Ral model usage
Basic Block Scheduling
Chapter 3
Fundamentals of Computer Design including performance measurements & quantita...
Pipeline & Nonpipeline Processor
Arm modes
Putnam Resource allocation model.ppt
VLSI-Physical Design- Tool Terminalogy
UVM Ral model usage

What's hot (20)

PPTX
Superscalar & superpipeline processor
PPTX
Transaction Flow Testing: transaction flows, transaction flow testing techniq...
PPTX
ASIC Design Flow | Physical Design | VLSI
PDF
Clock Tree Synthesis.pdf
PDF
hardwired control unit ppt
PPTX
Advances in Verification - Workshop at BMS College of Engineering
PDF
Floorplanning and Powerplanning - Definitions and Notes
PDF
R&amp;c
PPTX
Ariane 5 launcher failure - why did it happen
PPT
Arm processor
PPTX
Architectural support for High Level Language
PDF
Cellular Automata
PPT
Vliw and superscaler
PDF
Common air protocol
PDF
Project Report Of SRAM Design
PPTX
DICGECAFANB.CapMota.pptx
PPT
Multithreading models
PPT
Black Box Testing
PPTX
Micro operation control of processor
PDF
Topograhical synthesis
Superscalar & superpipeline processor
Transaction Flow Testing: transaction flows, transaction flow testing techniq...
ASIC Design Flow | Physical Design | VLSI
Clock Tree Synthesis.pdf
hardwired control unit ppt
Advances in Verification - Workshop at BMS College of Engineering
Floorplanning and Powerplanning - Definitions and Notes
R&amp;c
Ariane 5 launcher failure - why did it happen
Arm processor
Architectural support for High Level Language
Cellular Automata
Vliw and superscaler
Common air protocol
Project Report Of SRAM Design
DICGECAFANB.CapMota.pptx
Multithreading models
Black Box Testing
Micro operation control of processor
Topograhical synthesis
Ad

Similar to Compiler design (20)

PPTX
compiler design
PPTX
Compiler Design
PPTX
Machine_Learning_JNTUH_R18_UNIT5_CONCEPTS.pptx
PPTX
FDS Unit I_PPT.pptx
PPTX
MARKS IN YOUR POCKET PMP for PMP Preparation
PPTX
Compiler Design_Code generation techniques.pptx
PDF
Code optimization in compiler design
PPTX
Compiler Design theory and various phases of compiler.pptx
PPTX
Basic blocks and control flow graphs
PPTX
PROBLEM SOLVING.pptx
PPTX
module1 new c programming for begginers.pptx
PPT
Microprocessor and microcontroller ppt download
PPTX
Bp150513(compiler)
PPT
0006.scheduling not-ilp-not-force
PPTX
UNIT I.pptxpython unit 1 engineering full unit completed
PPT
Lecture 16 17 code-generation
PDF
UiPath Veterans RPA Studio track program - Session 2: The fundamentals of Ui...
PPTX
Flowshop scheduling
PPTX
Operations scheduling
PPT
scheduling_1.ppt
compiler design
Compiler Design
Machine_Learning_JNTUH_R18_UNIT5_CONCEPTS.pptx
FDS Unit I_PPT.pptx
MARKS IN YOUR POCKET PMP for PMP Preparation
Compiler Design_Code generation techniques.pptx
Code optimization in compiler design
Compiler Design theory and various phases of compiler.pptx
Basic blocks and control flow graphs
PROBLEM SOLVING.pptx
module1 new c programming for begginers.pptx
Microprocessor and microcontroller ppt download
Bp150513(compiler)
0006.scheduling not-ilp-not-force
UNIT I.pptxpython unit 1 engineering full unit completed
Lecture 16 17 code-generation
UiPath Veterans RPA Studio track program - Session 2: The fundamentals of Ui...
Flowshop scheduling
Operations scheduling
scheduling_1.ppt
Ad

More from sowfi (20)

PPT
Lavanya m.sc
PPT
Lavanya m.sc
PPT
Soundarya m.sc
PPTX
Software engineering 2
PPTX
Big data analytics
PPTX
Web programming
PPTX
OS
PPTX
OS
PPTX
RDBMS
PPTX
DM
PPTX
CN
PPTX
CN
PPTX
Dm
PPTX
RDBMS
PPTX
connected compounds
PPTX
GENETIC ALGORITHM
PPTX
JDBE
PPTX
AUTO & HETRO CORRELATOR
PPTX
single source shorest path
PPTX
servlet in java
Lavanya m.sc
Lavanya m.sc
Soundarya m.sc
Software engineering 2
Big data analytics
Web programming
OS
OS
RDBMS
DM
CN
CN
Dm
RDBMS
connected compounds
GENETIC ALGORITHM
JDBE
AUTO & HETRO CORRELATOR
single source shorest path
servlet in java

Recently uploaded (20)

PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Computing-Curriculum for Schools in Ghana
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Lesson notes of climatology university.
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Complications of Minimal Access Surgery at WLH
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Cell Types and Its function , kingdom of life
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Abdominal Access Techniques with Prof. Dr. R K Mishra
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Anesthesia in Laparoscopic Surgery in India
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Computing-Curriculum for Schools in Ghana
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Lesson notes of climatology university.
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
VCE English Exam - Section C Student Revision Booklet
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Complications of Minimal Access Surgery at WLH
01-Introduction-to-Information-Management.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
RMMM.pdf make it easy to upload and study
GDM (1) (1).pptx small presentation for students
Cell Types and Its function , kingdom of life

Compiler design

  • 1. GLOBAL CODE SCHEDULING B.SOUNDARYA , II M.SC(COMPUTER SCIENCE) DEPARTMENT OF CS & IT COMPILER DESIGN NADAR SARASWATHI COLLEGE OF ART’S &SCIENCE
  • 2. INTRODUCTION • Definition • Strategies • Basic block • Primitive code motion • Upward code motion • Downward code motion • Global scheduling Algorithm • Advanced code motion techniques
  • 3. DEFINITION • A list of scheduling algorithm is used to create the schedule for each basic block. • The algorithm keeps a list of candidate instructions,candlnsts,which contains all instructions in the candidate block. • It creates the schedule clock by clock.
  • 4. STRATEGIES: • Strategies that contains more than one basic block at a time are referred to as global scheduling. CONDITIONS: 1. All instructions in the original program are executed in the optimised one. 2. While the optimized program may execute extra instructions speculatively,these instructions must not have any unwanted side effects.
  • 5. BASIC BLOCK • A basic block is constituted by set of instructions in which the control entre the block through the first instructions and leaves the block via the last instruction without any deterrence or jump/branch in between them.
  • 6. PRIMITIVE CODE MOTION Source program : • Its involved in moving Operation around by Way of simple. If (a ==0) goto L C ==b e = d + d
  • 7. UPWARD CODE MOTION • It’s move as operation from block SRC up a control flow path to block dsk. • Such a move does not violate any data deoendences and it makes the path through dst and src run faster. • Case 1: if src does not postdominate dst In this case there exits a path that passes through dst that does not reach src. This code motion is illegal unless techoperation moved has no unwanted side effects.
  • 8. CASE:2 If dst does not dominant src In this case there exists a path that reach src without first going through dst. CONSTRAINTS : 1. The operands of the operation must hold the same values as in the original. 2. The result does not overwrite a value that is still needed and, 3. If itself a not subsequently overwritten before reaching src.
  • 9. DOWNWARD CODE MOTION • If is moving an operation from block src down a control flow path to block dst. • CASE 1: src does not dominate dst. There exists a path to dst that does not passes through src. • CASE 2: dst does not post dominant src. There exists a path through src does not pass through dst.
  • 10. EXAMPLE • If (x== 0) a=b; Else a= c; d=a; (X==0) (a==c) (a==b) (d==a)
  • 11. UPDATING DATA DEPENDENCE • Code motions can change data dependence relations between operations. • Thus the data dependence Just be updated after each Code motion. X=1 X=2
  • 12. GLOBAL SCHEDULING ALGORITHM • Region based scheduling • Two easiest form of code motion 1. Moving Operation up to control equivalent basic blocks. 2. Moving operation Speculatively up one branch to a dominating predecessor.
  • 13. ALGORITHM For (i=0;i<N;i++) { S(i); } Can be unrolled For(i=0;i+4<N;i+=4) { S(i); S(i+1); S(i+2); S(i+3); } Repeat S; Until C; Can be unrolled as Repeatt { S; If ( C. ) break; S; If (C ) break; S; } Until C ;
  • 14. ADVANCED CODE MOTION TECHNIQUES • Adding new basic block along the control flow edges originating from blocks with more than one predecessor. • The code to be executed in each basic block is scheduling once for all as each block is visited, because algorithm only move operation up to dominating block. • Implementing download code motion is harder is an algorithm that visit that topological order.