File Name: advanced compiler design and implementation by steven s muchnick .zip
- Steven Muchnick
- Advanced compiler design and implementation
- Advanced compiler design and implementation
- Advanced Compiler Design and Implementation
This flowchart represents a recommended order for performing optim izations in an aggres sive optimizing compiler. Other orders are possible, and the exam ples o f real-world compilers in Chapter 21 present several alternatives, though none o f them includes all o f the optim iza tions in this diagram. The letters at the left in the diagram correspond to the levels o f code appropriate for the corresponding optim izations. The correspondence between letters and code levels is as follows:.
These optim izations typically are applied either to source code or to a high-level intermediate code that preserves loop structure and the sequence in which operations are performed and that has array accesses in essentially their source-code form.
Usually, these optimizations are done very early in the compilation process, since compilation tends to lower the level of the code as it proceeds from one phase to the next. In-line expansion Leaf-routine optimization Shrink wrapping Machine idioms Tail merging Branch optimizations and conditional moves Dead-code elimination Software pipelining, with loop unrolling, variable expansion, register renaming, and hierarchical reduction Basic-block and branch scheduling 1 Register allocation by graph coloring Basic-block and branch scheduling 2 Intraprocedural I-cache optimization Instruction prefetching Data prefetching Branch prediction.
Interprocedural register allocation Aggregation of global references Interprocedural I-cache optimization. These optimizations are typically performed on medium- or low-level intermediate code, depending on the overall organization of the compiler.
If code selection is done before all optimizations other than those in box A known as the low-level model of optimizer struc ture , then these optimizations are performed on low-level code.
If, on the other hand, some optimizations are performed on a medium-level, relatively machine-independent intermedi ate code and others are performed on low-level code after code generation known as the mixed model , then these optimizations are generally done on the medium-level interme diate code. The branches from C l to C2 and C3 represent a choice of the method used to perform essentially the same optimization namely, moving computations to places where they are per formed less frequently without changing the semantics of the program.
They also represent a choice of the data-flow analyses used to perform the optimization. These optimizations are almost always done on a low-level form of codeone that may be quite machine-dependent e. These optimizations are performed at link time, so they operate on relocatable object code. Three optimizations, namely, constant folding, algebraic simplification, and reassociation, are in boxes connected to the other phases of the optimization process by dotted lines because they are best structured as subroutines that can be invoked whenever they are needed.
A version of this diagram appears in Chapters 1 and 11 through 20 to guide the reader in ordering optimizer components in a compiler. Senior Editor Denise E. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any meanselectronic, mechanical, photocopying, recording, or otherwisewithout the prior written permission of the publisher. Includes bibliographical references and index.
ISBN 1. Compilers Computer programs 2. Systems programming Computer science. C65M 8 Fortran, the first widely used higher-level language, suc ceeded, in large part, because of the high quality of its early compilers.
John Backus and his colleagues at IBM recognized that programmers would not give up the detailed design control they had with assembly language unless the performance of compiled code was sufficiently close to the performance of handwritten machine code. Backuss group invented several key concepts that underlie the topics in this book. Among them are the treatment of array indexes in loop optimization and methods for local register allocation. Since that time, both researchers and practi tioners have improved and supplanted them repeatedly with more effective ones.
In light of the long history of compiler design, and its standing as a relatively mature computing technology, why, one might ask, should there be a new book in the field? The answer is clear. Compilers are tools that generate efficient mappings from programs to machines.
The language designs continue to change, the target architectures continue to change, and the programs become ever more ambitious in their scale and complexity. Thus, while the compiler design problem remains the same at a high level, as we zoom in, it is continually changing.
Furthermore, the computational resources we can bring to bear in the compilers themselves are increasing. Consequently, modern compilers use more time- and space-intensive algorithms than were possible before. And, of course, researchers continue to invent new and better techniques for solving conventional compiler design problems.
In fact, an entire collection of topics in this book are direct consequences of changes in computer architecture. This book takes on the challenges of contemporary languages and architectures and prepares the reader for the new compiling problems that will inevitably arise in the future. For example, in Chapter 3 the book builds on the readers knowledge of symbol tables and local scope structure to describe how to deal with imported and exported scopes as found in Ada, Modula-2, and other modern languages.
And, since run-time environments model the dynamic semantics of source languages, the discussion of advanced issues in run-time support in Chapter 5, such as compiling shared objects, is particularly valuable. That chapter also addresses the rich type systems found in some modern languages and the diverse strategies for parameter passing dictated by modern architectures.
No compiler book would be complete without a chapter on code generation. The early work in code generation provided approaches to designing handcrafted instruction-selection routines and intermixing instruction selection with register management. The treatment of code generation in Chapter 6 describes automated techniques based on pattern matching, made possible not only by compiler research but also by simpler and more orthogonal instruction sets and by the feasibility of constructing and traversing intermediate-code trees in a compiler.
Optimization is the heart of advanced compiler design and the core of this book. Much theoretical work has gone into program analysis, both for the sake of optimization and for other purposes. Chapters 7 through 10 revisit what are, by now, the classic analysis methods, along with newer and more efficient ones previously described only in research papers. These chapters take a collection of diverse techniques and organize them into a unified whole. This synthesis is, in itself, a significant contribution to compiler design.
Most of the chapters that follow use the analyses to perform optimizing transformations. The large register sets in recent systems motivate the material on register allo cation in Chapter 16, which synthesizes over a decade of advances in algorithms and heuristics for this problem. Also, an important source of increased speed is concurrencythe ability to do several things at once. In order to translate a sequen tial program into one that can exploit hardware concurrency, the compiler may need to rearrange parts of the computation in a way that preserves correctness and in creases parallelism.
Although a full treatment of concurrency is beyond the scope of this book, it does focus on instruction-level parallelism, which motivates the discus sion of dependence analysis in Chapter 9 and the vital topic of code scheduling in Chapter Chapter 20, on optimization for the memory hierarchy, is also motivated by modern target machines, which introduce a diversity of relative speeds of data access in order to cope with the increasing gap between processor and memory speeds.
An additional chapter available from the publishers World Wide Web site discusses object-code translation, which builds on compiler technology to translate programs for new architectures, even when the source programs are unavailable. The importance of interprocedural analysis and optimization has increased as new language designs have encouraged programmers to use more sophisticated methods for structuring large programs. Its feasibility has increased as the analysis methods have been refined and tuned and as faster computers have made the requi site analyses acceptably fast.
Chapter 19 is devoted to the determination and use of interprocedural information. Compiler design is, in its essence, an engineering activity. The methods that are used must be ones that provide good solutions to the translation situations that arise in practicenamely, real programs written in real languages executing on real machines.
Most of the time, the compiler writer must take the languages and the machines as they come. Rarely is it possible to influence or improve the design of either. It is the engineering choices of what analyses and transformations to perform and when to perform them that determine the speed and quality of an optimizing compiler. Both in the treatment of the optimization material throughout the book and in the case studies in Chapter 21, these design choices are paramount.
One of the great strengths of the author, Steve Muchnick, is the wealth and di versity of his experience. After an early career as a professor of computer science, Dr. Muchnick applied his knowledge of compilers as a vital member of the teams that developed two important computer architectures, namely, pa-risc at HewlettPackard and sparc at Sun Microsystems. After the initial work on each architecture was completed, he served as the leader of the advanced compiler design and im plementation groups for these systems.
Those credentials stand him in good stead in deciding what the reader needs to know about advanced compiler design. His research experience, coupled with his hands-on development experience, are invalu able in guiding the reader through the many design decisions that a compiler designer must make.
Susan Graham University of California, Berkeley. Interprocedural Analysis and Optimization Optimization for the Memory Hierarchy While it does consider machines with instruction-level parallelism, we ignore almost completely the issues of large-scale parallelization and vectorization.
It begins with material on compiler structure, symbol-table management includ ing languages that allow scopes to be imported and exported , intermediate code structure, run-time support issues including shared objects that can be linked to at run time , and automatic generation of code generators from machine descrip tions. Next it explores methods for intraprocedural conventionally called global control-flow, data-flow, dependence, and alias analyses.
Then a series of groups of global optimizations are described, including ones that apply to program compo nents from simple expressions to whole procedures. Next, interprocedural analyses of control flow, data flow, and aliases are described, followed by interprocedural optimizations and use of interprocedural information to improve global optimiza tions. We then discuss optimizations designed to make effective use of the memory hierarchy.
Finally, we describe four commercial compiler systems in detail, namely, ones from Digital Equipment Corporation, IBM, Intel, and Sun Microsysytems, to provide specific examples of approaches to compiler structure, intermediate-code de sign, optimization choices, and effectiveness. As we shall see, these compiler systems represent a wide range of approaches and often achieve similar results in different ways.
The tutorial was based on approximately transparen cies on RISC architectures and relevant issues in compilers, particularly optimization. I left that experience with the idea that somewhere within the material covered there was a seed the mental image was, in fact, of an acorn yearning for sun, soil, and water to help it grow into the mature oak tree of a book you have before you.
Over xxi. The first draft that resulted included quite a lot of material on R i s e architectures, as well as material on advanced compilation issues. Before long with the help of three reviewers I had decided that there was little point in including the architecture material in the book. New R i s e architectures are being developed quite frequently, the kind of coverage of them that is needed is provided in architecture courses at most universities, and the real strengths of the text were in the compiler material.
This resulted in a major change of direction. Most of the architecture material was dropped, keeping just those parts that support decisions on how to proceed in compilation; the focus of the compiler material was broadened to provide equal coverage of ciscs; and it was decided to focus entirely on uniprocessors and to leave it to other texts to discuss parallelization and vectorization.
The focus of the compilation material was deepened and, in some respects narrowed and in others broadened for example, material on hand-crafted code generation was dropped almost entirely, while advanced methods of scheduling, such as trace and percolation scheduling, were added.
The result is what you see before you. About the Cover The design on the cover is of a Chilkat blanket from the authors collection of Northwest Coast native art. The blanket was woven of fine strands of red-cedar inner bark and mountain-goat wool in the late 19th century by a Tlingit woman from southeastern Alaska.
It generally took six to nine months of work to complete such a blanket. The blanket design is divided into three panels, and the center panel depicts a diving whale.
The head is the split image at the bottom; the body is the panel with the face in the center a panel that looks like a face never represents the face in this iconography ; the lateral fins are at the sides of the body; and the tail flukes are at the top. Each part of the design is, in itself, functional but meaningless; assembled together in the right way, the elements combine to depict a diving whale and proclaim the rights and prerogatives of the village chief who owned the blanket.
Advanced compiler design and implementation
Advanced compiler design and implementation
From the Foreword by Susan L. Graham: This book takes on the challenges of contemporary languages and architectures, and prepares the reader for the new compiling problems that will inevitably arise in the future. The definitive book on advanced compiler design This comprehensive, up-to-date work examines advanced issues in the design and implementation of compilers for mo.
Thank you for interesting in our services. We are a non-profit group that run this website to share documents. We need your help to maintenance this website.
Advanced Compiler Design and Implementation
You've discovered a title that's missing from our library. Can you help donate a copy? When you buy books using these links the Internet Archive may earn a small commission.
List of ebooks and manuels about Advanced compiler design and implementation by steven s muchnick ppt. Introduction to Advanced Topic s. Chapter 1. Eran Yahav.
This flowchart represents a recommended order for performing optim izations in an aggres sive optimizing compiler. Other orders are possible, and the exam ples o f real-world compilers in Chapter 21 present several alternatives, though none o f them includes all o f the optim iza tions in this diagram. The letters at the left in the diagram correspond to the levels o f code appropriate for the corresponding optim izations. The correspondence between letters and code levels is as follows:. These optim izations typically are applied either to source code or to a high-level intermediate code that preserves loop structure and the sequence in which operations are performed and that has array accesses in essentially their source-code form. Usually, these optimizations are done very early in the compilation process, since compilation tends to lower the level of the code as it proceeds from one phase to the next. In-line expansion Leaf-routine optimization Shrink wrapping Machine idioms Tail merging Branch optimizations and conditional moves Dead-code elimination Software pipelining, with loop unrolling, variable expansion, register renaming, and hierarchical reduction Basic-block and branch scheduling 1 Register allocation by graph coloring Basic-block and branch scheduling 2 Intraprocedural I-cache optimization Instruction prefetching Data prefetching Branch prediction.
Search this site. Abiola Abrams PDF. Andrew Pakula PDF. Angelina Ballerina PDF. Angels' Carol PDF.
The goal of PLT is to teach you both about the structure of computer programming languages and the basics of implementing compilers for such languages. The course will focus mostly on traditional imperative and object-oriented languages, but will also cover functional and logic programming, concurrency issues, and some aspects of scripting languages. Homework and tests will cover language issues.
Steven Stanley Muchnick is a noted computer science researcher, best known as author of the treatise on compilers , "Advanced Compiler Design and Implementation. After graduation, he became a professor at the University of Kansas , located in Lawrence, Kansas. Muchnick eventually departed from his teaching profession.