Code Merge. Flow Analysis. bookkeeping

Similar documents
Overview of a Compiler

The View from 35,000 Feet

Overview of a Compiler

Overview of a Compiler

Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit

Just-In-Time Compilers & Runtime Optimizers

CS 406/534 Compiler Construction Putting It All Together

AMD S X86 OPEN64 COMPILER. Michael Lai AMD

The SGI Pro64 Compiler Infrastructure - A Tutorial

Intermediate Representations

Local Optimization: Value Numbering The Desert Island Optimization. Comp 412 COMP 412 FALL Chapter 8 in EaC2e. target code

Intermediate Representations

Loop Optimizations. Outline. Loop Invariant Code Motion. Induction Variables. Loop Invariant Code Motion. Loop Invariant Code Motion

Goals of Program Optimization (1 of 2)

Introduction to Optimization. CS434 Compiler Construction Joel Jones Department of Computer Science University of Alabama

Instruction Selection: Preliminaries. Comp 412

Compiler Optimizations. Chapter 8, Section 8.5 Chapter 9, Section 9.1.7

USC 227 Office hours: 3-4 Monday and Wednesday CS553 Lecture 1 Introduction 4

Compiling Java For High Performance on Servers

Introduction. No Optimization. Basic Optimizations. Normal Optimizations. Advanced Optimizations. Inter-Procedural Optimizations

Register Allocation. Note by Baris Aktemur: Our slides are adapted from Cooper and Torczon s slides that they prepared for COMP 412 at Rice.

CSE 501: Compiler Construction. Course outline. Goals for language implementation. Why study compilers? Models of compilation

CS415 Compilers. Intermediate Represeation & Code Generation

Compiler Optimizations. Chapter 8, Section 8.5 Chapter 9, Section 9.1.7

7. Optimization! Prof. O. Nierstrasz! Lecture notes by Marcus Denker!

Intermediate Representations

Static Single Assignment Form in the COINS Compiler Infrastructure - Current Status and Background -

Instruction Selection: Peephole Matching. Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.

Tour of common optimizations

Topic I (d): Static Single Assignment Form (SSA)

Introduction to Optimization Local Value Numbering

About the Authors... iii Introduction... xvii. Chapter 1: System Software... 1

What is a compiler? var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done

A Bad Name. CS 2210: Optimization. Register Allocation. Optimization. Reaching Definitions. Dataflow Analyses 4/10/2013

Office Hours: Mon/Wed 3:30-4:30 GDC Office Hours: Tue 3:30-4:30 Thu 3:30-4:30 GDC 5.

Instruction Scheduling Beyond Basic Blocks Extended Basic Blocks, Superblock Cloning, & Traces, with a quick introduction to Dominators.

Intermediate Code Generation (ICG)

Intermediate Representations. Reading & Topics. Intermediate Representations CS2210

Optimization Prof. James L. Frankel Harvard University

Partial Redundancy Elimination and SSA Form

Combining Optimizations: Sparse Conditional Constant Propagation

Static Single Assignment Form in the COINS Compiler Infrastructure

CS553 Lecture Dynamic Optimizations 2

IA-64 Compiler Technology

Intermediate Code & Local Optimizations

What is a compiler? Xiaokang Qiu Purdue University. August 21, 2017 ECE 573

Agenda. CSE P 501 Compilers. Big Picture. Compiler Organization. Intermediate Representations. IR for Code Generation. CSE P 501 Au05 N-1

Global Register Allocation via Graph Coloring

Principles of Compiler Design

Usually, target code is semantically equivalent to source code, but not always!

Compiler Passes. Optimization. The Role of the Optimizer. Optimizations. The Optimizer (or Middle End) Traditional Three-pass Compiler

Review of instruction set architectures

Optimization. ASU Textbook Chapter 9. Tsan-sheng Hsu.

Code Shape II Expressions & Assignment

Handling Assignment Comp 412

CSCI 565 Compiler Design and Implementation Spring 2014

High-level View of a Compiler

UG3 Compiling Techniques Overview of the Course

Middle End. Code Improvement (or Optimization) Analyzes IR and rewrites (or transforms) IR Primary goal is to reduce running time of the compiled code

Introduction to Compilers

Group B Assignment 8. Title of Assignment: Problem Definition: Code optimization using DAG Perquisite: Lex, Yacc, Compiler Construction

CS415 Compilers Overview of the Course. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

What Do Compilers Do? How Can the Compiler Improve Performance? What Do We Mean By Optimization?

Intermediate Representation (IR)

Static Single Assignment Form in the COINS Compiler Infrastructure Current Status and Background

55:132/22C:160, HPCA Spring 2011

Advanced Compiler Construction

Code optimization. Have we achieved optimal code? Impossible to answer! We make improvements to the code. Aim: faster code and/or less space

Supercomputing in Plain English Part IV: Henry Neeman, Director

CPSC 510 (Fall 2007, Winter 2008) Compiler Construction II

Compiling for Performance on hp OpenVMS I64. Doug Gordon Original Presentation by Bill Noyce European Technical Update Days, 2005

ECE 5775 (Fall 17) High-Level Digital Design Automation. Static Single Assignment

Programming Language Processor Theory

Arrays and Functions

