SlideShare a Scribd company logo
1 of 8
Next-use information
Introduction:
we collect next-use information about names in
basic blocks.
if the name in a register is no longer needed,
then the register can be assigned to some other
name.
This idea of keeping a name in storage only if it
will be used subsequently can be applied in a
number of contexts.
Next-use information
• Computing Next Uses
• Storage for Temporary Names
Computing next uses
• The use of a name in a three-address
statement:
– Three-address statement i assigns a value to x
– Statement j has x as an operand
– Control can flow from statement i to j along a path that has
no intervening assignments to x
– Then statement j uses the value of x computed at i .
– Say that x is live at statement i .
4
Next-use information
If the algorithms generating intermediate
code or optimizing the code permit certain
temporaries to be used across blocks, these
too must be considered live.
it would be a good idea to mark any such
temporaries, so we do not have to consider
all temporaries live.
Next-Use Information
• Algorithm (for x=y+z) : Determining the
liveness and next-use information for each
statement in a basic block.
– INPUT: A basic block B of three-address statements. Assume the symbol table
initially shows all nontemporary variables in B as being live on exit.
– OUTPUT: At each statement i : x = y + z in B, attach to i the liveness and next-
use information of x, y, and z .
– METHOD: Start at the last statement in B and scan backwards to the beginning
of B. At each statement i: x = y + z in B, do the following:
1. Attach to i the information currently found in the symbol table regarding
the next use and
liveness of x , y, and z.
2. In the symbol table, set x to "not live" and "no next use."
3. In the symbol table, set y and z to "live" and the next uses of y and z to i.
6
Storage for Temporary Names
• Each time separate name has to be created for
using temporary.
• Space and Size increased.
• Pack two temporaries in same location.
• Stored in register than Memory
Six temp to two locations t1 & t2
t1:=a*a
t2:=a*b
t2=2*t2
t1=t1+t2
t2=b*b
t1=t1+t2

More Related Content

What's hot

Lecture 6-cs345-2014
Lecture 6-cs345-2014Lecture 6-cs345-2014
Lecture 6-cs345-2014Rajiv Omar
 
Data structures final lecture 1
Data structures final  lecture 1Data structures final  lecture 1
Data structures final lecture 1Nazir Ahmed
 
Octree Encoding- used in Computational Methods
Octree Encoding- used in Computational MethodsOctree Encoding- used in Computational Methods
Octree Encoding- used in Computational MethodsAditya Deshpande
 
Three way join in one round on hadoop
Three way join in one round on hadoopThree way join in one round on hadoop
Three way join in one round on hadoopIraj Hedayati
 
One Algorithm to Rule Them All: How to Automate Statistical Computation
One Algorithm to Rule Them All: How to Automate Statistical ComputationOne Algorithm to Rule Them All: How to Automate Statistical Computation
One Algorithm to Rule Them All: How to Automate Statistical ComputationWork-Bench
 
Sparse matrices
Sparse matricesSparse matrices
Sparse matricesZain Zafar
 
Φύλλο Εργασίας 2 | Η έννοια της διάστασης
Φύλλο Εργασίας 2 | Η έννοια της διάστασηςΦύλλο Εργασίας 2 | Η έννοια της διάστασης
Φύλλο Εργασίας 2 | Η έννοια της διάστασηςΘΑΛΗΣ + ΦΙΛΟΙ
 
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashingKrish_ver2
 
BFS & Interval Graph Introduction
BFS & Interval Graph IntroductionBFS & Interval Graph Introduction
BFS & Interval Graph Introductionnazlitemu
 
Tries - Tree Based Structures for Strings
Tries - Tree Based Structures for StringsTries - Tree Based Structures for Strings
Tries - Tree Based Structures for StringsAmrinder Arora
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithmmans_1201
 
Logic
LogicLogic
LogicHamxi
 

What's hot (19)

Calc 4.4b
Calc 4.4bCalc 4.4b
Calc 4.4b
 
Lecture 6-cs345-2014
Lecture 6-cs345-2014Lecture 6-cs345-2014
Lecture 6-cs345-2014
 
logarithms
logarithmslogarithms
logarithms
 
aa+bb=cc
aa+bb=ccaa+bb=cc
aa+bb=cc
 
Data structures final lecture 1
Data structures final  lecture 1Data structures final  lecture 1
Data structures final lecture 1
 
Octree Encoding- used in Computational Methods
Octree Encoding- used in Computational MethodsOctree Encoding- used in Computational Methods
Octree Encoding- used in Computational Methods
 
Three way join in one round on hadoop
Three way join in one round on hadoopThree way join in one round on hadoop
Three way join in one round on hadoop
 
METHOD
METHOD METHOD
METHOD
 
One Algorithm to Rule Them All: How to Automate Statistical Computation
One Algorithm to Rule Them All: How to Automate Statistical ComputationOne Algorithm to Rule Them All: How to Automate Statistical Computation
One Algorithm to Rule Them All: How to Automate Statistical Computation
 
