SSA-Form Register Allocation
|
|
- Justin Greene
- 5 years ago
- Views:
Transcription
1 SSA-Form Register Allocation Foundations Sebastian Hack Compiler Construction Course Winter Term 2009/2010 saarland university computer science
2 2 Overview 1 Graph Theory Perfect Graphs Chordal Graphs 2 SSA Form Dominance φ-functions 3 Interference Graphs Non-SSA Interference Graphs Perfect Elimination Orders Chordal Graphs 4 Interference Graphs of SSA-form Programs Dominance and Liveness Dominance and Interference Spilling Implementing φ-functions 5 Intuition
3 3 Overview 1 Graph Theory Perfect Graphs Chordal Graphs 2 SSA Form Dominance φ-functions 3 Interference Graphs Non-SSA Interference Graphs Perfect Elimination Orders Chordal Graphs 4 Interference Graphs of SSA-form Programs Dominance and Liveness Dominance and Interference Spilling Implementing φ-functions 5 Intuition
4 4 Complete Graphs and Cycles Complete Graph K 5 Cycle C 5
5 5 Induced Subgraphs Graph with a C 4 subgraph Graph with a C 4 induced subgraph
6 5 Induced Subgraphs Graph with a C 4 subgraph Graph with a C 4 induced subgraph Note Induced complete graphs are called cliques
7 6 Clique number and Chromatic number Definition ω(g) Size of the largest clique in G χ(g) Number of colors in a minimum coloring of G
8 6 Clique number and Chromatic number Definition ω(g) Size of the largest clique in G χ(g) Number of colors in a minimum coloring of G Corollary ω(g) χ(g) holds for each graph G
9 6 Clique number and Chromatic number Definition ω(g) Size of the largest clique in G χ(g) Number of colors in a minimum coloring of G Corollary ω(g) χ(g) holds for each graph G ω(g) χ(g)
10 7 Perfect Graphs Definition G is perfect χ(h) = ω(h) for each induced subgraph H of G
11 7 Perfect Graphs Definition G is perfect χ(h) = ω(h) for each induced subgraph H of G perfect?
12 7 Perfect Graphs Definition G is perfect χ(h) = ω(h) for each induced subgraph H of G perfect?
13 8 Chordal Graphs Definition G is chordal G contains no induced cycles longer than 3
14 8 Chordal Graphs Definition G is chordal G contains no induced cycles longer than 3 chordal?
15 8 Chordal Graphs Definition G is chordal G contains no induced cycles longer than 3 chordal? Theorem Chordal graphs are perfect
16 8 Chordal Graphs Definition G is chordal G contains no induced cycles longer than 3 chordal? Theorem Chordal graphs are perfect Theorem Chordal graphs can be colored optimally in O( V ω(g))
17 9 Overview 1 Graph Theory Perfect Graphs Chordal Graphs 2 SSA Form Dominance φ-functions 3 Interference Graphs Non-SSA Interference Graphs Perfect Elimination Orders Chordal Graphs 4 Interference Graphs of SSA-form Programs Dominance and Liveness Dominance and Interference Spilling Implementing φ-functions 5 Intuition
18 10 Dominance Definition Every use of a variable is dominated by its definition start v v
19 10 Dominance Definition Every use of a variable is dominated by its definition start v You cannot reach the use without passing by the definition Else, you could use uninitialized variables Dominance induces a tree on the control flow graph v Sometimes called strict SSA
20 11 What do φ-functions mean? z 1 φ(x 1, y 1 ) z 2 φ(x 2, y 2 ) z 3 φ(x 3, y 3 ) z 1 x 1 z 2 x 2 z 3 x 3 z 1 y 1 z 2 y 2 z 3 y 3 Frequent misconception Put a sequence of copies in the predecessors
21 11 What do φ-functions mean? z 1 φ(x 1, y 1 ) z 2 φ(x 2, y 2 ) z 3 φ(x 3, y 3 ) z 1 x 1 z 2 x 2 z 3 x 3 z 1 y 1 z 2 y 2 z 3 y 3 Frequent misconception Put a sequence of copies in the predecessors
22 12 What do φ-functions mean? Lost Copies B B z 1 y 1 z 2 y 2 z 3 y 3 A z 1 φ(, y 1 ) z 2 φ(, y 2 ) z 3 φ(, y 3 ) C A C Cannot simply push copies in predecessor Copies are also executed if we jump from B to C Need to remove critical edges (edge from B to A)
23 12 What do φ-functions mean? Lost Copies B B z 1 y 1 z 2 y 2 z 3 y 3 A z 1 φ(, y 1 ) z 2 φ(, y 2 ) z 3 φ(, y 3 ) C A C Cannot simply push copies in predecessor Copies are also executed if we jump from B to C Need to remove critical edges (edge from B to A)
24 13 What do φ-functions mean? φ-swap z 1 z 2 z 2 z 1 z 1 φ(, z 2 ) z 2 φ(, z 1 ) z 1 overwritten before used
25 13 What do φ-functions mean? φ-swap z 1 z 2 z 2 z 1 z 1 φ(, z 2 ) z 2 φ(, z 1 ) z 1 overwritten before used
26 14 What do φ-functions mean? (z 1, z 2, z 3 ) (x 1, x 2, x 3 ) (z 1, z 2, z 3 ) (y 1, y 2, y 3 ) z 1 φ(x 1, y 1 ) z 2 φ(x 2, y 2 ) z 3 φ(x 3, y 3 ) The Reality φ-functions correspond to parallel copies on the incoming edges
27 15 φ-functions and uses z 1 φ(x 1, y 1 ) z 2 φ(x 2, y 2 ) z 3 φ(x 3, y 3 ) Does not fulfill dominance property φs do not use their operands in the φ-block Uses happen in the predecessors
28 15 φ-functions and uses φ r (x 1, x 2, x 3 ) φ r (y 1, y 2, y 3 ) z 1 φ(x 1, y 1 ) z 2 φ(x 2, y 2 ) z 3 φ(x 3, y 3 ) (z 1, z 2, z 3 ) φ w Does not fulfill dominance property φs do not use their operands in the φ-block Uses happen in the predecessors Split φ-functions in two parts: Split critical edges Read part (φ r ) in the predecessors Write part (φ w ) in the block Correct modelling of liveness
29 16 Overview 1 Graph Theory Perfect Graphs Chordal Graphs 2 SSA Form Dominance φ-functions 3 Interference Graphs Non-SSA Interference Graphs Perfect Elimination Orders Chordal Graphs 4 Interference Graphs of SSA-form Programs Dominance and Liveness Dominance and Interference Spilling Implementing φ-functions 5 Intuition
30 17 Non-SSA Interference Graphs An inconvenient property Program Interference Graph a 1 c b d 1 e a + 1 d b a + a c a + 1 e b + 1 c e d a The number of live variables at each instruction (register pressure) is 2 However, we need 3 registers for a correct register allocation In theory, this gap can be arbitrarily large (Mycielski Graphs)
31 18 Graph-Coloring Register Allocation [Chaitin 80, Briggs 92, Appel & George 96, Park & Moon 04] program changed Spill Build IG Coalesce Color coloring heuristic failed Every undirected graph can occur as an interference graph = Finding a k-coloring is NP-complete Color using heuristic = Iteration necessary Might introduce spills although IG is k-colorable Rebuilding the IG each iteration is costly
32 18 Graph-Coloring Register Allocation [Chaitin 80, Briggs 92, Appel & George 96, Park & Moon 04] program changed Spill Build IG Coalesce Color coloring heuristic failed Spill-code insertion is crucial for the program s performance Hence, it should be very sensitive to the structure of the program Place load and stores carefully Avoid spilling in loops! Here, it is merely a fail-safe for coloring
33 19 Coloring Subsequently remove the nodes from the graph d e elimination order a b c
34 19 Coloring Subsequently remove the nodes from the graph a d b e c elimination order d,
35 19 Coloring Subsequently remove the nodes from the graph a d b e c elimination order d, e,
36 19 Coloring Subsequently remove the nodes from the graph a d b e c elimination order d, e, c,
37 19 Coloring Subsequently remove the nodes from the graph a d b e c elimination order d, e, c, a,
38 19 Coloring Subsequently remove the nodes from the graph a d b e c elimination order d, e, c, a, b
39 19 Coloring Subsequently remove the nodes from the graph Re-insert the nodes in reverse order Assign each node the next possible color a d b e c elimination order d, e, c, a, b
40 19 Coloring Subsequently remove the nodes from the graph Re-insert the nodes in reverse order Assign each node the next possible color a d b e c elimination order d, e, c, a,
41 19 Coloring Subsequently remove the nodes from the graph Re-insert the nodes in reverse order Assign each node the next possible color a d b e c elimination order d, e, c,
42 19 Coloring Subsequently remove the nodes from the graph Re-insert the nodes in reverse order Assign each node the next possible color a d b e c elimination order d, e,
43 19 Coloring Subsequently remove the nodes from the graph Re-insert the nodes in reverse order Assign each node the next possible color a d b e c elimination order d,
44 19 Coloring Subsequently remove the nodes from the graph Re-insert the nodes in reverse order Assign each node the next possible color d e elimination order a b c
45 19 Coloring Subsequently remove the nodes from the graph Re-insert the nodes in reverse order Assign each node the next possible color d e elimination order a b c But... this graph is 3-colorable. We obviously picked a wrong order.
46 19 Coloring Subsequently remove the nodes from the graph Re-insert the nodes in reverse order Assign each node the next possible color d e elimination order a b c But... this graph is 3-colorable. We obviously picked a wrong order.
47 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected d e elimination order a b c
48 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected a d b e c elimination order a,
49 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected a d b e c elimination order a, c,
50 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected a d b e c elimination order a, c, d,
51 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected a d b e c elimination order a, c, d, e,
52 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected a d b e c elimination order a, c, d, e, b
53 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected a d b e c elimination order a, c, d, e,
54 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected a d b e c elimination order a, c, d,
55 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected a d b e c elimination order a, c,
56 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected a d b e c elimination order a,
57 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected d e elimination order a b c
58 20 Coloring PEOs Perfect Elimination Order (PEO) All not yet eliminated neighbors of a node are mutually connected d e elimination order a b c From Graph Theory [Berge 60, Fulkerson/Gross 65, Gavril 72] A PEO allows for an optimal coloring in k V The number of colors is bound by the size of the largest clique
59 21 Coloring PEOs Graphs with holes larger than 3 have no PEO, e.g. G has a PEO G is chordal
60 21 Coloring PEOs Graphs with holes larger than 3 have no PEO, e.g. G has a PEO G is chordal Core Theorem of SSA Register Allocation The dominance relation in SSA programs induces a PEO in the IG Thus, SSA IGs are chordal
61 22 Overview 1 Graph Theory Perfect Graphs Chordal Graphs 2 SSA Form Dominance φ-functions 3 Interference Graphs Non-SSA Interference Graphs Perfect Elimination Orders Chordal Graphs 4 Interference Graphs of SSA-form Programs Dominance and Liveness Dominance and Interference Spilling Implementing φ-functions 5 Intuition
62 23 Liveness and Dominance Each instruction l where a variable v is live, is dominated by v start v l : v
63 23 Liveness and Dominance Each instruction l where a variable v is live, is dominated by v start v l : v Why? Assume l is not dominated by v Then there s a path from start to some usage of v not containing the definition of v This cannot be since each value must have been defined before it is used
64 23 Liveness and Dominance Each instruction l where a variable v is live, is dominated by v start v l : v Why? Assume l is not dominated by v Then there s a path from start to some usage of v not containing the definition of v This cannot be since each value must have been defined before it is used
65 24 Interference and Dominance Assume v, w interfere, i.e. they are live at some instruction l Then, v l and w l Since dominance is a tree, either v w or w v v {, } w
66 24 Interference and Dominance Assume v, w interfere, i.e. they are live at some instruction l Then, v l and w l Since dominance is a tree, either v w or w v v {, } w Consequences Each edge in the IG is directed by dominance The interference graph is an excerpt of the dominance relation
67 25 Interference and Dominance Assume v w Then, v is live at w v dominance subtree of v w
68 25 Interference and Dominance Assume v w Why? Then, v is live at w v w dominance subtree of v v both live w If v and w interfere then there is a place where both are live w dominates all places where w is live Hence, v is live inside w s dominance tree Thus, v is live at w
69 26 Interference and Dominance Consider three nodes u, v, w in the IG: u??? v w
70 26 Interference and Dominance Consider three nodes u, v, w in the IG: u??? v u is live at w v is live at w w
71 26 Interference and Dominance Consider three nodes u, v, w in the IG: u or v u is live at w v is live at w w Thus, they interfere
72 26 Interference and Dominance Consider three nodes u, v, w in the IG: u or v u is live at w v is live at w w Thus, they interfere Conclusion All variables that... interfere with w dominate w... are mutually connected in the IG
73 27 Dominance and PEOs Before a value v is added to a PEO, add all values whose definitions are dominated by v A post order walk of the dominance tree defines a PEO A pre order walk of the dominance tree yields a coloring sequence IGs of SSA-form programs can be colored optimally in O(ω(G) V ) Without constructing the interference graph itself
74 28 Spilling Theorem For each clique in the IG there is a program point where all nodes in the clique are live.
75 28 Spilling Theorem For each clique in the IG there is a program point where all nodes in the clique are live. a b c d Dominance induces a total order inside the clique There is a smallest value d All others are live at the definition of d
76 29 Spilling Consequences The chromatic number of the IG is exactly determined by the number of live variables at the labels Lowering the number of values live at each label to k makes the IG k-colorable We know in advance where values must be spilled = All labels where the pressure is larger than k Spilling can be done before coloring and coloring will always succeed afterwards
77 29 Spilling Consequences The chromatic number of the IG is exactly determined by the number of live variables at the labels Lowering the number of values live at each label to k makes the IG k-colorable We know in advance where values must be spilled = All labels where the pressure is larger than k Spilling can be done before coloring and coloring will always succeed afterwards Conclusion No iteration as in Chaitin/Briggs-allocators No interference graph necessary
78 30 Getting out of SSA We now have a k-coloring of the SSA interference graph Can we turn that program into a non-ssa program and maintain the coloring?
79 30 Getting out of SSA We now have a k-coloring of the SSA interference graph Can we turn that program into a non-ssa program and maintain the coloring? Central question What to do about φ-functions?
80 31 Φ-Functions Consider following example z 1 φ(x 1, y 1 ) z 2 φ(x 2, y 2 ) z 3 φ(x 3, y 3 )
81 31 Φ-Functions Consider following example (z 1, z 2, z 3 ) (x 1, x 2, x 3 ) (z 1, z 2, z 3 ) (y 1, y 2, y 3 ) z 1 φ(x 1, y 1 ) z 2 φ(x 2, y 2 ) z 3 φ(x 3, y 3 ) Φ-functions are parallel copies on control flow edges
82 31 Φ-Functions Consider following example (z 1, z 2, z 3 ) (x 1, x 2, x 3 ) (z 1, z 2, z 3 ) (y 1, y 2, y 3 ) z 1 φ(x 1, y 1 ) z 2 φ(x 2, y 2 ) z 3 φ(x 3, y 3 ) Φ-functions are parallel copies on control flow edges Considering assigned registers...
83 31 Φ-Functions Consider following example z 1 φ(x 1, y 1 ) z 2 φ(x 2, y 2 ) z 3 φ(x 3, y 3 ) Φ-functions are parallel copies on control flow edges Considering assigned registers Φs represent register permutations
84 32 Permutations A permutation can be implemented with copies if one auxiliary register is available Permutations can be implemented by a series of transpositions (i.e. swaps) = A transposition can be implemented by three xors without a third register
85 33 Intuition: Why do SSA IGs do not have cycles? Why are SSA IGs chordal? Program a b c d a + b e c + 1 Live Ranges a b c d e Interference Graph a b e c d How can we create a 4-cycle {a, c, d, e}?
86 33 Intuition: Why do SSA IGs do not have cycles? Why are SSA IGs chordal? Program a b c d a + b e c + 1 a Live Ranges a b c d e a Interference Graph a b e c d How can we create a 4-cycle {a, c, d, e}? Redefine a = SSA violated!
87 34 Intuition: φ-functions break cycles in the IG Program and live ranges a d e a + d b c a + e b c Interference Graph d a e b c
88 34 Intuition: φ-functions break cycles in the IG Program and live ranges a d e 1 a + d b c a + e 2 b c Interference Graph d a e 1 e 3 e 3 φ(e 1, e 2 ) b c e 2
89 35 Intuition: Why destroying SSA before RA is bad Parallel copies (a, b, c, d ) (a, b, c, d) Sequential copies d d c c b b a a
90 35 Intuition: Why destroying SSA before RA is bad Parallel copies (a, b, c, d ) (a, b, c, d) a b c d Sequential copies a b c d d d c c b b a a a b c d a b c d
91 35 Intuition: Why destroying SSA before RA is bad Parallel copies (a, b, c, d ) (a, b, c, d) a b c d Sequential copies a b c d d d c c b b a a a b c d a b c d
92 36 Summary IGs of SSA-form programs are chordal The dominance relation induces a PEO No further spills after pressure is lowered Register assignment optimal in linear time Do not need to construct interference graph Allocator without iteration Spill Color Φ-Impl. Coalesce
Register Allocation. Register Allocation. Local Register Allocation. Live range. Register Allocation for Loops
DF00100 Advanced Compiler Construction Register Allocation Register Allocation: Determines values (variables, temporaries, constants) to be kept when in registers Register Assignment: Determine in which
More informationRegister allocation for programs in SSA-form
Register allocation for programs in SSA-form Sebastian Hack, Daniel Grund, and Gerhard Goos Fakultät für Informatik Universität Karlsruhe (hack daniel ggoos)@ipd.info.uni-karlsruhe.de Abstract. As register
More informationHow many colors are needed to color a map?
How many colors are needed to color a map? Is 4 always enough? Two relevant concepts How many colors do we need to color a map so neighboring countries get different colors? Simplifying assumption (not
More informationTowards Register Allocation for Programs in SSA-form
Towards Register Allocation for Programs in SSA-form Sebastian Hack, Daniel Grund, Gerhard Goos (hack daniel ggoos)@ipdinfouni-karlsruhede Institut für Programmstrukturen und Datenorganisation Fakultät
More informationColouring graphs with no odd holes
Colouring graphs with no odd holes Paul Seymour (Princeton) joint with Alex Scott (Oxford) 1 / 17 Chromatic number χ(g): minimum number of colours needed to colour G. 2 / 17 Chromatic number χ(g): minimum
More informationRegister Allocation. Global Register Allocation Webs and Graph Coloring Node Splitting and Other Transformations
Register Allocation Global Register Allocation Webs and Graph Coloring Node Splitting and Other Transformations Copyright 2015, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class
More informationAbstract. A graph G is perfect if for every induced subgraph H of G, the chromatic number of H is equal to the size of the largest clique of H.
Abstract We discuss a class of graphs called perfect graphs. After defining them and getting intuition with a few simple examples (and one less simple example), we present a proof of the Weak Perfect Graph
More informationGraphs and Discrete Structures
Graphs and Discrete Structures Nicolas Bousquet Louis Esperet Fall 2018 Abstract Brief summary of the first and second course. É 1 Chromatic number, independence number and clique number The chromatic
More informationSmall Survey on Perfect Graphs
Small Survey on Perfect Graphs Michele Alberti ENS Lyon December 8, 2010 Abstract This is a small survey on the exciting world of Perfect Graphs. We will see when a graph is perfect and which are families
More informationCSC D70: Compiler Optimization Register Allocation
CSC D70: Compiler Optimization Register Allocation Prof. Gennady Pekhimenko University of Toronto Winter 2018 The content of this lecture is adapted from the lectures of Todd Mowry and Phillip Gibbons
More informationVertex coloring, chromatic number
Vertex coloring, chromatic number A k-coloring of a graph G is a labeling f : V (G) S, where S = k. The labels are called colors; the vertices of one color form a color class. A k-coloring is proper if
More informationChordal Graphs: Theory and Algorithms
Chordal Graphs: Theory and Algorithms 1 Chordal graphs Chordal graph : Every cycle of four or more vertices has a chord in it, i.e. there is an edge between two non consecutive vertices of the cycle. Also
More informationVertex coloring, chromatic number
Vertex coloring, chromatic number A k-coloring of a graph G is a labeling f : V (G) S, where S = k. The labels are called colors; the vertices of one color form a color class. A k-coloring is proper if
More informationChordal graphs MPRI
Chordal graphs MPRI 2017 2018 Michel Habib habib@irif.fr http://www.irif.fr/~habib Sophie Germain, septembre 2017 Schedule Chordal graphs Representation of chordal graphs LBFS and chordal graphs More structural
More informationStudying Optimal Spilling in the light of SSA
Studying Optimal Spilling in the light of SSA Quentin Colombet, Florian Brandner and Alain Darte Compsys, LIP, UMR 5668 CNRS, INRIA, ENS-Lyon, UCB-Lyon Journées compilation, Rennes, France, June 18-20
More informationStatic 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 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 informationMATH 350 GRAPH THEORY & COMBINATORICS. Contents
MATH 350 GRAPH THEORY & COMBINATORICS PROF. SERGEY NORIN, FALL 2013 Contents 1. Basic definitions 1 2. Connectivity 2 3. Trees 3 4. Spanning Trees 3 5. Shortest paths 4 6. Eulerian & Hamiltonian cycles
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 informationLecture Notes on Register Allocation
Lecture Notes on Register Allocation 15-411: Compiler Design Frank Pfenning Lecture 3 September 1, 2009 1 Introduction In this lecture we discuss register allocation, which is one of the last steps in
More informationOutline. Register Allocation. Issues. Storing values between defs and uses. Issues. Issues P3 / 2006
P3 / 2006 Register Allocation What is register allocation Spilling More Variations and Optimizations Kostis Sagonas 2 Spring 2006 Storing values between defs and uses Program computes with values value
More informationCSC 373: Algorithm Design and Analysis Lecture 4
CSC 373: Algorithm Design and Analysis Lecture 4 Allan Borodin January 14, 2013 1 / 16 Lecture 4: Outline (for this lecture and next lecture) Some concluding comments on optimality of EST Greedy Interval
More informationIntroduction to Graph Theory
Introduction to Graph Theory Tandy Warnow January 20, 2017 Graphs Tandy Warnow Graphs A graph G = (V, E) is an object that contains a vertex set V and an edge set E. We also write V (G) to denote the vertex
More informationRegister Allocation via Coloring of Chordal Graphs
Register Allocation via Coloring of Chordal Graphs Fernando Magno Quintão Pereira and Jens Palsberg UCLA Computer Science Department University of California, Los Angeles Abstract. We present a simple
More informationThe C2 Register Allocator. Niclas Adlertz
The C2 Register Allocator Niclas Adlertz 1 1 Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated
More informationMock Exam. Juanjo Rué Discrete Mathematics II, Winter Deadline: 14th January 2014 (Tuesday) by 10:00, at the end of the lecture.
Mock Exam Juanjo Rué Discrete Mathematics II, Winter 2013-2014 Deadline: 14th January 2014 (Tuesday) by 10:00, at the end of the lecture. Problem 1 (2 points): 1. State the definition of perfect graph
More informationCompiler Design. Register Allocation. Hwansoo Han
Compiler Design Register Allocation Hwansoo Han Big Picture of Code Generation Register allocation Decides which values will reside in registers Changes the storage mapping Concerns about placement of
More informationarxiv: v2 [cs.ds] 18 May 2015
Optimal Shuffle Code with Permutation Instructions Sebastian Buchwald, Manuel Mohr, and Ignaz Rutter Karlsruhe Institute of Technology {sebastian.buchwald, manuel.mohr, rutter}@kit.edu arxiv:1504.07073v2
More informationCode generation for modern processors
Code generation for modern processors Definitions (1 of 2) What are the dominant performance issues for a superscalar RISC processor? Refs: AS&U, Chapter 9 + Notes. Optional: Muchnick, 16.3 & 17.1 Instruction
More informationCode generation for modern processors
Code generation for modern processors What are the dominant performance issues for a superscalar RISC processor? Refs: AS&U, Chapter 9 + Notes. Optional: Muchnick, 16.3 & 17.1 Strategy il il il il asm
More informationApril 15, 2015 More Register Allocation 1. Problem Register values may change across procedure calls The allocator must be sensitive to this
More Register Allocation Last time Register allocation Global allocation via graph coloring Today More register allocation Procedure calls Interprocedural April 15, 2015 More Register Allocation 1 Register
More informationRegister Allocation 3/16/11. What a Smart Allocator Needs to Do. Global Register Allocation. Global Register Allocation. Outline.
What a Smart Allocator Needs to Do Register Allocation Global Register Allocation Webs and Graph Coloring Node Splitting and Other Transformations Determine ranges for each variable can benefit from using
More informationFaster parameterized algorithms for Minimum Fill-In
Faster parameterized algorithms for Minimum Fill-In Hans L. Bodlaender Pinar Heggernes Yngve Villanger Abstract We present two parameterized algorithms for the Minimum Fill-In problem, also known as Chordal
More informationLecture 6. Register Allocation. I. Introduction. II. Abstraction and the Problem III. Algorithm
I. Introduction Lecture 6 Register Allocation II. Abstraction and the Problem III. Algorithm Reading: Chapter 8.8.4 Before next class: Chapter 10.1-10.2 CS243: Register Allocation 1 I. Motivation Problem
More informationOn the Rainbow Neighbourhood Number of Set-Graphs
On the Rainbow Neighbourhood Number of Set-Graphs Johan Kok, Sudev Naduvath arxiv:1712.02324v1 [math.gm] 6 Dec 2017 Centre for Studies in Discrete Mathematics Vidya Academy of Science & Technology Thalakkottukara,
More informationRegister Allocation via Hierarchical Graph Coloring
Register Allocation via Hierarchical Graph Coloring by Qunyan Wu A THESIS Submitted in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE IN COMPUTER SCIENCE MICHIGAN TECHNOLOGICAL
More informationwith Dana Richards December 1, 2017 George Mason University New Results On Routing Via Matchings Indranil Banerjee The Routing Model
New New with Dana Richards George Mason University richards@gmu.edu December 1, 2017 GMU December 1, 2017 1 / 40 New Definitions G(V, E) is an undirected graph. V = {1, 2, 3,..., n}. A pebble at vertex
More informationChapter 8 Independence
Chapter 8 Independence Section 8.1 Vertex Independence and Coverings Next, we consider a problem that strikes close to home for us all, final exams. At the end of each term, students are required to take
More informationarxiv: v2 [math.co] 25 May 2016
arxiv:1605.06638v2 [math.co] 25 May 2016 A note on a conjecture of Gyárfás Ryan R. Martin Abstract This note proves that, given one member, T, of a particular family of radius-three trees, every radius-two,
More informationCharacterizations of graph classes by forbidden configurations
Characterizations of graph classes by forbidden configurations Zdeněk Dvořák September 14, 2015 We consider graph classes that can be described by excluding some fixed configurations. Let us give some
More informationA graph is a mathematical structure for representing relationships.
Graphs Part Two A graph is a mathematical structure for representing relationships. Nodes A graph consists of a set of nodes (or vertices) connected by edges (or arcs) A graph is a mathematical structure
More informationHow many colors are needed to color a map?
How many colors are needed to color a map? Is 4 always enough? Two relevant concepts How many colors do we need to color a map so neighboring countries get different colors? Simplifying assumption (not
More informationGlobal Register Allocation via Graph Coloring
Global Register Allocation via Graph Coloring Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit permission
More informationList of Theorems. Mat 416, Introduction to Graph Theory. Theorem 1 The numbers R(p, q) exist and for p, q 2,
List of Theorems Mat 416, Introduction to Graph Theory 1. Ramsey s Theorem for graphs 8.3.11. Theorem 1 The numbers R(p, q) exist and for p, q 2, R(p, q) R(p 1, q) + R(p, q 1). If both summands on the
More informationBayesian Networks, Winter Yoav Haimovitch & Ariel Raviv
Bayesian Networks, Winter 2009-2010 Yoav Haimovitch & Ariel Raviv 1 Chordal Graph Warm up Theorem 7 Perfect Vertex Elimination Scheme Maximal cliques Tree Bibliography M.C.Golumbic Algorithmic Graph Theory
More informationRegister Allocation. 2. register contents, namely which variables, constants, or intermediate results are currently in a register, and
Register Allocation Introduction The main idea behind good register allocation is to keep variables and constants in registers as long as possible and to never spill intermediate results into memory. Thus,
More informationRegister Allocation. Stanford University CS243 Winter 2006 Wei Li 1
Register Allocation Wei Li 1 Register Allocation Introduction Problem Formulation Algorithm 2 Register Allocation Goal Allocation of variables (pseudo-registers) in a procedure to hardware registers Directly
More informationModule 6 NP-Complete Problems and Heuristics
Module 6 NP-Complete Problems and Heuristics Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu P, NP-Problems Class
More informationGlobal Register Allocation - Part 3
Global Register Allocation - Part 3 Y N Srikant Computer Science and Automation Indian Institute of Science Bangalore 560012 NPTEL Course on Compiler Design Outline Issues in Global Register Allocation
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 informationFaster parameterized algorithms for Minimum Fill-In
Faster parameterized algorithms for Minimum Fill-In Hans L. Bodlaender Pinar Heggernes Yngve Villanger Technical Report UU-CS-2008-042 December 2008 Department of Information and Computing Sciences Utrecht
More informationQuality and Speed in Linear-Scan Register Allocation
Quality and Speed in Linear-Scan Register Allocation A Thesis presented by Omri Traub to Computer Science in partial fulfillment of the honors requirements for the degree of Bachelor of Arts Harvard College
More informationNetwork flows and Menger s theorem
Network flows and Menger s theorem Recall... Theorem (max flow, min cut strong duality). Let G be a network. The maximum value of a flow equals the minimum capacity of a cut. We prove this strong duality
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 informationA Survey of the Algorithmic Properties of Simplicial, Upper Bound and Middle Graphs
Journal of Graph Algorithms and Applications http://jgaa.info/ vol. 10, no. 2, pp. 159 190 (2006) A Survey of the Algorithmic Properties of Simplicial, Upper Bound and Middle Graphs Grant A. Cheston Tjoen
More informationRegister Allocation in Just-in-Time Compilers: 15 Years of Linear Scan
Register Allocation in Just-in-Time Compilers: 15 Years of Linear Scan Kevin Millikin Google 13 December 2013 Register Allocation Overview Register allocation Intermediate representation (IR): arbitrarily
More informationRegister Allocation. Note by Baris Aktemur: Our slides are adapted from Cooper and Torczon s slides that they prepared for COMP 412 at Rice.
Register Allocation Note by Baris Aktemur: Our slides are adapted from Cooper and Torczon s slides that they prepared for COMP at Rice. Copyright 00, Keith D. Cooper & Linda Torczon, all rights reserved.
More informationDynamic programming. Trivial problems are solved first More complex solutions are composed from the simpler solutions already computed
Dynamic programming Solves a complex problem by breaking it down into subproblems Each subproblem is broken down recursively until a trivial problem is reached Computation itself is not recursive: problems
More informationLecture Notes on Graph Theory
Lecture Notes on Graph Theory Vadim Lozin 1 Introductory concepts A graph G = (V, E) consists of two finite sets V and E. The elements of V are called the vertices and the elements of E the edges of G.
More informationFall Compiler Principles Lecture 12: Register Allocation. Roman Manevich Ben-Gurion University
Fall 2014-2015 Compiler Principles Lecture 12: Register Allocation Roman Manevich Ben-Gurion University Syllabus Front End Intermediate Representation Optimizations Code Generation Scanning Lowering Local
More informationModule 6 P, NP, NP-Complete Problems and Approximation Algorithms
Module 6 P, NP, NP-Complete Problems and Approximation Algorithms Dr. Natarajan Meghanathan Associate Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu
More informationRegister Allocation & Liveness Analysis
Department of Computer Sciences Register Allocation & Liveness Analysis CS502 Purdue University is an Equal Opportunity/Equal Access institution. Department of Computer Sciences In IR tree code generation,
More informationDiskrete Mathematik und Optimierung
Diskrete Mathematik und Optimierung Stephan Dominique Andres: On Characterizing Game-Perfect Graphs by Forbidden Induced Subgraphs Technical Report feu-dmo021.10 Contact: dominique.andres@fernuni-hagen.de
More informationBipartite Roots of Graphs
Bipartite Roots of Graphs Lap Chi Lau Department of Computer Science University of Toronto Graph H is a root of graph G if there exists a positive integer k such that x and y are adjacent in G if and only
More informationCS 406/534 Compiler Construction Putting It All Together
CS 406/534 Compiler Construction Putting It All Together Prof. Li Xu Dept. of Computer Science UMass Lowell Fall 2004 Part of the course lecture notes are based on Prof. Keith Cooper, Prof. Ken Kennedy
More informationLecture 21 CIS 341: COMPILERS
Lecture 21 CIS 341: COMPILERS Announcements HW6: Analysis & Optimizations Alias analysis, constant propagation, dead code elimination, register allocation Available Soon Due: Wednesday, April 25 th Zdancewic
More informationDiscrete mathematics II. - Graphs
Emil Vatai April 25, 2018 Basic definitions Definition of an undirected graph Definition (Undirected graph) An undirected graph or (just) a graph is a triplet G = (ϕ, E, V ), where V is the set of vertices,
More informationMultiagent Graph Coloring: Pareto Efficiency, Fairness and Individual Rationality By Yaad Blum, Jeffrey S. Rosenchein
Multiagent Graph Coloring: Pareto Efficiency, Fairness and Individual Rationality By Yaad Blum, Jeffrey S. Rosenchein Presented by: Simina Brânzei Outline Introduction Background Coloring from an Economics
More informationOn Sequential Topogenic Graphs
Int. J. Contemp. Math. Sciences, Vol. 5, 2010, no. 36, 1799-1805 On Sequential Topogenic Graphs Bindhu K. Thomas, K. A. Germina and Jisha Elizabath Joy Research Center & PG Department of Mathematics Mary
More informationMaximal Independent Set
Chapter 0 Maximal Independent Set In this chapter we present a highlight of this course, a fast maximal independent set (MIS) algorithm. The algorithm is the first randomized algorithm that we study in
More informationMaximum number of edges in claw-free graphs whose maximum degree and matching number are bounded
Maximum number of edges in claw-free graphs whose maximum degree and matching number are bounded Cemil Dibek Tınaz Ekim Pinar Heggernes Abstract We determine the maximum number of edges that a claw-free
More informationAdvanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret
Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret Greedy Algorithms (continued) The best known application where the greedy algorithm is optimal is surely
More informationRegister allocation. Overview
Register allocation Register allocation Overview Variables may be stored in the main memory or in registers. { Main memory is much slower than registers. { The number of registers is strictly limited.
More informationExcluding induced subgraphs
Excluding induced subgraphs Maria Chudnovsky and Paul Seymour Abstract 1 Introduction Given two graphs, G and H, we say that H is an induced subgraph of G if V (H) V (G), and two vertices of H are adjacent
More informationMinimal Dominating Sets in Graphs: Enumeration, Combinatorial Bounds and Graph Classes
Minimal Dominating Sets in Graphs: Enumeration, Combinatorial Bounds and Graph Classes J.-F. Couturier 1 P. Heggernes 2 D. Kratsch 1 P. van t Hof 2 1 LITA Université de Lorraine F-57045 Metz France 2 University
More informationON VERTEX b-critical TREES. Mostafa Blidia, Noureddine Ikhlef Eschouf, and Frédéric Maffray
Opuscula Math. 33, no. 1 (2013), 19 28 http://dx.doi.org/10.7494/opmath.2013.33.1.19 Opuscula Mathematica ON VERTEX b-critical TREES Mostafa Blidia, Noureddine Ikhlef Eschouf, and Frédéric Maffray Communicated
More informationAlgorithm design in Perfect Graphs N.S. Narayanaswamy IIT Madras
Algorithm design in Perfect Graphs N.S. Narayanaswamy IIT Madras What is it to be Perfect? Introduced by Claude Berge in early 1960s Coloring number and clique number are one and the same for all induced
More informationGraph Theory. Connectivity, Coloring, Matching. Arjun Suresh 1. 1 GATE Overflow
Graph Theory Connectivity, Coloring, Matching Arjun Suresh 1 1 GATE Overflow GO Classroom, August 2018 Thanks to Subarna/Sukanya Das for wonderful figures Arjun, Suresh (GO) Graph Theory GATE 2019 1 /
More informationLecture 15 Register Allocation & Spilling
I. Motivation Lecture 15 Register Allocation & Spilling I. Introduction II. Abstraction and the Problem III. Algorithm IV. Spilling Problem Allocation of variables (pseudo-registers) to hardware registers
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 informationCS 406/534 Compiler Construction Instruction Selection and Global Register Allocation
CS 406/534 Compiler Construction Instruction Selection and Global Register Allocation Prof. Li Xu Dept. of Computer Science UMass Lowell Fall 2004 Part of the course lecture notes are based on Prof. Keith
More informationDisjoint directed cycles
Disjoint directed cycles Noga Alon Abstract It is shown that there exists a positive ɛ so that for any integer k, every directed graph with minimum outdegree at least k contains at least ɛk vertex disjoint
More informationDiskrete Mathematik und Optimierung
Diskrete Mathematik und Optimierung Stephan Dominique Andres Winfried Hochstättler: A strong perfect digraph theorem Technical Report feu-dmo026.11 Contact: dominique.andres@fernuni-hagen.de, winfried.hochstaettler@fernuni-hagen.de
More informationBachelor Seminar Complexity Analysis of Register Allocation
Bachelor Seminar Complexity Analysis of Register Allocation Markus Koenig Embedded Systems Group, University of Kaiserslautern m koenig13@cs.uni-kl.de Abstract Register allocation is the task of assigning
More informationRegister Allocation 1
Register Allocation 1 Lecture Outline Memory Hierarchy Management Register Allocation Register interference graph Graph coloring heuristics Spilling Cache Management The Memory Hierarchy Registers < 1
More information8 Colouring Planar Graphs
8 Colouring Planar Graphs The Four Colour Theorem Lemma 8.1 If G is a simple planar graph, then (i) 12 v V (G)(6 deg(v)) with equality for triangulations. (ii) G has a vertex of degree 5. Proof: For (i),
More informationregister allocation saves energy register allocation reduces memory accesses.
Lesson 10 Register Allocation Full Compiler Structure Embedded systems need highly optimized code. This part of the course will focus on Back end code generation. Back end: generation of assembly instructions
More informationEE512 Graphical Models Fall 2009
EE512 Graphical Models Fall 2009 Prof. Jeff Bilmes University of Washington, Seattle Department of Electrical Engineering Fall Quarter, 2009 http://ssli.ee.washington.edu/~bilmes/ee512fa09 Lecture 11 -
More informationThe Structure and Properties of Clique Graphs of Regular Graphs
The University of Southern Mississippi The Aquila Digital Community Master's Theses 1-014 The Structure and Properties of Clique Graphs of Regular Graphs Jan Burmeister University of Southern Mississippi
More informationMultiway Search Trees
Multiway Search Trees Intuitive Definition A multiway search tree is one with nodes that have two or more children. Within each node is stored a given key, which is associated to an item we wish to access
More informationMAT 145: PROBLEM SET 6
MAT 145: PROBLEM SET 6 DUE TO FRIDAY MAR 8 Abstract. This problem set corresponds to the eighth week of the Combinatorics Course in the Winter Quarter 2019. It was posted online on Friday Mar 1 and is
More informationProbabilistic Graphical Models
Probabilistic Graphical Models Raquel Urtasun and Tamir Hazan TTI Chicago April 22, 2011 Raquel Urtasun and Tamir Hazan (TTI-C) Graphical Models April 22, 2011 1 / 22 If the graph is non-chordal, then
More informationRegister Allocation. Lecture 16
Register Allocation Lecture 16 1 Register Allocation This is one of the most sophisticated things that compiler do to optimize performance Also illustrates many of the concepts we ve been discussing in
More informationProblem Set 3. MATH 776, Fall 2009, Mohr. November 30, 2009
Problem Set 3 MATH 776, Fall 009, Mohr November 30, 009 1 Problem Proposition 1.1. Adding a new edge to a maximal planar graph of order at least 6 always produces both a T K 5 and a T K 3,3 subgraph. Proof.
More informationA taste of perfect graphs (continued)
A taste of perfect graphs (continued) Recall two theorems from last class characterizing perfect graphs (and that we observed that the α ω theorem implied the Perfect Graph Theorem). Perfect Graph Theorem.
More informationClass Six: Coloring Planar Graphs
Class Six: Coloring Planar Graphs A coloring of a graph is obtained by assigning every vertex a color such that if two vertices are adjacent, then they receive different colors. Drawn below are three different
More informationMatching Theory. Figure 1: Is this graph bipartite?
Matching Theory 1 Introduction A matching M of a graph is a subset of E such that no two edges in M share a vertex; edges which have this property are called independent edges. A matching M is said to
More informationMatchings and Covers in bipartite graphs
Matchings and Covers in bipartite graphs A bipartite graph, also called a bigraph, is a set of graph vertices decomposed into two disjoint sets such that no two graph vertices within the same set are adjacent.
More information4. (a) Draw the Petersen graph. (b) Use Kuratowski s teorem to prove that the Petersen graph is non-planar.
UPPSALA UNIVERSITET Matematiska institutionen Anders Johansson Graph Theory Frist, KandMa, IT 010 10 1 Problem sheet 4 Exam questions Solve a subset of, say, four questions to the problem session on friday.
More informationAn Effective Upperbound on Treewidth Using Partial Fill-in of Separators
An Effective Upperbound on Treewidth Using Partial Fill-in of Separators Boi Faltings Martin Charles Golumbic June 28, 2009 Abstract Partitioning a graph using graph separators, and particularly clique
More information