CS 701. Class Meets. Instructor. Teaching Assistant. Key Dates. Charles N. Fischer. Fall Tuesdays & Thursdays, 11:00 12: Engineering Hall

Comp 204: Computer Systems and Their Implementation. Lecture 22: Code Generation and Optimisation

CS 132 Compiler Construction

Tiling: A Data Locality Optimizing Algorithm

Introduction to Machine-Independent Optimizations - 1

The structure of a compiler

Topic 6 Basic Back-End Optimization

Calvin Lin The University of Texas at Austin

Control flow graphs and loop optimizations. Thursday, October 24, 13

COMP 181 Compilers. Administrative. Last time. Prelude. Compilation strategy. Translation strategy. Lecture 2 Overview

Using Cache Models and Empirical Search in Automatic Tuning of Applications. Apan Qasem Ken Kennedy John Mellor-Crummey Rice University Houston, TX

Compiler Optimization Intermediate Representation

CS415 Compilers Register Allocation. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

Why Global Dataflow Analysis?

Computing Inside The Parser Syntax-Directed Translation. Comp 412 COMP 412 FALL Chapter 4 in EaC2e. source code. IR IR target.

Runtime Support for Algol-Like Languages Comp 412

Introduction to Code Optimization. Lecture 36: Local Optimization. Basic Blocks. Basic-Block Example

COP5621 Exam 4 - Spring 2005

15-411: LLVM. Jan Hoffmann. Substantial portions courtesy of Deby Katz

Lecture Notes on Common Subexpression Elimination

Naming in OOLs and Storage Layout Comp 412

Combining Analyses, Combining Optimizations - Summary

CS5363 Final Review. cs5363 1

The GNU Compiler Collection

Loop Invariant Code Mo0on

Compilers. Lecture 2 Overview. (original slides by Sam

Transcription:

Historic Compilers Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit permission to make copies of these materials for their personal use.

Index Optimiz n Code Merge Flow Analysis Register Allocation Final Assembly bookkeeping Middle Back 1957: The FORTRAN Automatic Coding System Six passes in a fixed order Generated good code Assumed unlimited index registers Code motion out of loops, with ifs and gotos Did flow analysis & register allocation

Scan & Parse Build CFG & DOM Find Busy Vars CSE Loop Inv Code Mot n Copy Elim. OSR Re - assoc (consts) Reg. Alloc. Final Assy. Middle Back 1969: IBM s FORTRAN H Compiler Used low-level IR (quads), identified loops with dominators Focused on optimizing loops ( inside out order) Passes are familiar today Simple front end, simple back end for IBM 370

Register allocation Lex- Syn- Flo Delay TLA Rank Pack Code Final Middle Back 1975: BLISS-11 compiler (Wulf et al., CMU) The great compiler for the PDP-11 Seven passes in a fixed order Focused on code shape & instruction selection LexSynFlo did preliminary flow analysis Basis for early VAX & Tartan Labs compilers Final included a grab-bag of peephole optimizations

1980: IBM s PL.8 Compiler Many passes, one front end, several back ends Collection of 10 or more passes Repeat some passes and analyses Represent complex operations at 2 levels Below machine-level IR Middle Multi-level IR has become common wisdom Back Dead code elimination Global cse Code motion Constant folding Strength reduction Value numbering Dead store elimination Code straightening Trap elimination Algebraic reassociation

Middle Back 1986: HP s PA-RISC Compiler Several front ends, an optimizer, and a back end Four fixed-order choices for optimization (9 passes) Coloring allocator, instruction scheduler, peephole optimizer

1999: The SUIF Compiler System Fortran 77 C & C++ Java Another classically-built compiler 3 front ends, 3 back ends 18 passes, configurable order Two-level IR (High SUIF, Low SUIF) Intended as research infrastructure C/Fortran Alpha x86 Back SSA construction Dead code elimination Partial redundancy elimination Constant propagation Global value numbering Strength reduction Reassociation Instruction scheduling Register allocation Data dependence analysis Scalar & array privitization Reduction recognition Pointer analysis Affine loop transformations Blocking Capturing object definitions Virtual function call elimination Garbage collection

2000: The SGI Pro64 Compiler (now Open64 from Intel) Fortran C & C++ Interpr. Anal. & Loop Nest Global Code Gen. Java Middle Back Open source optimizing compiler for IA 64 3 front ends, 1 back end Five-levels of IR Gradual lowering of abstraction level

2000: The SGI Pro64 Compiler (now Open64 from Intel) Fortran C & C++ Interpr. Anal. & Loop Nest Global Code Gen. Java Middle Back Interprocedural Classic analysis Inlining (user & library code) Cloning (constants & locality) Dead function elimination Dead variable elimination Global Optimization SSA-based analysis & opt n Constant propagation, PRE, OSR+LFTR, DVNT, DCE (also used by other phases) Loop Nest Optimization Dependence analysis Parallelization Loop transformations (fission, fusion, interchange, peeling, tiling, unroll & jam) Array privitization Code Generation If conversion & predication Code motion Scheduling (inc. sw pipelining) Allocation Peephole optimization

Even a 2000 JIT fits the mold, albeit with fewer passes bytecode Middle Back end tasks are handled elsewhere Few (if any) optimizations Avoid expensive analysis native code Emphasis on generating native code Compilation must be profitable Java Environment