Partial Redundancy Elimination and SSA Form
|
|
- Valentine Scott
- 5 years ago
- Views:
Transcription
1 Topic 5a Partial Redundancy Elimination and SSA Form \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic- 7b.ppt 1
2 References Robert Kennedy, Sun Chan, Shin-ming Liu, Raymond Lo, Pend Tu, Fred Chow. Partial redundancy elimination in SSA Form. ACM Trans. On Programming Languages and Systems, 21(3), May 1999: Drechsler K. and Stadel M. A variation of Knoop, Ruthing, and Steffen s lazy code motion. SIGPLAN Notices, 28(5), May, 1993: Keith Cooper, Linda Torczon. Engineering a compiler \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 2
3 Outline Partial Redundancy Elimination (PRE) SSAPRE (a short summary) \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 3
4 KCC Compiler Infrastructure Front end Middle end Back end Machin ne Model Fortran C C++ fe90 gfec gfecc Very High WHIRL High WHIRL Middle WHIRL Low WHIRL Very Low WHIRL CGIR Asm file Source to IR (Scanner Parser RTL WHIRL) VHO (Very High WHIRL Optimizer) Standalone Inliner W2C/W2F IPA (inter-procedural analysis & opt) LNO (Loop unrolling/fission/fusion/tiling/peeling etc) PREOPT (point-to analysis etc) WOPT - SSAPRE (Partial Redundancy Elimination) - VNFRE (Value numbering based full redundancy elim.) RVI-1 (Register Variable Identification) RVI-2 Some peephole opt Cflow (control flow opt) EBO (extended block opt.) PQS (predicate query system) Loop Opt (Unrolling + SWP) GCM (global code motion), HB sched (hyperblk schedule) GRA/LRA (global/local register alloc) \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 4
5 Important Observation An operand of a φ function is regarded as occurring at the end of its corresponding predecessor block. The result of a φ function is regarded as occurring at the beginning of the block that contains it \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 5
6 Partial Redundancy Elimination B 1 t x*y a t Is the program in SSA form before and after PRE? a x*y t x*y B 2 X*y is partially redundant here X*y is made redundant here b x*y b t B \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 6
7 Problem Formulation for PRE For an expression, identify its partially redundant occurrences Safely insert occurrences (to new temporaries) at some points Delete the original partially (now fully) redundant occurrences. Replace them by loads from a temporary variable \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 7
8 PRE Basics Availability: An expression, say, x*y, is available at a program point p if EVERY path from entry to p evaluates the expression before reaching p And there are no assignments to x or y after the (last) evaluation but before p (on all paths). Availability implies full redundancy \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 8
9 PRE Basics (Cont.) Partial availability: An expression, say, x*y, is partially available at a program point p if SOME paths from entry to p evaluates the expression before reaching p And there are no assignments to x or y after the (last) such evaluation but before p. Partial availability implies partial redundancy \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 9
10 PRE Basics (Cont.) Anticipatability: An expression e is anticipatable ( down-safe ) at a program point p if it appears (without redefinition) along ALL paths from p to an exit of the program X*y is anticipatable here B 1 B 2 a x*y b x*y B \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 10
11 Safe Placement - Safe insertion: If an inserted computation occurs at a point where the computation is anticipated. - Unsafe insertion: means that some original path in the program did not contain this computation. May increase the execution time of the program May cause exceptions \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 11
12 Safe Placement: Example x*y Safe Not safe x*y This is called an critical edge. Allowable if we can insert computations on an edge. Otherwise, need split \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 12
13 Optimal Placement (Cont d) Computationally optimal If no other safe placement can result in fewer occurrences of the computation along any path from entry to exit in the program \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 13
14 Optimal Placement (cont d) Lifetime optimal Minimize the lifetimes of the introduced temporaries. Intuition: delay an expression to the latest point (Lazy Code Motion [KnoopEtal92, DrechslerStadel93]) \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 14
15 Outline Partial redundancy elimination (PRE) SSAPRE (a short summary) \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 15
16 SSAPRE \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 16
17 SSAPRE: Motivation Traditional data flow analysis based on bit-vectors do not interface well with SSA representation \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 17
18 Before PRE Traditional Partial Redundancy Elimination B 1 a x*y B 2 b x*y B 3 SSA form After PRE t x*y B 1 t x*y B 2 a t b t B 3 Not SSA form! \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 18
19 SSAPRE: Motivation (Cont.) Traditional PRE needs a postpass transform to turn the results into SSA form again. SSA is based on variables, not on expressions \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 19
20 SSAPRE: Motivation (Cont.) Representative occurrence Given a partially redundant occurrence E 0, we define the representative occurrence for E 0 as the nearest to E 0 among all occurrences that dominate E 0. Unique and well-defined \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 20
21 FRG (Factored Redundancy Graph) E E E E Control flow edge E =Φ(E, Φ E, ) Redundancy edge E E E E Without factoring Factored \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 21
22 FRG (Factored Redundancy Graph) E E t 0 x*y t 1 x*y E =Φ(E, E, ) t 2 Φ(t 0, t 1, t 3 ) E E Assume E=x*y t 2 t 2 Note: This is in SSA form \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 22
23 Observation Every use-def edge of the temporary corresponds directly to a redundancy edge for the expression \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 23
24 Intuition for SSAPRE Construct FRG for each expression E Refine redundant edges to form the use-def relation for each expression E s temporary Transform the program For a definition, replace with t E For a use, replace with t Sometimes need also insert an expression \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 24
25 An Example a 1 a 2 φ(a 4, a 1 ) B 1 B 2 a 1 t 1 a 1 + b 1 t2 φ φ(t 4, t 1 ) a 2 φ(a 4, a 1 ) B 1 B 2 a 2 +b a 3 B 3 t 2 a 3 t 3 a 3 + b 1 a 4 φ(a 2, a 3 ) a 4 +b B 4 t 4 φ(t 2, t 3 ) a 4 φ(a 2, a 3 ) t 4 B 4 exit B 5 exit \course\cpeg421-08s\topic-5a.ppt\course\cpeg421-07s\topic-7b.ppt 25
Topic I (d): Static Single Assignment Form (SSA)
Topic I (d): Static Single Assignment Form (SSA) 621-10F/Topic-1d-SSA 1 Reading List Slides: Topic Ix Other readings as assigned in class 621-10F/Topic-1d-SSA 2 ABET Outcome Ability to apply knowledge
More informationTopic 6 Basic Back-End Optimization
Topic 6 Basic Back-End Optimization Instruction Selection Instruction scheduling Register allocation 2008/4/8 \course\cpeg421-08s\topic-6.ppt 1 ABET Outcome Ability to apply knowledge of basic code generation
More informationThe SGI Pro64 Compiler Infrastructure - A Tutorial
The SGI Pro64 Compiler Infrastructure - A Tutorial Guang R. Gao (U of Delaware) J. Dehnert (SGI) J. N. Amaral (U of Alberta) R. Towle (SGI) Acknowledgement The SGI Compiler Development Teams The MIPSpro/Pro64
More informationAn Overview to Compiler Design. 2008/2/14 \course\cpeg421-08s\topic-1a.ppt 1
An Overview to Compiler Design 2008/2/14 \course\cpeg421-08s\topic-1a.ppt 1 Outline An Overview of Compiler Structure Front End Middle End Back End 2008/2/14 \course\cpeg421-08s\topic-1a.ppt 2 Reading
More informationCode Placement, Code Motion
Code Placement, Code Motion Compiler Construction Course Winter Term 2009/2010 saarland university computer science 2 Why? Loop-invariant code motion Global value numbering destroys block membership Remove
More informationE-path PRE Partial Redundancy Elimination Made Easy
E-path PRE Partial Redundancy Elimination Made Easy Dhananjay M. Dhamdhere dmd@cse.iitb.ac.in Department of Computer Science and Engineering Indian Institute of Technology, Mumbai 400 076 (India). Abstract
More informationLazy Code Motion. Jens Knoop FernUniversität Hagen. Oliver Rüthing University of Dortmund. Bernhard Steffen University of Dortmund
RETROSPECTIVE: Lazy Code Motion Jens Knoop FernUniversität Hagen Jens.Knoop@fernuni-hagen.de Oliver Rüthing University of Dortmund Oliver.Ruething@udo.edu Bernhard Steffen University of Dortmund Bernhard.Steffen@udo.edu
More informationCode Merge. Flow Analysis. bookkeeping
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
More informationLazy Code Motion. Comp 512 Spring 2011
Comp 512 Spring 2011 Lazy Code Motion Lazy Code Motion, J. Knoop, O. Ruthing, & B. Steffen, in Proceedings of the ACM SIGPLAN 92 Conference on Programming Language Design and Implementation, June 1992.
More informationA Fresh Look at PRE as a Maximum Flow Problem
CC 06, pages 39 -- 54, 2006. A Fresh Look at PRE as a Maximum Flow Problem Jingling Xue and Jens Knoop Programming Languages and Compilers Group, School of Computer Science and Engineering, University
More informationAn Implementation of Lazy Code Motion for Machine SUIF
An Implementation of Lazy Code Motion for Machine SUIF Laurent Rolaz Swiss Federal Institute of Technology Processor Architecture Laboratory Lausanne 28th March 2003 1 Introduction Optimizing compiler
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 informationInduction Variable Identification (cont)
Loop Invariant Code Motion Last Time Uses of SSA: reaching constants, dead-code elimination, induction variable identification Today Finish up induction variable identification Loop invariant code motion
More informationA Fresh Look at PRE as a Maximum Flow Problem
A Fresh Look at PRE as a Maximum Flow Problem Jingling Xue and Jens Knoop 2 Programming Languages and Compilers Group, School of Computer Science and Engineering, University of New South Wales, Sydney,
More informationC-SSAPRE: Eliminating redundancy over copies
C-SSAPRE: Eliminating redundancy over copies Tom Murphy VII, Brendan McMahan 7 May 2003 1 Introduction Partial Redundancy Elimination (PRE) is an optimization that prevents, where possible, the re-computation
More informationAnticipation-based partial redundancy elimination for static single assignment form
SOFTWARE PRACTICE AND EXPERIENCE Softw. Pract. Exper. 00; : 9 Published online 5 August 00 in Wiley InterScience (www.interscience.wiley.com). DOI: 0.00/spe.68 Anticipation-based partial redundancy elimination
More informationThe GNU Compiler Collection
The GNU Compiler Collection Diego Novillo dnovillo@redhat.com Gelato Federation Meeting Porto Alegre, Rio Grande do Sul, Brazil October 3, 2005 Introduction GCC is a popular compiler, freely available
More informationIntroduction to Optimization, Instruction Selection and Scheduling, and Register Allocation
Introduction to Optimization, Instruction Selection and Scheduling, and Register Allocation Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Traditional Three-pass Compiler
More informationCopyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit
Intermediate Representations 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
More informationCalvin Lin The University of Texas at Austin
Loop Invariant Code Motion Last Time SSA Today Loop invariant code motion Reuse optimization Next Time More reuse optimization Common subexpression elimination Partial redundancy elimination February 23,
More informationInstruction Selection: Peephole Matching. Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
Instruction Selection: Peephole Matching Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. The Problem Writing a compiler is a lot of work Would like to reuse components
More informationAn SSA-based Algorithm for Optimal Speculative Code Motion under an Execution Profile
An SSA-based Algorithm for Optimal Speculative Code Motion under an Execution Profile Hucheng Zhou Tsinghua University zhou-hc07@mails.tsinghua.edu.cn Wenguang Chen Tsinghua University cwg@tsinghua.edu.cn
More informationThe View from 35,000 Feet
The View from 35,000 Feet This lecture is taken directly from the Engineering a Compiler web site with only minor adaptations for EECS 6083 at University of Cincinnati Copyright 2003, Keith D. Cooper,
More informationWhat If. Static Single Assignment Form. Phi Functions. What does φ(v i,v j ) Mean?
Static Single Assignment Form What If Many of the complexities of optimization and code generation arise from the fact that a given variable may be assigned to in many different places. Thus reaching definition
More informationLoop Invariant Code Motion. Background: ud- and du-chains. Upward Exposed Uses. Identifying Loop Invariant Code. Last Time Control flow analysis
Loop Invariant Code Motion Loop Invariant Code Motion Background: ud- and du-chains Last Time Control flow analysis Today Loop invariant code motion ud-chains A ud-chain connects a use of a variable to
More informationCalvin Lin The University of Texas at Austin
Loop Invariant Code Motion Last Time Loop invariant code motion Value numbering Today Finish value numbering More reuse optimization Common subession elimination Partial redundancy elimination Next Time
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 informationExample. Example. Constant Propagation in SSA
Example x=1 a=x x=2 b=x x=1 x==10 c=x x++ print x Original CFG x 1 =1 a=x 1 x 2 =2 x 3 =φ (x 1,x 2 ) b=x 3 x 4 =1 x 5 = φ(x 4,x 6 ) x 5 ==10 c=x 5 x 6 =x 5 +1 print x 5 CFG in SSA Form In SSA form computing
More informationMiddle End. Code Improvement (or Optimization) Analyzes IR and rewrites (or transforms) IR Primary goal is to reduce running time of the compiled code
Traditional Three-pass Compiler Source Code Front End IR Middle End IR Back End Machine code Errors Code Improvement (or Optimization) Analyzes IR and rewrites (or transforms) IR Primary goal is to reduce
More informationRoy Dz-Ching Ju Tin-Fook Ngai Sun Chan Microprocessor Research Lab. Intel Corporation Santa Clara, CA U.S.A. {jin, tchen, hsu,
A Compiler Framework for Speculative Analysis and Optimizations Jin Lin Tong Chen Wei-Chung Hsu Pen-Chung Yew Department of Computer Science and Engineering University of Minnesota Minneapolis, MN 55455
More informationIntroduction to Optimization. CS434 Compiler Construction Joel Jones Department of Computer Science University of Alabama
Introduction to Optimization CS434 Compiler Construction Joel Jones Department of Computer Science University of Alabama Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
More informationPartial Redundancy Elimination using Lazy Code Motion
Partial Redundancy Elimination using Lazy Code Motion Sandeep Dasgupta 1 Tanmay Gangwani 2 May 11, 2014 1 Electronic address: sdasgup3@illinois.edu 2 Electronic address: gangwan2@illinois.edu 2 1. Problem
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 Practical Stride Prefetching Implementation in Global Optimizer
A Practical Stride Prefetching Implementation in Global Optimizer Hucheng Zhou Tsinghua University zhou-hc07@mails.tsinghua.edu.cn Xing Zhou Tsinghua University zhoux07@mails.tsinghua.edu.cn Tianwei Sheng,
More informationA Variation of Knoop, ROthing, and Steffen's Lazy Code Motion
A Variation of Knoop, ROthing, and Steffen's Lazy Code Motion by Karl-Heinz Drechsler and Manfred P. Stadel Siemens Nixdorf Informationssysteme AG, STM SD 2 Otto Hahn Ring 6, 8000 Mtinchen 83, Germany
More informationLecture 9: Loop Invariant Computation and Code Motion
Lecture 9: Loop Invariant Computation and Code Motion I. Loop-invariant computation II. III. Algorithm for code motion Partial redundancy elimination ALSU 9.5-9.5.2 Phillip B. Gibbons 15-745: Loop Invariance
More informationLecture 5. Partial Redundancy Elimination
Lecture 5 Partial Redundancy Elimination I. Forms of redundancy global common subexpression elimination loop invariant code motion partial redundancy II. Lazy Code Motion Algorithm Mathematical concept:
More informationarxiv: v2 [cs.pl] 16 Sep 2014
A Simple Algorithm for Global Value Numbering arxiv:1303.1880v2 [cs.pl] 16 Sep 2014 Nabizath Saleena and Vineeth Paleri Department of Computer Science and Engineering National Institute of Technology Calicut,
More informationHigh-level View of a Compiler
High-level View of a Compiler Source Compiler Implications Must recognize legal (and illegal) programs Must generate correct Must manage storage of all variables (and ) Must agree with OS & linker on format
More informationCS415 Compilers. Intermediate Represeation & Code Generation
CS415 Compilers Intermediate Represeation & Code Generation These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Review - Types of Intermediate Representations
More informationCPEG 421/621 - Spring 2008
CPEG 421/621 - Spring 2008 Compiler Design: The Software and Hardware Tradeoffs 2008/2/21 \course\cpeg421-08s\topic-1.ppt 1 Admin. Information Instructor: Office: Prof. Guang R. Gao 312 DuPont Hall Phone:
More informationA Compiler Framework for Recovery Code Generation in General Speculative Optimizations
A Compiler Framework for Recovery Code Generation in General Speculative Optimizations Jin Lin, Wei-Chung Hsu, Pen-Chung Yew, Roy Dz-Ching Ju and Tin-Fook Ngai Department of Computer Science and Microprocessor
More informationTOWARD A SOFTWARE PIPELINING FRAMEWORK FOR MANY-CORE CHIPS. by Juergen Ributzka
TOWARD A SOFTWARE PIPELINING FRAMEWORK FOR MANY-CORE CHIPS by Juergen Ributzka A thesis submitted to the Faculty of the University of Delaware in partial fulfillment of the requirements for the degree
More informationData Structures and Algorithms in Compiler Optimization. Comp314 Lecture Dave Peixotto
Data Structures and Algorithms in Compiler Optimization Comp314 Lecture Dave Peixotto 1 What is a compiler Compilers translate between program representations Interpreters evaluate their input to produce
More informationAMD S X86 OPEN64 COMPILER. Michael Lai AMD
AMD S X86 OPEN64 COMPILER Michael Lai AMD CONTENTS Brief History AMD and Open64 Compiler Overview Major Components of Compiler Important Optimizations Recent Releases Performance Applications and Libraries
More informationIntermediate Representations
COMP 506 Rice University Spring 2018 Intermediate Representations source code IR Front End Optimizer Back End IR target code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights reserved. Students
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 informationCSC D70: Compiler Optimization LICM: Loop Invariant Code Motion
CSC D70: Compiler Optimization LICM: Loop Invariant Code Motion Prof. Gennady Pekhimenko University of Toronto Winter 2018 The content of this lecture is adapted from the lectures of Todd Mowry and Phillip
More informationOverview of a Compiler
Overview of a Compiler Copyright 2015, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California have explicit permission to make copies of
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 informationIntroduction to Machine-Independent Optimizations - 6
Introduction to Machine-Independent Optimizations - 6 Machine-Independent Optimization Algorithms Department of Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course
More informationOpenUH Compiler Suite
OpenUH Compiler Suite User s Guide Version alpha University of Houston Computer Science Department High Performance Tools Group Dr. Barbara Chapman Last Modified: 1/26/2006 Table of Contents I. Introduction...
More informationAdvanced Compiler Construction
CS 526 Advanced Compiler Construction http://misailo.cs.illinois.edu/courses/cs526 INTERPROCEDURAL ANALYSIS The slides adapted from Vikram Adve So Far Control Flow Analysis Data Flow Analysis Dependence
More informationCompiler Optimisation
Compiler Optimisation 4 Dataflow Analysis Hugh Leather IF 1.18a hleather@inf.ed.ac.uk Institute for Computing Systems Architecture School of Informatics University of Edinburgh 2018 Introduction This lecture:
More information8. Static Single Assignment Form. Marcus Denker
8. Static Single Assignment Form Marcus Denker Roadmap > Static Single Assignment Form (SSA) > Converting to SSA Form > Examples > Transforming out of SSA 2 Static Single Assignment Form > Goal: simplify
More informationCS415 Compilers. Procedure Abstractions. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University
CS415 Compilers Procedure Abstractions These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Where are we? Well understood Engineering Source Code
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 informationA Bad Name. CS 2210: Optimization. Register Allocation. Optimization. Reaching Definitions. Dataflow Analyses 4/10/2013
A Bad Name Optimization is the process by which we turn a program into a better one, for some definition of better. CS 2210: Optimization This is impossible in the general case. For instance, a fully optimizing
More informationIntroduction to Optimization Local Value Numbering
COMP 506 Rice University Spring 2018 Introduction to Optimization Local Value Numbering source IR IR target code Front End Optimizer Back End code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights
More informationA Compiler Framework for Speculative Optimizations
A Compiler Framework for Speculative Optimizations JIN LIN, TONG CHEN, WEI-CHUNG HSU, PEN-CHUNG YEW and ROY DZ-CHING JU, TIN-FOOK NGAI, SUN CHAN Speculative execution, such as control speculation or data
More informationECE 5775 High-Level Digital Design Automation Fall More CFG Static Single Assignment
ECE 5775 High-Level Digital Design Automation Fall 2018 More CFG Static Single Assignment Announcements HW 1 due next Monday (9/17) Lab 2 will be released tonight (due 9/24) Instructor OH cancelled this
More informationOverview of a Compiler
Overview of a Compiler Copyright 2017, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California have explicit permission to make copies of
More informationUsing GCC as a Research Compiler
Using GCC as a Research Compiler Diego Novillo dnovillo@redhat.com Computer Engineering Seminar Series North Carolina State University October 25, 2004 Introduction GCC is a popular compiler, freely available
More informationOverview of a Compiler
High-level View of a Compiler Overview of a Compiler Compiler Copyright 2010, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California have
More informationReuse Optimization. LLVM Compiler Infrastructure. Local Value Numbering. Local Value Numbering (cont)
LLVM Compiler Infrastructure Source: LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation by Lattner and Adve Reuse Optimization Eliminate redundant operations in the dynamic execution
More informationThe Elcor Intermediate Representation. Trimaran Tutorial
129 The Elcor Intermediate Representation Traditional ILP compiler phase diagram 130 Compiler phases Program region being compiled Region 1 Region 2 Region n Global opt. Region picking Regional memory
More informationSpeculative Register Promotion Using Advanced Load Address Table (ALAT)
Speculative Register Promotion Using Advanced Load Address Table (ALAT) Jin Lin, Tong Chen, Wei-Chung Hsu and Pen-Chung Yew Department of Computer Science and Engineering University of Minnesota Email:
More informationCompiler Construction 2009/2010 SSA Static Single Assignment Form
Compiler Construction 2009/2010 SSA Static Single Assignment Form Peter Thiemann March 15, 2010 Outline 1 Static Single-Assignment Form 2 Converting to SSA Form 3 Optimization Algorithms Using SSA 4 Dependencies
More informationCompiler Optimizations. Chapter 8, Section 8.5 Chapter 9, Section 9.1.7
Compiler Optimizations Chapter 8, Section 8.5 Chapter 9, Section 9.1.7 2 Local vs. Global Optimizations Local: inside a single basic block Simple forms of common subexpression elimination, dead code elimination,
More informationCompiler Optimization Intermediate Representation
Compiler Optimization Intermediate Representation Virendra Singh Associate Professor Computer Architecture and Dependable Systems Lab Department of Electrical Engineering Indian Institute of Technology
More informationThe Design and Implementation of Gnu Compiler Collection
The Design and Implementation of Gnu Compiler Collection Uday Khedker (www.cse.iitb.ac.in/ uday) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay July 2008 Part 1
More informationLoop Optimizations. Outline. Loop Invariant Code Motion. Induction Variables. Loop Invariant Code Motion. Loop Invariant Code Motion
Outline Loop Optimizations Induction Variables Recognition Induction Variables Combination of Analyses Copyright 2010, Pedro C Diniz, all rights reserved Students enrolled in the Compilers class at the
More informationJust-In-Time Compilers & Runtime Optimizers
COMP 412 FALL 2017 Just-In-Time Compilers & Runtime Optimizers Comp 412 source code IR Front End Optimizer Back End IR target code Copyright 2017, Keith D. Cooper & Linda Torczon, all rights reserved.
More information6. Intermediate Representation!
6. Intermediate Representation! Prof. O. Nierstrasz! Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.! http://www.cs.ucla.edu/~palsberg/!
More informationLecture 23 CIS 341: COMPILERS
Lecture 23 CIS 341: COMPILERS Announcements HW6: Analysis & Optimizations Alias analysis, constant propagation, dead code elimination, register allocation Due: Wednesday, April 25 th Zdancewic CIS 341:
More informationIntermediate Representations
Intermediate Representations Intermediate Representations (EaC Chaper 5) Source Code Front End IR Middle End IR Back End Target Code Front end - produces an intermediate representation (IR) Middle end
More informationOpen64 Introduction. Yulei Sui. February 3, 2010
Open64 Introduction Yulei Sui February 3, 2010 Abstract This document presents on how to use, develop and research on open64, We do not try to do research on all parts of Open64,and we mainly focus on
More informationCombining Optimizations: Sparse Conditional Constant Propagation
Comp 512 Spring 2011 Combining Optimizations: Sparse Conditional Constant Propagation Copyright 2011, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled in Comp 512 at Rice University
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 informationLecture 10: Lazy Code Motion
Lecture : Lazy Code Motion I. Mathematical concept: a cut set II. Lazy Code Motion Algorithm Pass : Anticipated Expressions Pass 2: (Will be) Available Expressions Pass 3: Postponable Expressions Pass
More informationCompiler Passes. Optimization. The Role of the Optimizer. Optimizations. The Optimizer (or Middle End) Traditional Three-pass Compiler
Compiler Passes Analysis of input program (front-end) character stream Lexical Analysis Synthesis of output program (back-end) Intermediate Code Generation Optimization Before and after generating machine
More informationCS415 Compilers Register Allocation. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University
CS415 Compilers Register Allocation These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Review: The Back End IR Instruction Selection IR Register
More information6. Intermediate Representation
6. Intermediate Representation Oscar Nierstrasz Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes. http://www.cs.ucla.edu/~palsberg/
More informationCompiler Optimizations. Chapter 8, Section 8.5 Chapter 9, Section 9.1.7
Compiler Optimizations Chapter 8, Section 8.5 Chapter 9, Section 9.1.7 2 Local vs. Global Optimizations Local: inside a single basic block Simple forms of common subexpression elimination, dead code elimination,
More informationDevelopment of an Efficient DSP Compiler Based on Open64
Development of an Efficient DSP Compiler Based on Open64 Subrato K. De, Anshuman Dasgupta, Sundeep Kushwaha, Tony Linthicum, Susan Brownhill, Sergei Larin, Taylor Simpson Qualcomm Incorporated, San Diego
More informationIntermediate Representation (IR)
Intermediate Representation (IR) Components and Design Goals for an IR IR encodes all knowledge the compiler has derived about source program. Simple compiler structure source code More typical compiler
More informationLocal Optimization: Value Numbering The Desert Island Optimization. Comp 412 COMP 412 FALL Chapter 8 in EaC2e. target code
COMP 412 FALL 2017 Local Optimization: Value Numbering The Desert Island Optimization Comp 412 source code IR Front End Optimizer Back End IR target code Copyright 2017, Keith D. Cooper & Linda Torczon,
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 informationSSA-Form Register Allocation
SSA-Form Register Allocation Foundations Sebastian Hack Compiler Construction Course Winter Term 2009/2010 saarland university computer science 2 Overview 1 Graph Theory Perfect Graphs Chordal Graphs 2
More informationData Flow Analysis and Computation of SSA
Compiler Design 1 Data Flow Analysis and Computation of SSA Compiler Design 2 Definitions A basic block is the longest sequence of three-address codes with the following properties. The control flows to
More informationCS553 Lecture Profile-Guided Optimizations 3
Profile-Guided Optimizations Last time Instruction scheduling Register renaming alanced Load Scheduling Loop unrolling Software pipelining Today More instruction scheduling Profiling Trace scheduling CS553
More informationAgenda. CSE P 501 Compilers. Big Picture. Compiler Organization. Intermediate Representations. IR for Code Generation. CSE P 501 Au05 N-1
Agenda CSE P 501 Compilers Instruction Selection Hal Perkins Autumn 2005 Compiler back-end organization Low-level intermediate representations Trees Linear Instruction selection algorithms Tree pattern
More informationIntermediate representations IR #1: CPS/L 3. Code example. Advanced Compiler Construction Michel Schinz
Intermediate representations Intermediate representations Advanced Compiler Construction Michel Schinz 2016 03 03 The term intermediate representation (IR) or intermediate language designates the data-structure(s)
More informationLecture Notes on Common Subexpression Elimination
Lecture Notes on Common Subexpression Elimination 15-411: Compiler Design Frank Pfenning Lecture 18 October 29, 2015 1 Introduction Copy propagation allows us to have optimizations with this form: l :
More information7. Optimization! Prof. O. Nierstrasz! Lecture notes by Marcus Denker!
7. Optimization! Prof. O. Nierstrasz! Lecture notes by Marcus Denker! Roadmap > Introduction! > Optimizations in the Back-end! > The Optimizer! > SSA Optimizations! > Advanced Optimizations! 2 Literature!
More informationMemory Redundancy Elimination to Improve Application Energy Efficiency
Memory Redundancy Elimination to Improve Application Energy Efficiency Keith D. Cooper and Li Xu Department of Computer Science Rice University Houston, Texas, USA Abstract. Application energy consumption
More informationIntermediate Representations & Symbol Tables
Intermediate Representations & Symbol Tables Copyright 2014, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California have explicit permission
More informationTour of common optimizations
Tour of common optimizations Simple example foo(z) { x := 3 + 6; y := x 5 return z * y } Simple example foo(z) { x := 3 + 6; y := x 5; return z * y } x:=9; Applying Constant Folding Simple example foo(z)
More informationInstruction Selection: Preliminaries. Comp 412
COMP 412 FALL 2017 Instruction Selection: Preliminaries Comp 412 source code Front End Optimizer Back End target code Copyright 2017, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled
More informationProgramming Language Processor Theory
Programming Language Processor Theory Munehiro Takimoto Course Descriptions Method of Evaluation: made through your technical reports Purposes: understanding various theories and implementations of modern
More information