Structured Programs have Small Tree-Width and Good Register Allocation (Extended Abstract)

نویسنده

  • Mikkel Thorup
چکیده

The register allocation problem for an imperative program is often modelled as the coloring problem of the interference graph of the control-ow graph of the program. The interference graph of a ow 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 diierent 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 eeciently color any intersection graph of connected subgraphs within a factor (bk=2c + 1) from optimality. Moreover, it is shown that structured (goto-free) programs, including, for example, short circuit evaluations and multiple exits from loops, have tree-width at most 6. Thus, for every structured program, we can do register allocation eeciently within a factor 4 from optimality, regardless of how many registers are needed. The bounded tree-width of structured programs imply that the many techniques for bounded tree-width may now be applied in control-ow analysis.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

All Structured Programs have Small Tree-Width and Good Register Allocation

The register allocation problem for an imperative program is often modelled as the coloring problem of the interference graph of the control-ow graph of the program. The interference graph of a ow 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 o...

متن کامل

The complexity of register allocation

In compilers, register allocation is one of the most important stages with respect to optimization for typical goals, such as code size, code speed, or energy efficiency. Graph theoretically, optimal register allocation is the problem of finding a maximum weight r-colorable induced subgraph in the conflict graph of a given program. The parameter r is the number of registers. Large classes of pr...

متن کامل

The Treewidth of Java Programs

Intuitively, the treewidth of a graph G measures how close G is to being a tree. The lower the treewidth, the faster we can solve various optimization problems on G, by dynamic programming along the tree structure. In the paper M.Thorup, All Structured Programs have Small Tree-Width and Good Register Allocation [8] it is shown that the control-flow graph of any goto-free C program is at most 6....

متن کامل

Generic Attribute

This paper introduces generic attribute grammars which provide support for genericity, reusability and modularity in attribute grammars. A generic attribute grammar is a component that is easily reused, composed and understood. Attribute grammar based systems may be constructed out of a set of generic components, that can be analysed and compiled separately. We show how to generate deforestated...

متن کامل

Register assignment in tree-structured programs

Much complex decision-making is performed routinely by the software of a computer system. It is appropriate to study more thoroughly the performance of this built-in decisionmaking, because it can strongly influence the efficiency of the entire system. One objective of compilers is to produce a reasonably efficient machine-language version of a user’s program. Traditionally, one of the best opp...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1997