topic 8: control flow · basic block - run of code with single entry and exit. control flow graph...
TRANSCRIPT
![Page 1: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/1.jpg)
1
Topic 8: Control Flow
COS 320
Compiling Techniques
Princeton University Spring 2015
Prof. David August
![Page 2: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/2.jpg)
The Front End
![Page 3: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/3.jpg)
The Back End
![Page 4: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/4.jpg)
Optimization
![Page 5: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/5.jpg)
Register Allocation
![Page 6: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/6.jpg)
Scheduling
![Page 7: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/7.jpg)
Analysis
![Page 8: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/8.jpg)
Control Flow Analysis
![Page 9: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/9.jpg)
Control Flow Analysis Example
![Page 10: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/10.jpg)
Basic Blocks
![Page 11: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/11.jpg)
Basic Block Example
![Page 12: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/12.jpg)
Domination Motivation
![Page 13: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/13.jpg)
Dominator Analysis
![Page 14: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/14.jpg)
Dominator Analysis
![Page 15: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/15.jpg)
Dominator Analysis Example
![Page 16: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/16.jpg)
Immediate Dominator/Dominator Tree
![Page 17: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/17.jpg)
Immediate Dominator Example
![Page 18: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/18.jpg)
Post Dominator
![Page 19: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/19.jpg)
Loop Optimization
![Page 20: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/20.jpg)
Examples of Loops
![Page 21: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/21.jpg)
Back Edges
![Page 22: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/22.jpg)
Natural Loops
![Page 23: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/23.jpg)
Loop Optimization
![Page 24: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/24.jpg)
Loop Optimization
![Page 25: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/25.jpg)
Loop Optimization
![Page 26: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/26.jpg)
Non-Loop Cycles
![Page 27: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/27.jpg)
Non-Loop Cycles
![Page 28: Topic 8: Control Flow · Basic Block - run of code with single entry and exit. Control flow graph of basic blocks more convenient. Determine by the following: l. Find leaders: (a)](https://reader033.vdocuments.us/reader033/viewer/2022050222/5f67b1837950447f7241b280/html5/thumbnails/28.jpg)
Node Splitting