1 CS 201 Compiler Construction Lecture Interprocedural Data Flow Analysis.

Slides:



Advertisements
Similar presentations
A Framework for Unrestricted Whole-Program Optimization Spyridon Triantafyllis, Matthew J. Bridges, Easwaran Raman, Guilherme Ottoni, David I. August The.
Advertisements

Automating Software Module Testing for FAA Certification Usha Santhanam The Boeing Company.
Sub and Function Procedures
Interprocedural Analysis. Currently, we only perform data-flow analysis on procedures one at a time. Such analyses are called intraprocedural analyses.
R O O T S Interprocedural Analysis Aleksandra Biresev
1 CS 201 Compiler Construction Lecture 3 Data Flow Analysis.
Context-Sensitive Interprocedural Points-to Analysis in the Presence of Function Pointers Presentation by Patrick Kaleem Justin.
Interprocedural Analysis Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday
Architecture-dependent optimizations Functional units, delay slots and dependency analysis.
Compilation 2011 Static Analysis Johnni Winther Michael I. Schwartzbach Aarhus University.
Control-Flow Graphs & Dataflow Analysis CS153: Compilers Greg Morrisett.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
School of EECS, Peking University “Advanced Compiler Techniques” (Fall 2011) Dataflow Analysis Introduction Guo, Yao Part of the slides are adapted from.
Chapter 7: User-Defined Simple Data Types, Namespaces, and the string Type.
Objectives In this chapter, you will:
Program Analysis with Set Constraints Ravi Chugh.
Program Analysis with Set Constraints Ravi Chugh.
Interprocedural analysis © Marcelo d’Amorim 2010.
1 CS 201 Compiler Construction Lecture 5 Code Optimizations: Copy Propagation & Elimination.
Recap from last time We were trying to do Common Subexpression Elimination Compute expressions that are available at each program point.
Feedback: Keep, Quit, Start
Next Section: Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis (Wilson & Lam) –Unification.
Interprocedural analyses and optimizations. Costs of procedure calls Up until now, we treated calls conservatively: –make the flow function for call nodes.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
CS 536 Spring Intermediate Code. Local Optimizations. Lecture 22.
ECE1724F Compiler Primer Sept. 18, 2002.
4/23/09Prof. Hilfinger CS 164 Lecture 261 IL for Arrays & Local Optimizations Lecture 26 (Adapted from notes by R. Bodik and G. Necula)
Names and Scopes CS 351. Program Binding We should be familiar with this notion. A variable is bound to a method or current block e.g in C++: namespace.
CS Data Structures Appendix 1 How to transfer a simple loop- expression to a recursive function (factorial calculation)
Previous finals up on the web page use them as practice problems look at them early.
1 CS 201 Compiler Construction Lecture 3 Data Flow Analysis.
1 CS 201 Compiler Construction Lecture 6 Code Optimizations: Constant Propagation & Folding.
A simple approach Given call graph and CFGs of procedures, create a single CFG (control flow super-graph) by: –connecting call sites to entry nodes of.
Intermediate Code. Local Optimizations
Role Analysis Victor Kunkac, Patric Lam, Martin Rinard Laboratory for Computer Science, MIT Presentation by George Caragea CMSC631,
Comparison Caller precisionCallee precisionCode bloat Inlining context-insensitive interproc Context sensitive interproc Specialization.
Schedule Midterm out tomorrow, due by next Monday Final during finals week Project updates next week.
Improving the Precision of Abstract Simulation using Demand-driven Analysis Olatunji Ruwase Suzanne Rivoire CS June 12, 2002.
Pointer analysis. Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis Andersen and.
From last class. The above is Click’s solution (PLDI 95)
Procedure Optimizations and Interprocedural Analysis Chapter 15, 19 Mooly Sagiv.
1 CS 201 Compiler Construction Data Flow Analysis.
Advanced Compiler Techniques LIU Xianhua School of EECS, Peking University Inter-procedural Analysis.
Chapter 6: User-Defined Functions I Instructor: Mohammad Mojaddam
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University STATIC ANALYSES FOR JAVA IN THE PRESENCE OF DISTRIBUTED COMPONENTS AND.
PRESTO Research Group, Ohio State University Interprocedural Dataflow Analysis in the Presence of Large Libraries Atanas (Nasko) Rountev Scott Kagan Ohio.
Chapter 06 (Part I) Functions and an Introduction to Recursion.
Chapter 6: User-Defined Functions
1 Data Flow Analysis Data flow analysis is used to collect information about the flow of data values across basic blocks. Dominator analysis collected.
CCSA 221 Programming in C CHAPTER 8 – PART 1 WORKING WITH FUNCTIONS 1.
Using Types to Analyze and Optimize Object-Oriented Programs By: Amer Diwan Presented By: Jess Martin, Noah Wallace, and Will von Rosenberg.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
1/32 This Lecture Substitution model An example using the substitution model Designing recursive procedures Designing iterative procedures Proving that.
Functions Math library functions Function definition Function invocation Argument passing Scope of an variable Programming 1 DCT 1033.
Chapter 3: User-Defined Functions I
CS412/413 Introduction to Compilers Radu Rugina Lecture 11: Symbol Tables 13 Feb 02.
CS 404Ahmed Ezzat 1 CS 404 Introduction to Compiler Design Lecture 1 Ahmed Ezzat.
Oracle9i Developer: PL/SQL Programming Chapter 6 PL/SQL Packages.
Inter-procedural analysis
TK1924 Program Design & Problem Solving Session 2011/2012
Week 3-4 Control flow (review) Function definition Program Structures
Code Optimization Overview and Examples
Function There are two types of Function User Defined Function
Interprocedural Analysis Chapter 19
Bison: Parser Generator
For Example: User level quicksort program Three address code.
CS 3304 Comparative Languages
1. Reaching Definitions Definition d of variable v: a statement d that assigns a value to v. Use of variable v: reference to value of v in an expression.
Code Optimization Overview and Examples Control Flow Graph
Pointer analysis.
Presentation transcript:

1 CS 201 Compiler Construction Lecture Interprocedural Data Flow Analysis

2 Intraprocedural Analysis Individual procedures are analyzed in isolation; worst-case assumpltion are made while processing call sites. Example: X = 3; P(); … = X Does definiton X=3 reach this point? Yes Is X a constant? No We assume that P() does not kill any definition for reaching definitions analysis and we assume P() kills all constants that reach the call P().

Interprocedural Analysis By considering interactions between calling and called procedures, analyze the whole program. Challenges Scoping Rules Aliasing due to reference parameters Procedure P (f1,f2) f1 = … f2 = … …. = f1 where if f1 defined ? f1 =… what about call P(X,X)?

Interprocedural Analysis Challenges contd… Calling Context – cannot represent call-return using simple control flow edges. Invalid paths are created by simple control flow edges causing definition of X at statement 1 to reach use of X at statement 4.

Handling Calling Context Various Approaches: 1.Procedure Inlining – replace the call by procedure body. Drawbacks –Code size increases –Recursion causes problems 2.Call String Approach – add calling context information to data flow values by tagging them with call-return history. 5

Handling Calling Context 3.Functional Approach Two phases Analyze effect of procedure invocation independent of calling context  find a summary transfer function for the entire procedure Analyze each procedure using summary functions for all called procedures 6

Functional Approach 7

Functional Approach Contd.. 8

9

10

Functional Approach Contd.. 11

Functional Approach Contd.. 12

Example: Available Expressions 13

Example: Available Expressions 14

Example: Available Expressions 15

Example: Available Expressions 16 Summary functions

Example: Available Expressions 17

18 Sample Problems Interprocedural Data Flow Analysis