Common Subexpression Elimination and Copy Propagation in Titanium

Slides:



Advertisements
Similar presentations
CS3771 Today: deadlock detection and election algorithms  Previous class Event ordering in distributed systems Various approaches for Mutual Exclusion.
Advertisements

1 CS 201 Compiler Construction Lecture 3 Data Flow Analysis.
Loops or Lather, Rinse, Repeat… CS153: Compilers Greg Morrisett.
CIS Intro to AI 1 Interpreting Line Drawings & Constraint Satisfaction II Mitch Marcus CIS 391 – Fall 2008.
19 Classic Examples of Local and Global Code Optimizations Local Constant folding Constant combining Strength reduction.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
Chapter 10 Code Optimization. A main goal is to achieve a better performance Front End Code Gen Intermediate Code source Code target Code user Machine-
1 Code Optimization Code produced by compilation algorithms can often be improved (ideally optimized) in terms of run-time speed and the amount of memory.
Reference Details (copying, comparing). References You were introduced to the concept of pointers earlier this term. The pointer capabilities in pseudocode.
1 May-Alias Analysis for L3 David Abraham, Elisabeth Crawford, Sue Ann Hong, and Virginia Vassilevska.
Optimization Compiler Baojian Hua
1 CS 201 Compiler Construction Lecture 7 Code Optimizations: Partial Redundancy Elimination.
School of EECS, Peking University “Advanced Compiler Techniques” (Fall 2011) Partial Redundancy Elimination Guo, Yao.
Partial Redundancy Elimination & Lazy Code Motion
Partial Redundancy Elimination. Partial-Redundancy Elimination Minimize the number of expression evaluations By moving around the places where an expression.
6/9/2015© Hal Perkins & UW CSEU-1 CSE P 501 – Compilers SSA Hal Perkins Winter 2008.
1 CS 201 Compiler Construction Lecture 5 Code Optimizations: Copy Propagation & Elimination.
CS 536 Spring Intermediate Code. Local Optimizations. Lecture 22.
Global optimization. Data flow analysis To generate better code, need to examine definitions and uses of variables beyond basic blocks. With use- definition.
CS 201 Compiler Construction
Class canceled next Tuesday. Recap: Components of IR Control dependencies: sequencing of operations –evaluation of if & then –side-effects of statements.
Common Sub-expression Elim Want to compute when an expression is available in a var Domain:
Copy Propagation and Common Subexpression Elimination in Titanium Johnathon Jamison David Marin CS265 S. Graham.
Machine-Independent Optimizations Ⅰ CS308 Compiler Theory1.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Global optimization. Data flow analysis To generate better code, need to examine definitions and uses of variables beyond basic blocks. With use- definition.
PSUCS322 HM 1 Languages and Compiler Design II IR Code Optimization Material provided by Prof. Jingke Li Stolen with pride and modified by Herb Mayer PSU.
1 CS 201 Compiler Construction Data Flow Analysis.
CSE P501 – Compiler Construction
Graphs 2 Kevin Kauffman CS 309s. Problem We have sprinklers in our yard which need to be connected with pipe. Assuming pipes may only intersect at sprinkler.
What’s in an optimizing compiler?
IMPLEMENTING ARRAYLIST – Part 2 COMP 103. RECAP  Abstract Classes – overview, details in 2 nd year  Implementing the ArrayList: size(), get(), set()
1 CS 151 : Digital Design Chapter 4: Arithmetic Functions and Circuits 4-3 : Binary Subtraction.
CS 3214 Computer Systems Godmar Back Lecture 8. Announcements Stay tuned for Project 2 & Exercise 4 Project 1 due Sep 16 Auto-fail rule 1: –Need at least.
CS412/413 Introduction to Compilers and Translators April 2, 1999 Lecture 24: Introduction to Optimization.
Throttle Studies David Wren Analysis Group Meeting 22 March 2004.
Code Optimization Data Flow Analysis. Data Flow Analysis (DFA)  General framework  Can be used for various optimization goals  Some terms  Basic block.
Code Optimization Code produced by compilation algorithms can often be improved (ideally optimized) in terms of run-time speed and the amount of memory.
Example: a parallel plate capacitor has an area of 10 cm2 and plate separation 5 mm. 300 V is applied between its plates. If neoprene is inserted between.
The Subset-sum Problem
Smart Schools Investment Plan Amendments
Sami Rollins Spring 2006 CS312 Algorithms Sami Rollins Spring 2006.
User-Written Functions
Lecture 5 Partial Redundancy Elimination
Gene Mutations.
Partial Products Algorithm for Multiplication
Basic Block Optimizations
Common Subexpression Elimination
CSC D70: Compiler Optimization LICM: Loop Invariant Code Motion
Common Subexpression Elimination
مبررات إدخال الحاسوب في رياض الأطفال
Topic 10: Dataflow Analysis
Code Generation Part III
David Kaplan Dept of Computer Science & Engineering Autumn 2001
Array-Based Sequences
CS 201 Compiler Construction
Nate Brunelle Today: Functions again, Scope
Code Generation Part III
21twelveinteractive.com/ twitter.com/21twelveI/ facebook.com/21twelveinteractive/ linkedin.com/company/21twelve-interactive/ pinterest.com/21twelveinteractive/
Binary Search Trees 7/16/2009.
Unit 3 Review (Calculator)
CSC D70: Compiler Optimization LICM: Loop Invariant Code Motion
Linked Lists.
Biome Project Put the general and specific names of you biome here.
Calculate 9 x 81 = x 3 3 x 3 x 3 x 3 3 x 3 x 3 x 3 x 3 x 3 x =
CSE P 501 – Compilers SSA Hal Perkins Autumn /31/2019
Nate Brunelle Today: Functions again, Scope
[Most of the details about queues are left for to read about and work out in Lab 6.] Def. As a data structure, a queue is an ordered collection of data.
Live Variables – Basic Block
Basic Block Optimizations
Presentation transcript:

Common Subexpression Elimination and Copy Propagation in Titanium Johnathon Jamison David Marin CS265 S. Graham

Global Copy Propagation Given a = b; … x = a + 1; We want to replace a with b on the last line, but we need to know that a and b are unchanged Def/use analysis isn’t quite enough (why?)

Inserting Fake Defs and Uses Add fake defs and uses so that def/use analysis gives us the info we need b = b; a = b; … newtemp = b; x = a + 1;

Interaction with Copy Propagation Any temps introduced are placed after the calculation, so that copy propagation can remove them a = f * i a = f * i temp_1 = a … … b = f * i b = temp_1 temp_2 = b c = f * i c = temp_2

Local CSE Used Muchnick’s algorithm (described in class) Used defs to find what was killed Fully implemented Except method calls Since we are using defs already, why not so something more substantial?