Simple and Efficient Construction of Static Single Assignment Form
|
|
- Blaise Blake
- 6 years ago
- Views:
Transcription
1 Simple and Efficient Construction of Static Single Assignment Form saarland university Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau computer science Institute for Program Structures and Data Organization, Karlsruhe Institute of Technology (KIT) 1 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and KIT University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association
2 Modern Intermediate Representations Optimization Optimization SSA AST non-ssa Two-phase approach: Construct non-ssa intermediate representation from AST Compute dominance tree Compute liveness Construct SSA form 2 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
3 Simple and Efficient SSA Construction Optimization Optimization SSA AST non-ssa Our SSA construction algorithm Requires no prior analysis Constructs SSA form directly from AST 3 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
4 Straight-Line Code Data structure: For each basic block: Mapping Variables Values Code: a = 42; b = a; a = a + b; IR: v 0 : 42 v 1 : v 0 + v 0 Mapping: "a" v 0 4 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
5 Straight-Line Code Data structure: For each basic block: Mapping Variables Values Code: a = 42; b = a; a = a + b; IR: v 0 : 42 v 1 : v 0 + v 0 Mapping: "a" v 0 "b" v 0 4 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
6 Straight-Line Code Data structure: For each basic block: Mapping Variables Values Code: a = 42; b = a; a = a + b; IR: v 0 : 42 v 1 : v 0 + v 0 Mapping: "a" v 0 "b" v 0 4 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
7 Straight-Line Code Data structure: For each basic block: Mapping Variables Values Code: a = 42; b = a; a = a + b; IR: v 0 : 42 v 1 : v 0 + v 0 Mapping: "a" v 1 "b" v 0 4 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
8 Properties of Basic Blocks Filled All code of this block has already been constructed Existing mapping will not change Sealed The block is connected to all its direct control flow predecessors All direct control flow predecessors are filled 5 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
9 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { start Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
10 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { start v 0 :... Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
11 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { while start v 0 :... Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
12 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { while start v 0 :... if Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
13 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { while start v 0 :... if Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
14 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { then while start v 0 :... if Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
15 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { start while v 1 :... then v 0 :... if Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
16 Handling Multiple Basic Blocks start v 0 :... void foo(void) { while (...) { if (...) { while v 1 :... then if endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
17 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { v 0 :... start while if v 1 :... then use(v? ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
18 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { then while start v 1 :... v 0 :... if v 2 : φ(v?, v? ) use(v? ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
19 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { then while start v 1 :... v 0 :... if v 2 : φ(v 1, v? ) use(v? ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
20 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { then while start v 3 : v 1 :... v 0 :... if v 2 : φ(v 1, v 3 ) use(v? ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
21 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { then while start v 3 : v 1 :... v 0 :... if v 2 : φ(v 1, v 3 ) use(v 2 ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
22 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { then while start v 3 : v 1 :... v 0 :... if v 2 : φ(v 1, v 3 ) use(v 2 ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
23 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { then while start v 3 : v 1 :... v 0 :... if v 2 : φ(v 1, v 3 ) use(v 2 ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
24 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { then while start v 1 :... v 0 :... v 3 : φ(v?, v? ) if v 2 : φ(v 1, v 3 ) use(v 2 ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
25 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { then while start v 1 :... v 0 :... v 3 : φ(v 0, v? ) if v 2 : φ(v 1, v 3 ) use(v 2 ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
26 Handling Multiple Basic Blocks void foo(void) { while (...) { if (...) { then while start v 1 :... v 0 :... v 3 : φ(v 0, v 2 ) if v 2 : φ(v 1, v 3 ) use(v 2 ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
27 Handling Multiple Basic Blocks start v 0 :... void foo(void) { while (...) { if (...) { end then while v 1 :... v 3 : φ(v 0, v 2 ) if v 2 : φ(v 1, v 3 ) use(v 2 ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
28 Handling Multiple Basic Blocks start v 0 :... void foo(void) { while (...) { if (...) { end use(v? ) then while v 1 :... v 3 : φ(v 0, v 2 ) if v 2 : φ(v 1, v 3 ) use(v 2 ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
29 Handling Multiple Basic Blocks start v 0 :... void foo(void) { while (...) { if (...) { end use(v 3 ) then while v 1 :... v 3 : φ(v 0, v 2 ) if v 2 : φ(v 1, v 3 ) use(v 2 ) endif Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
30 Guarantees for Constructed SSA Form Pruned SSA form No dead φ functions. Minimal SSA form (Cytron et al.) φ functions only occur at iterated dominance frontiers.? 7 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
31 Trivial φ Functions v 0 :... v 0 :... v 1 : φ(v 0, v 1 ) v 1 : φ(v 0, v 0 ) use(v 1 ) use(v 1 ) Trivial φ function Just references one value (except itself) 8 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
32 Optimization of Trivial φ Functions v v v φ 0 φ 1 φ 1 Optimization of trivial φ functions Replace trivial φ function by its unique operand Iterative approach to remove all trivial φ functions 9 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
33 Guarantees for Constructed SSA Form Theorem A program in SSA form with a reducible control flow graph without any trivial φ functions is in minimal SSA form. Pruned SSA form No dead φ functions. Minimal SSA form (Cytron et al.) φ functions only occur at iterated dominance frontiers. for Java and most C programs 10 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
34 Irreducible Control Flow v 0 :... v 1 : φ(v 0,v 2 ) v 2 : φ(v 0,v 1 ) v 0 φ 1 φ 2 use use(v 2 ) Redundant set of φ functions Generalization of trivial φ functions Just reference one value (except themselves) 11 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
35 Redundant φ Functions and SCCs v φ 0 φ 1 φ 2 Lemma Let P be a redundant set of φ functions. Then there is a strongly connected component S P that is also redundant. 12 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
36 Optimization of Redundant φ Functions x y x y x y φ 0 φ 0 φ 0 φ 1 φ 1 φ 2 φ 2 Algorithm to find all redundant φ functions Use Tarjan s algorithm to find φ-sccs of maximum size If SCC is not redundant: Check for redundant inner SCC 13 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
37 New Criterion for Minimal SSA Form Definition (Minimal SSA form (SCC)) A program is in minimal SSA form if it contains no redundant φ-sccs. Advantages Independent of the source program Implies Cytron et al. s criterion 14 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
38 Optimizations and φ-sccs void foo(void) { x = 42 while (...) { if (...) { x = 42 then end use(v 3 ) while start v 1 : 42 v 0 : 42 v 3 : φ(v 0, v 2 ) if v 2 : φ(v 1, v 3 ) use(v 2 ) endif 15 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
39 Guarantees for Constructed SSA Form Pruned SSA form No dead φ functions. Minimal SSA form (Cytron et al.) φ functions only occur at iterated dominance frontiers. Minimal SSA form (SCC) No redundant φ-scc. Can we have even fewer φ functions? 16 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
40 On-the-Fly Optimizations int bar(int x) { int mask = 0; int res; if (x & mask) { res = 0; else { res = x; return res; v 0 : x v 1 : 0 v 2 : v 0 & v 1 v 3 : v 2 = 0 condjump v 3 v 5 : φ(v 1,v 0 ) return v 5 17 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
41 On-the-Fly Optimizations int bar(int x) { int mask = 0; int res; if (x & mask) { res = 0; else { res = x; return res; v 0 : x v 0 : x v 1 : 0 v 2 : v 0 & v 1 v 3 : v 2 = 0 condjump v 3 v 5 : φ(v 1,v 0 ) return v 5 17 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
42 On-the-Fly Optimizations int bar(int x) { int mask = 0; int res; if (x & mask) { res = 0; else { res = x; return res; v 0 : x v 1 : 0 v 0 : x v 1 : 0 v 2 : v 0 & v 1 v 3 : v 2 = 0 condjump v 3 v 5 : φ(v 1,v 0 ) return v 5 17 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
43 On-the-Fly Optimizations int bar(int x) { int mask = 0; int res; if (x & mask) { res = 0; else { res = x; return res; v 0 : x v 1 : 0 v 3 : false v 0 : x v 1 : 0 v 2 : v 0 & v 1 v 3 : v 2 = 0 condjump v 3 v 5 : φ(v 1,v 0 ) return v 5 17 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
44 On-the-Fly Optimizations int bar(int x) { int mask = 0; int res; if (x & mask) { res = 0; else { res = x; return res; v 0 : x v 1 : 0 v 3 : false v 0 : x v 1 : 0 v 2 : v 0 & v 1 v 3 : v 2 = 0 condjump v 3 v 5 : φ(v 1,v 0 ) return v 5 17 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
45 On-the-Fly Optimizations int bar(int x) { int mask = 0; int res; if (x & mask) { res = 0; else { res = x; return res; v 0 : x v 1 : 0 v 3 : false return v 0 v 0 : x v 1 : 0 v 2 : v 0 & v 1 v 3 : v 2 = 0 condjump v 3 v 5 : φ(v 1,v 0 ) return v 5 17 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
46 Evaluation Setup Setup to evaluate our SSA construction algorithm Full-fledged implementation in cparser/libfirm Proof-of-concept implementation in clang/llvm Comparison against existing SSA construction algorithm Sreedhar and Gao Better than Cytron et al. Highly-tuned implementation C programs of SPEC CINT2000 benchmark 18 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
47 Number of Constructed IR Instructions non-ssa Benchmark LLVM SSA non-ssa SSA 164.gzip 12,038 9, % 175.vpr 40,701 27, % 176.gcc 516, , % 181.mcf 3,988 2, % 186.crafty 44,891 36, % 197.parser 30,237 20, % 253.perlbmk 185, , % 254.gap 201, , % 255.vortex 126,097 88, % 256.bzip2 8,605 6, % 300.twolf 76,078 58, % Average 138% 19 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
48 Quality Comparison Benchmark Number of φ functions Redundant φ-sccs LLVM Our Optimization Irreducible 164.gzip vpr 1,201 1, gcc 12,904 12, mcf crafty 1,466 1, parser 1,243 1, perlbmk 5,840 5, gap 9,325 9, vortex 2,739 2, bzip twolf 2,849 2, Sum 38,674 38, March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
49 Compilation Speed Benchmark LLVM Our Our LLVM 164.gzip 969,233, ,798, % 175.vpr 3,039,801,575 3,025,286, % 176.gcc 25,935,984,569 26,009,545, % 181.mcf 722,918, ,507, % 186.crafty 3,653,881,430 3,632,605, % 197.parser 2,084,205,254 2,068,075, % 253.perlbmk 12,246,953,644 12,062,833, % 254.gap 8,358,757,289 8,339,871, % 255.vortex 7,841,416,740 7,845,699, % 256.bzip2 569,176, ,577, % 300.twolf 6,424,027,368 6,408,289, % Average 99.59% 21 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
50 Conclusion Summary Simple SSA construction algorithm: 375 LOC vs LOC Guarantees minimal and pruned SSA form Can reuse conservative optimizations New criterion for minimal SSA form A lot more in the paper Give it a try! 22 March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and
Static single assignment
Static single assignment Control-flow graph Loop-nesting forest Static single assignment SSA with dominance property Unique definition for each variable. Each definition dominates its uses. Static single
More information8. Static Single Assignment Form. Marcus Denker
8. Static Single Assignment Form Marcus Denker Roadmap > Static Single Assignment Form (SSA) > Converting to SSA Form > Examples > Transforming out of SSA 2 Static Single Assignment Form > Goal: simplify
More informationShengyue Wang, Xiaoru Dai, Kiran S. Yellajyosula, Antonia Zhai, Pen-Chung Yew Department of Computer Science & Engineering University of Minnesota
Loop Selection for Thread-Level Speculation, Xiaoru Dai, Kiran S. Yellajyosula, Antonia Zhai, Pen-Chung Yew Department of Computer Science & Engineering University of Minnesota Chip Multiprocessors (CMPs)
More informationSSA-based Register Allocation with PBQP
SSA-based Register Allocation with PBQP Sebastian Buchwald, Andreas Zwinkau, and Thomas Bersch Karlsruhe Institute of Technology (KIT) {buchwald,zwinkau}@kit.edu thomas.bersch@student.kit.edu Abstract.
More information6. Intermediate Representation
6. Intermediate Representation Oscar Nierstrasz Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes. http://www.cs.ucla.edu/~palsberg/
More informationSSA Construction. Daniel Grund & Sebastian Hack. CC Winter Term 09/10. Saarland University
SSA Construction Daniel Grund & Sebastian Hack Saarland University CC Winter Term 09/10 Outline Overview Intermediate Representations Why? How? IR Concepts Static Single Assignment Form Introduction Theory
More informationA Practical and Fast Iterative Algorithm for φ-function Computation Using DJ Graphs
A Practical and Fast Iterative Algorithm for φ-function Computation Using DJ Graphs Dibyendu Das U. Ramakrishna ACM Transactions on Programming Languages and Systems May 2005 Humayun Zafar Outline Introduction
More informationImprovements to Linear Scan register allocation
Improvements to Linear Scan register allocation Alkis Evlogimenos (alkis) April 1, 2004 1 Abstract Linear scan register allocation is a fast global register allocation first presented in [PS99] as an alternative
More informationSSA-Based Register Allocation with PBQP
SSA-Based Register Allocation with PBQP Sebastian Buchwald, Andreas Zwinkau, and Thomas Bersch Karlsruhe Institute of Technology (KIT) {buchwald,zwinkau}@kit.edu, thomas.bersch@student.kit.edu Abstract.
More information6. Intermediate Representation!
6. Intermediate Representation! Prof. O. Nierstrasz! Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.! http://www.cs.ucla.edu/~palsberg/!
More informationChip-Multithreading Systems Need A New Operating Systems Scheduler
Chip-Multithreading Systems Need A New Operating Systems Scheduler Alexandra Fedorova Christopher Small Daniel Nussbaum Margo Seltzer Harvard University, Sun Microsystems Sun Microsystems Sun Microsystems
More informationControl-Flow Analysis
Control-Flow Analysis Dragon book [Ch. 8, Section 8.4; Ch. 9, Section 9.6] Compilers: Principles, Techniques, and Tools, 2 nd ed. by Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jerey D. Ullman on reserve
More informationStatic Single Assignment Form in the COINS Compiler Infrastructure
Static Single Assignment Form in the COINS Compiler Infrastructure Masataka Sassa (Tokyo Institute of Technology) Background Static single assignment (SSA) form facilitates compiler optimizations. Compiler
More informationSemantics of an Intermediate Language for Program Transformation
Semantics of an Intermediate Language for Program Transformation Sigurd Schneider Advisors: Sebastian Hack, Gert Smolka Student Session at POPL 2013 Saarland University Graduate School of Computer Science
More informationInlining Java Native Calls at Runtime
Inlining Java Native Calls at Runtime (CASCON 2005 4 th Workshop on Compiler Driven Performance) Levon Stepanian, Angela Demke Brown Computer Systems Group Department of Computer Science, University of
More informationVerified Construction of Static Single Assignment Form
Verified Construction of Static Single Assignment Form Sebastian Buchwald Denis Lohner Sebastian Ullrich Karlsruhe Institute of Technology, Germany {sebastian.buchwald, denis.lohner}@kit.edu sebastian.ullrich@student.kit.edu
More informationCSE P 501 Compilers. SSA Hal Perkins Spring UW CSE P 501 Spring 2018 V-1
CSE P 0 Compilers SSA Hal Perkins Spring 0 UW CSE P 0 Spring 0 V- Agenda Overview of SSA IR Constructing SSA graphs Sample of SSA-based optimizations Converting back from SSA form Sources: Appel ch., also
More informationEffective Memory Protection Using Dynamic Tainting
Effective Memory Protection Using Dynamic Tainting James Clause Alessandro Orso (software) and Ioanis Doudalis Milos Prvulovic (hardware) College of Computing Georgia Institute of Technology Supported
More informationAn Overview of GCC Architecture (source: wikipedia) Control-Flow Analysis and Loop Detection
An Overview of GCC Architecture (source: wikipedia) CS553 Lecture Control-Flow, Dominators, Loop Detection, and SSA Control-Flow Analysis and Loop Detection Last time Lattice-theoretic framework for data-flow
More informationLLVM and IR Construction
LLVM and IR Construction Fabian Ritter based on slides by Christoph Mallon and Johannes Doerfert http://compilers.cs.uni-saarland.de Compiler Design Lab Saarland University 1 Project Progress source code
More informationBumyong Choi Leo Porter Dean Tullsen University of California, San Diego ASPLOS
Bumyong Choi Leo Porter Dean Tullsen University of California, San Diego ASPLOS 2008 1 Multi-core proposals take advantage of additional cores to improve performance, power, and/or reliability Moving towards
More informationAPPENDIX Summary of Benchmarks
158 APPENDIX Summary of Benchmarks The experimental results presented throughout this thesis use programs from four benchmark suites: Cyclone benchmarks (available from [Cyc]): programs used to evaluate
More informationLow-Complexity Reorder Buffer Architecture*
Low-Complexity Reorder Buffer Architecture* Gurhan Kucuk, Dmitry Ponomarev, Kanad Ghose Department of Computer Science State University of New York Binghamton, NY 13902-6000 http://www.cs.binghamton.edu/~lowpower
More informationData Structures and Algorithms in Compiler Optimization. Comp314 Lecture Dave Peixotto
Data Structures and Algorithms in Compiler Optimization Comp314 Lecture Dave Peixotto 1 What is a compiler Compilers translate between program representations Interpreters evaluate their input to produce
More informationAutomatic Selection of Compiler Options Using Non-parametric Inferential Statistics
Automatic Selection of Compiler Options Using Non-parametric Inferential Statistics Masayo Haneda Peter M.W. Knijnenburg Harry A.G. Wijshoff LIACS, Leiden University Motivation An optimal compiler optimization
More informationFlow-sensitive Alias Analysis
Flow-sensitive Alias Analysis Last time Client-Driven pointer analysis Today Demand DFA paper Scalable flow-sensitive alias analysis March 30, 2015 Flow-Sensitive Alias Analysis 1 Recall Previous Flow-Sensitive
More informationATOS introduction ST/Linaro Collaboration Context
ATOS introduction ST/Linaro Collaboration Context Presenter: Christian Bertin Development team: Rémi Duraffort, Christophe Guillon, François de Ferrière, Hervé Knochel, Antoine Moynault Consumer Product
More informationPreference-Guided Register Assignment
Preference-Guided Register Assignment Matthias Braun 1, Christoph Mallon 2, and Sebastian Hack 2 1 Karlsruhe Institute of Technology matthias.braun@kit.edu 2 Computer Science Department Saarland University
More informationBreaking Cyclic-Multithreading Parallelization with XML Parsing. Simone Campanoni, Svilen Kanev, Kevin Brownell Gu-Yeon Wei, David Brooks
Breaking Cyclic-Multithreading Parallelization with XML Parsing Simone Campanoni, Svilen Kanev, Kevin Brownell Gu-Yeon Wei, David Brooks 0 / 21 Scope Today s commodity platforms include multiple cores
More informationSVF: Static Value-Flow Analysis in LLVM
SVF: Static Value-Flow Analysis in LLVM Yulei Sui, Peng Di, Ding Ye, Hua Yan and Jingling Xue School of Computer Science and Engineering The University of New South Wales 2052 Sydney Australia March 18,
More informationRegister Packing Exploiting Narrow-Width Operands for Reducing Register File Pressure
Register Packing Exploiting Narrow-Width Operands for Reducing Register File Pressure Oguz Ergin*, Deniz Balkan, Kanad Ghose, Dmitry Ponomarev Department of Computer Science State University of New York
More informationCONTROL FLOW ANALYSIS. The slides adapted from Vikram Adve
CONTROL FLOW ANALYSIS The slides adapted from Vikram Adve Flow Graphs Flow Graph: A triple G=(N,A,s), where (N,A) is a (finite) directed graph, s N is a designated initial node, and there is a path from
More informationIntermediate representation
Intermediate representation Goals: encode knowledge about the program facilitate analysis facilitate retargeting facilitate optimization scanning parsing HIR semantic analysis HIR intermediate code gen.
More informationIntermediate Representation (IR)
Intermediate Representation (IR) Components and Design Goals for an IR IR encodes all knowledge the compiler has derived about source program. Simple compiler structure source code More typical compiler
More informationAccuracy Enhancement by Selective Use of Branch History in Embedded Processor
Accuracy Enhancement by Selective Use of Branch History in Embedded Processor Jong Wook Kwak 1, Seong Tae Jhang 2, and Chu Shik Jhon 1 1 Department of Electrical Engineering and Computer Science, Seoul
More informationCompiler Construction 2016/2017 Loop Optimizations
Compiler Construction 2016/2017 Loop Optimizations Peter Thiemann January 16, 2017 Outline 1 Loops 2 Dominators 3 Loop-Invariant Computations 4 Induction Variables 5 Array-Bounds Checks 6 Loop Unrolling
More informationMicroarchitecture Overview. Performance
Microarchitecture Overview Prof. Scott Rixner Duncan Hall 3028 rixner@rice.edu January 18, 2005 Performance 4 Make operations faster Process improvements Circuit improvements Use more transistors to make
More informationThe Designing and Implementation of A SSA-based register allocator
The Designing and Implementation of A SSA-based register allocator Fernando Magno Quintao Pereira UCLA - University of California, Los Angeles Abstract. The register allocation problem has an exact polynomial
More informationParameterized Construction of Program Representations for Sparse Dataflow Analyses
Parameterized Construction of Program Representations for Sparse Dataflow Analyses André L. C. Tavares 1, Mariza A. S. Bigonha 1, Roberto S. Bigonha 1, Benoit Boissinot 2, Fernando M. Q. Pereira 1 and
More informationA Cost Effective Spatial Redundancy with Data-Path Partitioning. Shigeharu Matsusaka and Koji Inoue Fukuoka University Kyushu University/PREST
A Cost Effective Spatial Redundancy with Data-Path Partitioning Shigeharu Matsusaka and Koji Inoue Fukuoka University Kyushu University/PREST 1 Outline Introduction Data-path Partitioning for a dependable
More informationSpeculative Multithreaded Processors
Guri Sohi and Amir Roth Computer Sciences Department University of Wisconsin-Madison utline Trends and their implications Workloads for future processors Program parallelization and speculative threads
More informationWhat If. Static Single Assignment Form. Phi Functions. What does φ(v i,v j ) Mean?
Static Single Assignment Form What If Many of the complexities of optimization and code generation arise from the fact that a given variable may be assigned to in many different places. Thus reaching definition
More informationComputing Static Single Assignment (SSA) Form. Control Flow Analysis. Overview. Last Time. Constant propagation Dominator relationships
Control Flow Analysis Last Time Constant propagation Dominator relationships Today Static Single Assignment (SSA) - a sparse program representation for data flow Dominance Frontier Computing Static Single
More informationAries: Transparent Execution of PA-RISC/HP-UX Applications on IPF/HP-UX
Aries: Transparent Execution of PA-RISC/HP-UX Applications on IPF/HP-UX Keerthi Bhushan Rajesh K Chaurasia Hewlett-Packard India Software Operations 29, Cunningham Road Bangalore 560 052 India +91-80-2251554
More informationStatic Single Assignment (SSA) Form
Static Single Assignment (SSA) Form A sparse program representation for data-flow. CSL862 SSA form 1 Computing Static Single Assignment (SSA) Form Overview: What is SSA? Advantages of SSA over use-def
More informationHomework I - Solution
CS 426 Fall 2017 1 Homework I - Solution Homework I - Solution CS 426 Compiler Construction Fall Semester 2017 1. (50 points) Intermediate representations: (a) (25 points) Construct a Control-Flow Graph
More informationCIS 341 Final Examination 3 May 2011
CIS 341 Final Examination 3 May 2011 1 /16 2 /20 3 /40 4 /28 5 /16 Total /120 Do not begin the exam until you are told to do so. You have 120 minutes to complete the exam. There are 12 pages in this exam.
More informationCOMPILER OPTIMIZATION EFFECTS ON REGISTER COLLISIONS. A Thesis. presented to. the Faculty of California Polytechnic State University, San Luis Obispo
COMPILER OPTIMIZATION EFFECTS ON REGISTER COLLISIONS A Thesis presented to the Faculty of California Polytechnic State University, San Luis Obispo In Partial Fulfillment of the Requirements for the Degree
More informationRevisiting Out-of-SSA Translation for Correctness, Code Quality, and Efficiency
Revisiting Out-of-SSA Translation for Correctness, Code Quality, and Efficiency Benoit Boissinot, Alain Darte, Fabrice Rastello, Benoît Dupont de Dinechin, Christophe Guillon To cite this version: Benoit
More informationMemory Prefetching for the GreenDroid Microprocessor. David Curran December 10, 2012
Memory Prefetching for the GreenDroid Microprocessor David Curran December 10, 2012 Outline Memory Prefetchers Overview GreenDroid Overview Problem Description Design Placement Prediction Logic Simulation
More informationPOSH: A TLS Compiler that Exploits Program Structure
POSH: A TLS Compiler that Exploits Program Structure Wei Liu, James Tuck, Luis Ceze, Wonsun Ahn, Karin Strauss, Jose Renau and Josep Torrellas Department of Computer Science University of Illinois at Urbana-Champaign
More informationIntFlow: Integer Error Handling With Information Flow Tracking
mpomonis@cs.columbia.edu IntFlow Columbia University 1 / 29 IntFlow: Integer Error Handling With Information Flow Tracking Marios Pomonis Theofilos Petsios Kangkook Jee Michalis Polychronakis Angelos D.
More informationCompiler Construction 2009/2010 SSA Static Single Assignment Form
Compiler Construction 2009/2010 SSA Static Single Assignment Form Peter Thiemann March 15, 2010 Outline 1 Static Single-Assignment Form 2 Converting to SSA Form 3 Optimization Algorithms Using SSA 4 Dependencies
More informationExecution-based Prediction Using Speculative Slices
Execution-based Prediction Using Speculative Slices Craig Zilles and Guri Sohi University of Wisconsin - Madison International Symposium on Computer Architecture July, 2001 The Problem Two major barriers
More informationOutline. Speculative Register Promotion Using Advanced Load Address Table (ALAT) Motivation. Motivation Example. Motivation
Speculative Register Promotion Using Advanced Load Address Table (ALAT Jin Lin, Tong Chen, Wei-Chung Hsu, Pen-Chung Yew http://www.cs.umn.edu/agassiz Motivation Outline Scheme of speculative register promotion
More informationStrato: A Retargetable Framework for Low- Level Inlined Reference Monitors
Strato: A Retargetable Framework for Low- Level Inlined Reference Monitors Bin Zeng, Gang Tan, Úlfar Erlingsson Lehigh University Google Inc. USENIX Security 2013 @Washington DC, USA ASacks How asacks
More informationMicroarchitecture Overview. Performance
Microarchitecture Overview Prof. Scott Rixner Duncan Hall 3028 rixner@rice.edu January 15, 2007 Performance 4 Make operations faster Process improvements Circuit improvements Use more transistors to make
More informationAdvanced C Programming
Advanced C Programming Compilers Sebastian Hack hack@cs.uni-sb.de Christoph Weidenbach weidenbach@mpi-inf.mpg.de 20.01.2009 saarland university computer science 1 Contents Overview Optimizations Program
More informationImplementation and Evaluation of Link Time Optimization with libfirm
Institut für Programmstrukturen und Datenorganisation (IPD) Lehrstuhl Prof. Dr.-Ing. Snelting Implementation and Evaluation of Link Time Optimization with libfirm Bachelorarbeit von Mark Weinreuter an
More informationAn Analysis of the Performance Impact of Wrong-Path Memory References on Out-of-Order and Runahead Execution Processors
An Analysis of the Performance Impact of Wrong-Path Memory References on Out-of-Order and Runahead Execution Processors Onur Mutlu Hyesoon Kim David N. Armstrong Yale N. Patt High Performance Systems Group
More informationAn Analysis of the Amount of Global Level Redundant Computation in the SPEC 95 and SPEC 2000 Benchmarks
An Analysis of the Amount of Global Level Redundant Computation in the SPEC 95 and SPEC 2000 s Joshua J. Yi and David J. Lilja Department of Electrical and Computer Engineering Minnesota Supercomputing
More informationAccelerating Dynamic Detection of Uses of Undefined Values with Static Value-Flow Analysis
Accelerating Dynamic Detection of Uses of Undefined Values with Static Value-Flow Analysis Ding Ye Yulei Sui Jingling Xue Programming Languages and Compilers Group School of Computer Science and Engineering
More informationPunctual Coalescing. Fernando Magno Quintão Pereira
Punctual Coalescing Fernando Magno Quintão Pereira Register Coalescing Register coalescing is an op7miza7on on top of register alloca7on. The objec7ve is to map both variables used in a copy instruc7on
More informationA Sparse Algorithm for Predicated Global Value Numbering
Sparse Predicated Global Value Numbering A Sparse Algorithm for Predicated Global Value Numbering Karthik Gargi Hewlett-Packard India Software Operation PLDI 02 Monday 17 June 2002 1. Introduction 2. Brute
More informationStatic Memory Leak Detection Using Full-Sparse Value-Flow Analysis
Static Memory Leak Detection Using Full-Sparse Value-Flow Analysis Yulei Sui, Ding Ye, Jingling Xue School of Computer Science and Engineering University of New South Wales 2052 Australia July 19, 2012
More informationInstruction Selection on SSA Graphs
Instruction Selection on SSA Graphs Sebastian Hack, Sebastian Buchwald, Andreas Zwinkau Compiler ruction Course Winter Term 2009/2010 saarland university computer science 2 Instruction Selection Load ia32
More information2D-Profiling: Detecting Input-Dependent Branches with a Single Input Data Set
2D-Profiling: Detecting Input-Dependent Branches with a Single Input Data Set Hyesoon Kim M. Aater Suleman Onur Mutlu Yale N. Patt Department of Electrical and Computer Engineering University of Texas
More informationSpeeding up context-, object- and field-sensitive SDG generation
Speeding up context-, object- and field-sensitive SDG generation Jürgen Graf IPD, PROGRAMMING PARADIGMS GROUP, COMPUTER SCIENCE DEPARTMENT KIT - University of the State of Baden-Wuerttemberg and National
More informationECE 5775 (Fall 17) High-Level Digital Design Automation. Static Single Assignment
ECE 5775 (Fall 17) High-Level Digital Design Automation Static Single Assignment Announcements HW 1 released (due Friday) Student-led discussions on Tuesday 9/26 Sign up on Piazza: 3 students / group Meet
More informationStatic Single Assignment Form in the COINS Compiler Infrastructure - Current Status and Background -
Static Single Assignment Form in the COINS Compiler Infrastructure - Current Status and Background - Masataka Sassa, Toshiharu Nakaya, Masaki Kohama (Tokyo Institute of Technology) Takeaki Fukuoka, Masahito
More informationECE 5775 High-Level Digital Design Automation Fall More CFG Static Single Assignment
ECE 5775 High-Level Digital Design Automation Fall 2018 More CFG Static Single Assignment Announcements HW 1 due next Monday (9/17) Lab 2 will be released tonight (due 9/24) Instructor OH cancelled this
More informationSparse Conditional Constant Propagation
CS738: Advanced Compiler Optimizations Sparse Simple Constant Propagation (SSC) Sparse Conditional Constant Propagation Amey Karkare karkare@cse.iitk.ac.in Improved analysis time over Simple Constant Propagation
More informationWish Branch: A New Control Flow Instruction Combining Conditional Branching and Predicated Execution
Wish Branch: A New Control Flow Instruction Combining Conditional Branching and Predicated Execution Hyesoon Kim Onur Mutlu Jared Stark David N. Armstrong Yale N. Patt High Performance Systems Group Department
More informationDesign of Experiments - Terminology
Design of Experiments - Terminology Response variable Measured output value E.g. total execution time Factors Input variables that can be changed E.g. cache size, clock rate, bytes transmitted Levels Specific
More informationA New Elimination-Based Data Flow Analysis Framework Using Annotated Decomposition Trees
A New Elimination-Based Data Flow Analysis Framework Using Annotated Decomposition Trees Bernhard Scholz 1 and Johann Blieberger 2 1 The University of Sydney 2 Technische Universität Wien Abstract. We
More informationSingle-Pass Generation of Static Single Assignment Form for Structured Languages
1 Single-Pass Generation of Static Single Assignment Form for Structured Languages MARC M. BRANDIS and HANSPETER MÖSSENBÖCK ETH Zürich, Institute for Computer Systems Over the last few years, static single
More informationSSA-Form Register Allocation
SSA-Form Register Allocation Foundations Sebastian Hack Compiler Construction Course Winter Term 2009/2010 saarland university computer science 2 Overview 1 Graph Theory Perfect Graphs Chordal Graphs 2
More informationInserting Data Prefetches into Loops in Dynamically Translated Code in IA-32EL. Inserting Prefetches IA-32 Execution Layer - 1
I Inserting Data Prefetches into Loops in Dynamically Translated Code in IA-32EL Inserting Prefetches IA-32 Execution Layer - 1 Agenda IA-32EL Brief Overview Prefetching in Loops IA-32EL Prefetching in
More informationEECS 583 Class 16 Research Topic 1 Automatic Parallelization
EECS 583 Class 16 Research Topic 1 Automatic Parallelization University of Michigan November 7, 2012 Announcements + Reading Material Midterm exam: Mon Nov 19 in class (Next next Monday)» I will post 2
More informationSparse Conditional Constant Propagation
CS738: Advanced Compiler Optimizations 2011-12 IInd Semester Sparse Simple Constant Propagation (SSC) Sparse Conditional Constant Propagation Amey Karkare karkare@cse.iitk.ac.in Improved analysis time
More informationCompiler Construction 2010/2011 Loop Optimizations
Compiler Construction 2010/2011 Loop Optimizations Peter Thiemann January 25, 2011 Outline 1 Loop Optimizations 2 Dominators 3 Loop-Invariant Computations 4 Induction Variables 5 Array-Bounds Checks 6
More informationControl Flow Analysis & Def-Use. Hwansoo Han
Control Flow Analysis & Def-Use Hwansoo Han Control Flow Graph What is CFG? Represents program structure for internal use of compilers Used in various program analyses Generated from AST or a sequential
More informationLecture Compiler Middle-End
Lecture 16-18 18 Compiler Middle-End Jianwen Zhu Electrical and Computer Engineering University of Toronto Jianwen Zhu 2009 - P. 1 What We Have Done A lot! Compiler Frontend Defining language Generating
More informationJosé F. Martínez 1, Jose Renau 2 Michael C. Huang 3, Milos Prvulovic 2, and Josep Torrellas 2
CHERRY: CHECKPOINTED EARLY RESOURCE RECYCLING José F. Martínez 1, Jose Renau 2 Michael C. Huang 3, Milos Prvulovic 2, and Josep Torrellas 2 1 2 3 MOTIVATION Problem: Limited processor resources Goal: More
More informationTopic I (d): Static Single Assignment Form (SSA)
Topic I (d): Static Single Assignment Form (SSA) 621-10F/Topic-1d-SSA 1 Reading List Slides: Topic Ix Other readings as assigned in class 621-10F/Topic-1d-SSA 2 ABET Outcome Ability to apply knowledge
More informationAdvanced Compilers CMPSCI 710 Spring 2003 Computing SSA
Advanced Compilers CMPSCI 70 Spring 00 Computing SSA Emery Berger University of Massachusetts, Amherst More SSA Last time dominance SSA form Today Computing SSA form Criteria for Inserting f Functions
More informationComputer System. Performance
Computer System Performance Virendra Singh Associate Professor Computer Architecture and Dependable Systems Lab Department of Electrical Engineering Indian Institute of Technology Bombay http://www.ee.iitb.ac.in/~viren/
More informationCOS 320. Compiling Techniques
Topic 14: Parallelism COS 320 Compiling Techniques Princeton University Spring 2015 Prof. David August 1 Final Exam! Friday May 22 at 1:30PM in FRIEND 006 Closed book One Front/Back 8.5x11 2 Moore s Law
More informationSparse Conditional Constant Propagation
CS618: Program Analysis 2016-17 I st Semester Sparse Simple Constant Propagation (SSC) Sparse Conditional Constant Propagation Amey Karkare karkare@cse.iitk.ac.in karkare@cse.iitb.ac.in Improved analysis
More informationConditional Elimination through Code Duplication
Conditional Elimination through Code Duplication Joachim Breitner May 27, 2011 We propose an optimizing transformation which reduces program runtime at the expense of program size by eliminating conditional
More informationRegister allocation. Register allocation: ffl have value in a register when used. ffl limited resources. ffl changes instruction choices
Register allocation IR instruction selection register allocation machine code errors Register allocation: have value in a register when used limited resources changes instruction choices can move loads
More informationA Bad Name. CS 2210: Optimization. Register Allocation. Optimization. Reaching Definitions. Dataflow Analyses 4/10/2013
A Bad Name Optimization is the process by which we turn a program into a better one, for some definition of better. CS 2210: Optimization This is impossible in the general case. For instance, a fully optimizing
More informationIntermediate Representations. Reading & Topics. Intermediate Representations CS2210
Intermediate Representations CS2210 Lecture 11 Reading & Topics Muchnick: chapter 6 Topics today: Intermediate representations Automatic code generation with pattern matching Optimization Overview Control
More informationCIS 341 Final Examination 4 May 2017
CIS 341 Final Examination 4 May 2017 1 /14 2 /15 3 /12 4 /14 5 /34 6 /21 7 /10 Total /120 Do not begin the exam until you are told to do so. You have 120 minutes to complete the exam. There are 14 pages
More informationPhi-Predication for Light-Weight If-Conversion
Phi-Predication for Light-Weight If-Conversion Weihaw Chuang Brad Calder Jeanne Ferrante Benefits of If-Conversion Eliminates hard to predict branches Important for deep pipelines How? Executes all paths
More informationArchitecture Cloning For PowerPC Processors. Edwin Chan, Raul Silvera, Roch Archambault IBM Toronto Lab Oct 17 th, 2005
Architecture Cloning For PowerPC Processors Edwin Chan, Raul Silvera, Roch Archambault edwinc@ca.ibm.com IBM Toronto Lab Oct 17 th, 2005 Outline Motivation Implementation Details Results Scenario Previously,
More informationTowards an SSA based compiler back-end: some interesting properties of SSA and its extensions
Towards an SSA based compiler back-end: some interesting properties of SSA and its extensions Benoit Boissinot Équipe Compsys Laboratoire de l Informatique du Parallélisme (LIP) École normale supérieure
More information7. Optimization! Prof. O. Nierstrasz! Lecture notes by Marcus Denker!
7. Optimization! Prof. O. Nierstrasz! Lecture notes by Marcus Denker! Roadmap > Introduction! > Optimizations in the Back-end! > The Optimizer! > SSA Optimizations! > Advanced Optimizations! 2 Literature!
More informationChapter 10. Improving the Runtime Type Checker Type-Flow Analysis
122 Chapter 10 Improving the Runtime Type Checker The runtime overhead of the unoptimized RTC is quite high, because it instruments every use of a memory location in the program and tags every user-defined
More informationSSA Based Mobile Code: Construction and Empirical Evaluation
SSA Based Mobile Code: Construction and Empirical Evaluation Wolfram Amme Friedrich Schiller University Jena, Germany Michael Franz Universit of California, Irvine, USA Jeffery von Ronne Universtity of
More information