SlideShare a Scribd company logo
2
Most read
7
Most read
14
Most read
LOOPS IN FLOW
GRAPHS
BP150511
R. RAMYA
LOOPS IN FLOW GRAPHS
 We shall use the notion of a node “Dominating”
another to define “Natural Loop” and the
important special class of “Reducible” of flow
graphs.
 An algorithm for finding dominators and
checking reducibility of flow graphs.
i. Dominators
ii. Natural loops
iii. Inner loops
iv. Pre-Headers
v. Reducible flow graphs
DOMINATORS
 d dom n – Node d of a CFG dominates node n if
every path from the initial node of the CFG to n
goes through d– The loop entry dominates all
nodes in the loop
 The immediate dominator m of a node n is the
last dominator on the path from the initial node
to n – If d ≠ n and d dom n then d dom m
Loops in flow
 Build a dominator tree as follows:
 – Root is CFG entry node n0
 – m is child of node n iff n=Idom (m)
NATURAL LOOPS
 A back edge is is an edge a → b whose head b
dominates its tail a Given a back edge n → d
1. The natural loop consists of d plus the nodes
that can reach n without going through d
2. The loop header is node d
• Unless two loops have the same header, they are
disjoint or one is nested within the other – A nested
loop is an inner loop if it contains no other loops
Loops in flow
NATURAL INNER LOOPS EXAMPLE
NATURAL OUTER LOOPS EXAMPLE
PRE-HEADERS
 To facilitate loop transformations, a
compiler often adds a pre-header to a loop
• Code motion, strength reduction, and other
loop transformations populate the pre-header
Loops in flow
REDUCIBLE FLOW GRAPHS
 Reducible graph = disjoint partition in forward
and back edges such that the forward edges form
an acyclic (sub)graph.
Loops in flow
 VIDEO
 video1
THANKYOU

More Related Content

PDF
Compiler Design- Machine Independent Optimizations
PPTX
Peephole optimization techniques in compiler design
PDF
Issues in the design of Code Generator
PPTX
Principal source of optimization in compiler design
PPTX
Basic blocks and control flow graphs
PDF
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
PPTX
Code optimization
PDF
Code optimization in compiler design
Compiler Design- Machine Independent Optimizations
Peephole optimization techniques in compiler design
Issues in the design of Code Generator
Principal source of optimization in compiler design
Basic blocks and control flow graphs
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
Code optimization
Code optimization in compiler design

What's hot (20)

PDF
PAC Learning
PPTX
Principal Sources of Optimization in compiler design
PPTX
Evaluating hypothesis
PPTX
Three Address code
PPTX
Inductive bias
PPT
17. Recovery System in DBMS
PDF
Little o and little omega
PPTX
Learning rule of first order rules
PPTX
Register allocation and assignment
PPTX
Common Standards in Cloud Computing
PPTX
Recognition-of-tokens
PPTX
Code generation
PDF
Syntax Directed Definition and its applications
PPTX
Translation of expression(copmiler construction)
PPT
Type Checking(Compiler Design) #ShareThisIfYouLike
PPT
Intermediate code generation (Compiler Design)
PPTX
8 queens problem using back tracking
PPTX
Phases of Compiler
PPTX
Directed Acyclic Graph Representation of basic blocks
PPTX
Osi security architecture in network.pptx
PAC Learning
Principal Sources of Optimization in compiler design
Evaluating hypothesis
Three Address code
Inductive bias
17. Recovery System in DBMS
Little o and little omega
Learning rule of first order rules
Register allocation and assignment
Common Standards in Cloud Computing
Recognition-of-tokens
Code generation
Syntax Directed Definition and its applications
Translation of expression(copmiler construction)
Type Checking(Compiler Design) #ShareThisIfYouLike
Intermediate code generation (Compiler Design)
8 queens problem using back tracking
Phases of Compiler
Directed Acyclic Graph Representation of basic blocks
Osi security architecture in network.pptx
Ad

Viewers also liked (17)

PPTX
Informe padres y alumnos 2017
PPT
Sexualidad+ +2do---
PPTX
El coltan
PDF
OYSTER STORY
PPTX
Corneal degenerations
PDF
Ciclomobilidade e o PDDU de Salvador
PPTX
Learn and enjoy at RSAC 2017
DOCX
Rpp nilai mutlak K13
PDF
Oyster health
PPT
Ben Rothwell Flagged By USADA For Potential Doping Violation
DOCX
Expected questions in Artificial Intelligence
DOCX
Rpp pertidaksamaan rasional dan irasional kurikulum 2013
PPTX
Презентація Іршанської ОТГ Житомирської області
PDF
PPTX
kablosuz ağlar
PDF
Curso de teclado Aprenda a Tocar Teclado
PDF
EMAAR Vida Residences - Dubai Marina +971 4553 8725
Informe padres y alumnos 2017
Sexualidad+ +2do---
El coltan
OYSTER STORY
Corneal degenerations
Ciclomobilidade e o PDDU de Salvador
Learn and enjoy at RSAC 2017
Rpp nilai mutlak K13
Oyster health
Ben Rothwell Flagged By USADA For Potential Doping Violation
Expected questions in Artificial Intelligence
Rpp pertidaksamaan rasional dan irasional kurikulum 2013
Презентація Іршанської ОТГ Житомирської області
kablosuz ağlar
Curso de teclado Aprenda a Tocar Teclado
EMAAR Vida Residences - Dubai Marina +971 4553 8725
Ad

