## Structured Programs have Small Tree-Width and Good Register Allocation (1995)

Venue: | Information and Computation |

Citations: | 55 - 1 self |

### BibTeX

@ARTICLE{Thorup95structuredprograms,

author = {Mikkel Thorup},

title = {Structured Programs have Small Tree-Width and Good Register Allocation},

journal = {Information and Computation},

year = {1995},

volume = {142},

pages = {318--332}

}

### Years of Citing Articles

### OpenURL

### Abstract

The register allocation problem for an imperative program is often modelled as the coloring problem of the interference graph of the control-flow graph of the program. The interference graph of a flow graph G is the intersection graph of some connected subgraphs of G. These connected subgraphs represent the lives, or life times, of variables, so the coloring problem models that two variables with overlapping life times should be in different registers. For general programs with unrestricted gotos, the interference graph can be any graph, and hence we cannot in general color within a factor O(n " ) from optimality unless NP=P. It is shown that if a graph has tree-width k, we can efficiently color any intersection graph of connected subgraphs within a factor (bk=2c + 1) from optimality. Moreover, it is shown that structured (j goto-free) programs, including, for example, short circuit evaluations and multiple exits from loops, have tree-width at most 6. Thus, for every structured progr...

### Citations

1292 | The C Programming Language
- Kernighan, Ritchie
- 1978
(Show Context)
Citation Context ...ts. This might get us beyond 5-complexity, but as long as the number of different exit types is bounded, we are still getting a very good coloring compared with general coloring. In particular, for C =-=[28]-=-, loops both have a break corresponding to the exit in STRUCTURED, and they have a continue-statement bringing the control back to the beginning of the loop. This program loop if then if or then else ... |

424 |
Register allocation and spilling via graph coloring
- Chaitin
- 1982
(Show Context)
Citation Context ...trol-flow analysis. 1 Introduction The register allocation problem for an imperative program P is usually modelled as the coloring problem of the interference graph I of the control-flow graph G of P =-=[3, 15, 16, 20]-=-. The control-flow graph G is a digraph representing the flow of control between program points in the execution of the program P (see Figure 2.2, page 9). The orientation is, however, unimportant in ... |

386 |
On the hardness of approximating minimization problems
- LUND, YANNAKAKIS
- 1993
(Show Context)
Citation Context ...rtment of Computer Science, University of Copenhagen, Universitetsparken 1, 2100 Kbh. ��, Denmark. (mthorup@diku.dk, http://www.diku.dk/��mthorup). within a factor O(n " ) from optimality=-= unless NP=P [30]-=-. The current best approximation factor is O(n(log log n)=(log n) 3 ) [26]. However, in this paper we show that for structured (j goto-free) programs 1 , including, for example, short circuit evaluati... |

331 | Complexity of finding embedings in a k-tree - Arnborg, Corneil, et al. - 1987 |

255 | Graph Minors XIII. The Disjoint Paths Problem - Robertson, Seymour - 1995 |

235 | D.: Easy problems for tree-decomposable graphs
- Arnborg, Lagergren, et al.
- 1991
(Show Context)
Citation Context ...decompositions of width k. It should be noted that our work on the register allocation problem does not follow the usual pattern of deriving fast algorithms for graphs of bounded tree-width (see e.g. =-=[5, 6, 9, 11, 17]-=-). First of all we are studying intersection graphs of connected subgraphs rather than the graph itself. Second, the coloring problem we consider is NP-complete for any k ? 1. The NP-completeness foll... |

210 | Letters to the editor: go to statement considered harmful
- Dijkstra
- 1968
(Show Context)
Citation Context ...scal [38] programs have ( 3)-complex control-flow graphs. ffl All Modula-2 [39] programs have ( 5)-complex control-flow graphs. 1 Structured programs is not an well-defined agreed-upon term (see e.g. =-=[18, 19, 29, 31, 32]-=-). In this paper, we are referring specifically to the aspect of being goto-free. ffl Goto-free C [28] programs have ( 6)-complex control-flow graphs. Without short circuit evaluation, each of the abo... |

200 | A linear time algorithm for finding treedecompositions of small treewidth
- Bodlaender
- 1993
(Show Context)
Citation Context ...rol-flow-graphs of their programs have simple listings/bounded tree-width. For variable k, the problem of deciding the tree-width is NPhard [4]. For fixed k, however, there are linear time algorithms =-=[8]-=-. Also, for variable k, there has been work done on polynomial approximating algorithms [10]. Moreover, from Bellcore, there is a commercially available tree-width heuristic by Cook and Seymour. Our d... |

163 |
Revised Report on the Algorithmic Language ALGOL 60
- Naur
- 1960
(Show Context)
Citation Context ...r which we get a factor 1. Hence follows the colorability of chordal graphs [22, 23]. We show the significance of Theorem 2 by showing Theorem 3 Assuming short circuit evaluation, ffl Goto-free Algol =-=[31]-=- and Pascal [38] programs have ( 3)-complex control-flow graphs. ffl All Modula-2 [39] programs have ( 5)-complex control-flow graphs. 1 Structured programs is not an well-defined agreed-upon term (se... |

156 |
Linear time algorithms for NP-hard problems restricted to partial k-trees
- Arnborg, Proskurowski
- 1989
(Show Context)
Citation Context ...decompositions of width k. It should be noted that our work on the register allocation problem does not follow the usual pattern of deriving fast algorithms for graphs of bounded tree-width (see e.g. =-=[5, 6, 9, 11, 17]-=-). First of all we are studying intersection graphs of connected subgraphs rather than the graph itself. Second, the coloring problem we consider is NP-complete for any k ? 1. The NP-completeness foll... |

137 | Register Allocation via Graph Coloring - Briggs - 1992 |

134 | Coloring heuristics for register allocation - Briggs, Cooper, et al. - 1989 |

129 |
The intersection graphs of subtrees in trees are exactly the chordal graphs
- Gavril
- 1974
(Show Context)
Citation Context ...y in time O(k!n). Note that for k = 2, we get the factor 2 from [27]. Also note that the 1-complex graphs are the forests for which we get a factor 1. Hence follows the colorability of chordal graphs =-=[22, 23]-=-. We show the significance of Theorem 2 by showing Theorem 3 Assuming short circuit evaluation, ffl Goto-free Algol [31] and Pascal [38] programs have ( 3)-complex control-flow graphs. ffl All Modula-... |

122 |
Graph minors I. Excluding a forest
- Robertson, Seymour
- 1983
(Show Context)
Citation Context ... want to spend time O(!n), we can get the factors: 4 (3) for Algol/Pascal, 6 (5) for Modula-2, and 7 (6) for C. Finally, we show that k-complexity is a short new definition of tree-width k defined in =-=[35]-=-. Theorem 5 A graph is k-complex if and only if it has tree-width k. Moreover there are linear transformations between k-complex listings and tree-decompositions of width k. It should be noted that ou... |

115 |
The complexity of coloring circular arcs and chords
- Garey, Johnson, et al.
(Show Context)
Citation Context ...sider is NP-complete for any k ? 1. The NP-completeness follows from the fact that a cycle has tree-width 2, and for a cycle the coloring problem for the intersection graph is known to be NP-complete =-=[21]-=-. The relationship to tree-width is relevant to goto-users. One could imagine that even gotousers have structured thoughts [29], hence that also the control-flow-graphs of their programs have simple l... |

107 |
Algorithms for minimum coloring, maximum clique, minimum covering by cliques and maximum independent set of a chordal graph
- GAVRIL
- 1972
(Show Context)
Citation Context ...y in time O(k!n). Note that for k = 2, we get the factor 2 from [27]. Also note that the 1-complex graphs are the forests for which we get a factor 1. Hence follows the colorability of chordal graphs =-=[22, 23]-=-. We show the significance of Theorem 2 by showing Theorem 3 Assuming short circuit evaluation, ffl Goto-free Algol [31] and Pascal [38] programs have ( 3)-complex control-flow graphs. ffl All Modula-... |

96 | Register allocation via hierarchical graph coloring
- Callahan, Koblenz
- 1991
(Show Context)
Citation Context ...ariables and its construction is considered a main obstacle for coloring based register allocation. Hence, for space reasons, many heuristics aim at only having parts of the I constructed at any time =-=[14, 25, 34]-=-. For our (bk=2c+1)- approximation algorithm the biggest sub-graphs considered are of size O(! 2 ). From the k-complex listing, for each variable, our (k + 1)-approximation algorithm identifies a smal... |

81 | Monadic second-order evaluations on tree-decomposable graphs
- Courcelle, Mosbah
- 1993
(Show Context)
Citation Context ...decompositions of width k. It should be noted that our work on the register allocation problem does not follow the usual pattern of deriving fast algorithms for graphs of bounded tree-width (see e.g. =-=[5, 6, 9, 11, 17]-=-). First of all we are studying intersection graphs of connected subgraphs rather than the graph itself. Second, the coloring problem we consider is NP-complete for any k ? 1. The NP-completeness foll... |

67 |
C.A.: Automatic generation of linear-time algorithms from predicate calculus descriptions of problems on recursively constructed graph families. Algorithmica 7
- Borie, Parker, et al.
- 1992
(Show Context)
Citation Context |

59 | Structured programming with go to statements
- Knuth
- 1974
(Show Context)
Citation Context ...scal [38] programs have ( 3)-complex control-flow graphs. ffl All Modula-2 [39] programs have ( 5)-complex control-flow graphs. 1 Structured programs is not an well-defined agreed-upon term (see e.g. =-=[18, 19, 29, 31, 32]-=-). In this paper, we are referring specifically to the aspect of being goto-free. ffl Goto-free C [28] programs have ( 6)-complex control-flow graphs. Without short circuit evaluation, each of the abo... |

35 |
The Essence of Programming Languages
- Wirth
- 2007
(Show Context)
Citation Context ... factor 1. Hence follows the colorability of chordal graphs [22, 23]. We show the significance of Theorem 2 by showing Theorem 3 Assuming short circuit evaluation, ffl Goto-free Algol [31] and Pascal =-=[38]-=- programs have ( 3)-complex control-flow graphs. ffl All Modula-2 [39] programs have ( 5)-complex control-flow graphs. 1 Structured programs is not an well-defined agreed-upon term (see e.g. [18, 19, ... |

32 | Register allocation via clique separators
- GUTA, SOFFA, et al.
- 1989
(Show Context)
Citation Context ...ariables and its construction is considered a main obstacle for coloring based register allocation. Hence, for space reasons, many heuristics aim at only having parts of the I constructed at any time =-=[14, 25, 34]-=-. For our (bk=2c+1)- approximation algorithm the biggest sub-graphs considered are of size O(! 2 ). From the k-complex listing, for each variable, our (k + 1)-approximation algorithm identifies a smal... |

32 | Register allocation over the program dependence graph
- Norris, Pollock
- 1994
(Show Context)
Citation Context ...ariables and its construction is considered a main obstacle for coloring based register allocation. Hence, for space reasons, many heuristics aim at only having parts of the I constructed at any time =-=[14, 25, 34]-=-. For our (bk=2c+1)- approximation algorithm the biggest sub-graphs considered are of size O(! 2 ). From the k-complex listing, for each variable, our (k + 1)-approximation algorithm identifies a smal... |

31 | Implementing the call-by-value lambda-calculus using a stack of regions - Tofte, Talpin - 1994 |

24 |
Generalized dominators and post-dominators
- Gupta
- 1992
(Show Context)
Citation Context ...), allowing us to develop algorithms working well in both theory and practice. An example is given in [2] where bounded tree-width is used to derive a linear time algorithm for generalized dominators =-=[24]-=-. The best algorithm for general control-flowgraphs runs in O(nm) algorithm [1]. The paper is divided as follows. Section 2 addresses Theorem 3. Section 3 shows how simple listings may be preserved un... |

21 | A tourist guide through treewidth, Acta Cybernet - Bodlaender - 1993 |

6 |
HALLDORSSON: A still better performance guarantee for approximate graph coloring
- unknown authors
- 1993
(Show Context)
Citation Context ..., 2100 Kbh. ��, Denmark. (mthorup@diku.dk, http://www.diku.dk/��mthorup). within a factor O(n " ) from optimality unless NP=P [30]. The current best approximation factor is O(n(log log n)=-==(log n) 3 ) [26]-=-. However, in this paper we show that for structured (j goto-free) programs 1 , including, for example, short circuit evaluations and multiple exits from loops, we can do register allocation in polyno... |

4 |
Reduction of the problem of memory allocation in programming to the problem of coloring the vertices of graphs. Doklady Akademii Nauk
- ERSHOV
- 1962
(Show Context)
Citation Context ...trol-flow analysis. 1 Introduction The register allocation problem for an imperative program P is usually modelled as the coloring problem of the interference graph I of the control-flow graph G of P =-=[3, 15, 16, 20]-=-. The control-flow graph G is a digraph representing the flow of control between program points in the execution of the program P (see Figure 2.2, page 9). The orientation is, however, unimportant in ... |

4 | Generalized dominators for structured programs - Alstrup, Lauridsen, et al. - 1996 |

3 |
Algorithms for detecting series-parallel graphs and D-charts
- Nishizeki, Takamizawa, et al.
- 1976
(Show Context)
Citation Context ...o be recursively sub-divided into basic blocks with a single entry and a single exit point. Such a recursive sub-division immediately gives a series-parallel decomposition of the flow-graph (see e.g. =-=[33]-=-). However, even within structured languages, there are well-known exceptions to the sub-division into basic-blocks/seriesparallelism. For example [27] points to short circuit evaluation where the eva... |

2 |
An O(jV j jEj) algorithm for finding immediate multiple-vertex dominators
- Alstrup, Clausen, et al.
- 1996
(Show Context)
Citation Context ...n example is given in [2] where bounded tree-width is used to derive a linear time algorithm for generalized dominators [24]. The best algorithm for general control-flowgraphs runs in O(nm) algorithm =-=[1]-=-. The paper is divided as follows. Section 2 addresses Theorem 3. Section 3 shows how simple listings may be preserved under the standard optimizations from [3]. Section 4 proves Theorem 2. In Section... |

2 |
Register allocation via graph coloring. Computer Languages
- Chaitin, Anslander, et al.
- 1981
(Show Context)
Citation Context ...trol-flow analysis. 1 Introduction The register allocation problem for an imperative program P is usually modelled as the coloring problem of the interference graph I of the control-flow graph G of P =-=[3, 15, 16, 20]-=-. The control-flow graph G is a digraph representing the flow of control between program points in the execution of the program P (see Figure 2.2, page 9). The orientation is, however, unimportant in ... |

1 |
Generalized dominators for structured programs. Accepted for "Proc. 3rd International Static Analysis Symposium
- Alstrup, Lauridsen, et al.
- 1996
(Show Context)
Citation Context ... applied in control-flow graph analysis. The constants bounding the tree-width are truly small ( 6), allowing us to develop algorithms working well in both theory and practice. An example is given in =-=[2]-=- where bounded tree-width is used to derive a linear time algorithm for generalized dominators [24]. The best algorithm for general control-flowgraphs runs in O(nm) algorithm [1]. The paper is divided... |

1 |
Complexity of Path Forming
- Bodlaender
- 1993
(Show Context)
Citation Context |

1 |
Go To Statements and Good Algol
- Naur
- 1963
(Show Context)
Citation Context ...scal [38] programs have ( 3)-complex control-flow graphs. ffl All Modula-2 [39] programs have ( 5)-complex control-flow graphs. 1 Structured programs is not an well-defined agreed-upon term (see e.g. =-=[18, 19, 29, 31, 32]-=-). In this paper, we are referring specifically to the aspect of being goto-free. ffl Goto-free C [28] programs have ( 6)-complex control-flow graphs. Without short circuit evaluation, each of the abo... |

1 | From region inference to von Neyman Machines via region representation inference - Birkdal, Tofte, et al. - 1996 |

1 | A Simple listings from three address code In this appendix, we present a heuristic for finding a simple listing when the input is in threeaddress code without structural statements. This allows us to integrate our register allocation with compilers where - Wirth - 1985 |