Lattices
LatticesLattices
Lattices
 
Data Applied: Clustering
Data Applied: ClusteringData Applied: Clustering
Data Applied: Clustering
 
Sparse matrices
Sparse matricesSparse matrices
Sparse matrices
 
Φύλλο Εργασίας 2 | Η έννοια της διάστασης
Φύλλο Εργασίας 2 | Η έννοια της διάστασηςΦύλλο Εργασίας 2 | Η έννοια της διάστασης
Φύλλο Εργασίας 2 | Η έννοια της διάστασης
 
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashing
 
Final
FinalFinal
Final
 
BFS & Interval Graph Introduction
BFS & Interval Graph IntroductionBFS & Interval Graph Introduction
BFS & Interval Graph Introduction
 
Tries - Tree Based Structures for Strings
Tries - Tree Based Structures for StringsTries - Tree Based Structures for Strings
Tries - Tree Based Structures for Strings
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithm
 
Logic
LogicLogic
Logic
 

Similar to Complier

Similar to Complier (7)

CPM2013-tabei201306
CPM2013-tabei201306CPM2013-tabei201306
CPM2013-tabei201306
 
FS Mod2@AzDOCUMENTS.in.pdf
FS Mod2@AzDOCUMENTS.in.pdfFS Mod2@AzDOCUMENTS.in.pdf
FS Mod2@AzDOCUMENTS.in.pdf
 
Optimization of basic blocks
Optimization of basic blocksOptimization of basic blocks
Optimization of basic blocks
 
03 programming 1
03 programming 103 programming 1
03 programming 1
 
SPAA11
SPAA11SPAA11
SPAA11
 
The dag representation of basic blocks
The dag representation of basic blocksThe dag representation of basic blocks
The dag representation of basic blocks
 
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
 

Recently uploaded

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
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
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 

Recently uploaded (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
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
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 

Complier

  • 1.
  • 2. Next-use information Introduction: we collect next-use information about names in basic blocks. if the name in a register is no longer needed, then the register can be assigned to some other name. This idea of keeping a name in storage only if it will be used subsequently can be applied in a number of contexts.
  • 3. Next-use information • Computing Next Uses • Storage for Temporary Names
  • 4. Computing next uses • The use of a name in a three-address statement: – Three-address statement i assigns a value to x – Statement j has x as an operand – Control can flow from statement i to j along a path that has no intervening assignments to x – Then statement j uses the value of x computed at i . – Say that x is live at statement i . 4
  • 5. Next-use information If the algorithms generating intermediate code or optimizing the code permit certain temporaries to be used across blocks, these too must be considered live. it would be a good idea to mark any such temporaries, so we do not have to consider all temporaries live.
  • 6. Next-Use Information • Algorithm (for x=y+z) : Determining the liveness and next-use information for each statement in a basic block. – INPUT: A basic block B of three-address statements. Assume the symbol table initially shows all nontemporary variables in B as being live on exit. – OUTPUT: At each statement i : x = y + z in B, attach to i the liveness and next- use information of x, y, and z . – METHOD: Start at the last statement in B and scan backwards to the beginning of B. At each statement i: x = y + z in B, do the following: 1. Attach to i the information currently found in the symbol table regarding the next use and liveness of x , y, and z. 2. In the symbol table, set x to "not live" and "no next use." 3. In the symbol table, set y and z to "live" and the next uses of y and z to i. 6
  • 7. Storage for Temporary Names • Each time separate name has to be created for using temporary. • Space and Size increased. • Pack two temporaries in same location. • Stored in register than Memory
  • 8. Six temp to two locations t1 & t2 t1:=a*a t2:=a*b t2=2*t2 t1=t1+t2 t2=b*b t1=t1+t2

Editor's Notes

  1. Knowing when the value of a variable will be used next is essential for generating good code. If the value of a variable that is currently in a register will never be referenced subsequently, then that register can be assigned to another variable.
  2. Here we have used + as a symbol representing any operator. If the three-address statement i is of the form x = + Y or x = y, the steps are the same as above, ignoring z. Note that the order of steps (2) and (3) may not be interchanged because x may be y or z. 第一步每当开始对一个基本块进行处理时,把块中各变量在符号表相应登记项的待用信息栏置为“无待用”,且依各变量在基本块的出口活跃与否,将相应的活跃信息栏置为“活跃”或“非活跃”。 第二步从基本块的出口开始,反向扫视基本块中的各四元式,设当前正扫视的四元式为 (i)A∶=B OP C,    对(i)依次作如下的处理:    (1) 把符号表中当前所记录之变量A,B与C的待用信息及活跃信息附加到四元式(i)上;    (2) 在符号表中,把与A相应的待用信息栏及活跃信息栏分别置为“无待用”及“非活跃”;    (3) 在符号表中,把B和C的待用信息栏均置为(i),把它们的活跃信息栏置为“活跃”。