Similar to Loops in flow (20)

PPTX
Flowcharts
PPTX
1141_237_747_Module_1_3_process_modelling_and-simulation.pptx
PPTX
Compiler Design_Code Optimization tech.pptx
PPT
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
PDF
Control Flow Analysis
PPT
White box testing
PDF
Software Metrics Software Metrics chapter 6.pdf
PPTX
Algorithms and flowcharts
PPTX
20101017 program analysis_for_security_livshits_lecture02_compilers
PDF
Introduction to flowcharts and algorithms
PDF
algorithms and flow chart overview.pdf
PPT
COMPUTER PROGRAMMING UNIT 1 Lecture 4
PPTX
Flowcharting and Algorithm
PPT
Basic Slides on Algorithms and Flowcharts
PPT
Lecture1-Algorithms-and-Flowcharts-ppt.ppt
PPT
Lect1-Algorithms-and-Flowchart-ppt (1).ppt
PPT
Lecture1-Algorithms-and-Flowchart-ppt.ppt
PPT
Lect1 - Algorithms-and-Flowchart-ppt.ppt
PPT
Lecture1-Algorithms-and-Flowchart-ppt.ppt
PPT
Lect1-Algorithms-and-Flowchart PPT presentation
Flowcharts
1141_237_747_Module_1_3_process_modelling_and-simulation.pptx
Compiler Design_Code Optimization tech.pptx
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
Control Flow Analysis
White box testing
Software Metrics Software Metrics chapter 6.pdf
Algorithms and flowcharts
20101017 program analysis_for_security_livshits_lecture02_compilers
Introduction to flowcharts and algorithms
algorithms and flow chart overview.pdf
COMPUTER PROGRAMMING UNIT 1 Lecture 4
Flowcharting and Algorithm
Basic Slides on Algorithms and Flowcharts
Lecture1-Algorithms-and-Flowcharts-ppt.ppt
Lect1-Algorithms-and-Flowchart-ppt (1).ppt
Lecture1-Algorithms-and-Flowchart-ppt.ppt
Lect1 - Algorithms-and-Flowchart-ppt.ppt
Lecture1-Algorithms-and-Flowchart-ppt.ppt
Lect1-Algorithms-and-Flowchart PPT presentation

Recently uploaded (20)

PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
Classroom Observation Tools for Teachers
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
master seminar digital applications in india
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Institutional Correction lecture only . . .
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Week 4 Term 3 Study Techniques revisited.pptx
Microbial diseases, their pathogenesis and prophylaxis
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
TR - Agricultural Crops Production NC III.pdf
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Classroom Observation Tools for Teachers
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
master seminar digital applications in india
Module 4: Burden of Disease Tutorial Slides S2 2025
Complications of Minimal Access Surgery at WLH
Institutional Correction lecture only . . .
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf

Loops in flow

  • 2. LOOPS IN FLOW GRAPHS  We shall use the notion of a node “Dominating” another to define “Natural Loop” and the important special class of “Reducible” of flow graphs.  An algorithm for finding dominators and checking reducibility of flow graphs.
  • 3. i. Dominators ii. Natural loops iii. Inner loops iv. Pre-Headers v. Reducible flow graphs
  • 4. DOMINATORS  d dom n – Node d of a CFG dominates node n if every path from the initial node of the CFG to n goes through d– The loop entry dominates all nodes in the loop  The immediate dominator m of a node n is the last dominator on the path from the initial node to n – If d ≠ n and d dom n then d dom m
  • 6.  Build a dominator tree as follows:  – Root is CFG entry node n0  – m is child of node n iff n=Idom (m)
  • 7. NATURAL LOOPS  A back edge is is an edge a → b whose head b dominates its tail a Given a back edge n → d 1. The natural loop consists of d plus the nodes that can reach n without going through d 2. The loop header is node d • Unless two loops have the same header, they are disjoint or one is nested within the other – A nested loop is an inner loop if it contains no other loops
  • 11. PRE-HEADERS  To facilitate loop transformations, a compiler often adds a pre-header to a loop • Code motion, strength reduction, and other loop transformations populate the pre-header
  • 13. REDUCIBLE FLOW GRAPHS  Reducible graph = disjoint partition in forward and back edges such that the forward edges form an acyclic (sub)graph.