Lecture 5. Data Flow Analysis

Similar documents
compile-time reasoning about the run-time ow represent facts about run-time behavior represent eect of executing each basic block

Homework Assignment #1 Sample Solutions

Principles of Program Analysis. Lecture 1 Harry Xu Spring 2013

Live Variable Analysis. Work List Iterative Algorithm Rehashed

Lecture 6. Abstract Interpretation

Time Stamps for Fixed-Point Approximation

Compiler Structure. Data Flow Analysis. Control-Flow Graph. Available Expressions. Data Flow Facts

Thursday, December 23, The attack model: Static Program Analysis

Introduction to Machine-Independent Optimizations - 4

Dataflow analysis (ctd.)

Symbolic Solver for Live Variable Analysis of High Level Design Languages

CS 4120 Lecture 31 Interprocedural analysis, fixed-point algorithms 9 November 2011 Lecturer: Andrew Myers

20b -Advanced-DFA. J. L. Peterson, "Petri Nets," Computing Surveys, 9 (3), September 1977, pp

Page # 20b -Advanced-DFA. Reading assignment. State Propagation. GEN and KILL sets. Data Flow Analysis

Advanced Compiler Construction

Program Static Analysis. Overview

p q r int (*funcptr)(); SUB2() {... SUB3() {... } /* End SUB3 */ SUB1() {... c1: SUB3();... c3 c1 c2: SUB3();... } /* End SUB2 */ ...

Code Placement, Code Motion

Flow Analysis. Data-flow analysis, Control-flow analysis, Abstract interpretation, AAM

CS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014

Constructing Control Flow Graph for Java by Decoupling Exception Flow from Normal Flow

Lecture Notes: Widening Operators and Collecting Semantics

Automatic Determination of May/Must Set Usage in Data-Flow Analysis

More Dataflow Analysis

Lecture Notes: Dataflow Analysis Examples

Identifying Parallelism in Construction Operations of Cyclic Pointer-Linked Data Structures 1

Department of Computer Sciences CS502. Purdue University is an Equal Opportunity/Equal Access institution.

Compiler Design. Fall Data-Flow Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

4/24/18. Overview. Program Static Analysis. Has anyone done static analysis? What is static analysis? Why static analysis?

Escape Analysis for Java

ait: WORST-CASE EXECUTION TIME PREDICTION BY STATIC PROGRAM ANALYSIS

Foundations of Dataflow Analysis

Lecture 6 Foundations of Data Flow Analysis

A Domain-Specific Language for Generating Dataflow Analyzers

Static Analysis and Dataflow Analysis

Utilizing Static Analysis for Programmable Logic Controllers

Why Data Flow Models? Dependence and Data Flow Models. Learning objectives. Def-Use Pairs (1) Models from Chapter 5 emphasized control

Compiler Optimisation

An Abstract Interpretation Framework for Verification of Timed Concurrent Constraint Languages

Program Analysis and Verification

Lecture 6 Foundations of Data Flow Analysis

Evaluating a Demand Driven Technique for Call Graph Construction

Experimental Comparison of call string and. functional Approaches to Interprocedural. Analysis? Florian Martin

Dependence and Data Flow Models. (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1

Deferred Data-Flow Analysis : Algorithms, Proofs and Applications

Research on the Static Analysis Method of the Localization Embedded Platform Software Code Zhijie Gaoa, Ling Lu, Wen Jiao

Control Flow Analysis with SAT Solvers

CS243 Homework 1. Winter Due: January 23, 2019 at 4:30 pm

Advanced Program Analyses for Object-oriented Systems

Data-Flow Analysis Foundations

MIT Introduction to Dataflow Analysis. Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology

CSE 501 Midterm Exam: Sketch of Some Plausible Solutions Winter 1997

Data Flow Analysis. CSCE Lecture 9-02/15/2018

Data Flow Analysis. Program Analysis

Compiler Optimisation

A Class of Polynomially Solvable Range Constraints for Interval Analysis without Widenings and Narrowings

Implementation Techniques for Efficient Data-Flow Analysis of Large Programs

We can express this in dataflow equations using gen and kill sets, where the sets are now sets of expressions.

A Domain-Specific Language for Generating Dataflow Analyzers

We can express this in dataflow equations using gen and kill sets, where the sets are now sets of expressions.

RATCOP: Relational Analysis Tool for Concurrent Programs

Comprehensive Path-sensitive Data-flow Analysis

Lecture Notes on Dataflow Analysis

Interprocedural Analysis. Dealing with Procedures. Course so far: Terminology

Lecture 2: Control Flow Analysis

A DEMAND-DRIVEN APPROACH FOR EFFICIENT INTERPROCEDURAL DATA FLOW ANALYSIS. Evelyn Duesterwald. M.S., University of Pittsburgh, 1991

Memory optimisation in a first-order dataflow synchronous language

PROGRAM ANALYSIS & SYNTHESIS

Symbolic Trajectory Evaluation - A Survey

Principles of Program Analysis: Data Flow Analysis

Data Flow Information. already computed

Preventing Defects. SWE 795, Spring 2017 Software Engineering Environments

The Development of Static Single Assignment Form

Class 6. Review; questions Assign (see Schedule for links) Slicing overview (cont d) Problem Set 3: due 9/8/09. Program Slicing

Model Checking: Back and Forth Between Hardware and Software

Visualization of Dataflow Analyses

Using Static Single Assignment Form

DFA&:OPT-METAFrame: A Tool Kit for Program Analysis and Optimization

Data Flow Analysis Frameworks for. Matthew B. Dwyer

APA Interprocedural Dataflow Analysis

A Fair Extension of (Soft) Concurrent Constraint Languages

Static Analysis. Systems and Internet Infrastructure Security

Register allocation. Register allocation: ffl have value in a register when used. ffl limited resources. ffl changes instruction choices

Data Flow Analysis. Agenda CS738: Advanced Compiler Optimizations. 3-address Code Format. Assumptions

Lecture 2. Introduction to Data Flow Analysis

Speeding Up Dataflow Analysis Using Flow-Insensitive Pointer Analysis

ICS 252 Introduction to Computer Design

Control Flow Analysis. Reading & Topics. Optimization Overview CS2210. Muchnick: chapter 7

ECE468 Fall 2003, Final Exam

Toward Abstract Interpretation of Program Transformations

Dataflow Analysis 2. Data-flow Analysis. Algorithm. Example. Control flow graph (CFG)

Interprocedural Analysis. Motivation. Interprocedural Analysis. Function Calls and Pointers

Calvin Lin The University of Texas at Austin

Program Analysis. Readings

CPEG 421/621 - Spring 2008

Pluggable SAT-Solvers for SMT-Solvers

EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization

Improving the Static Analysis of Loops by Dynamic Partitioning Techniques

Regression Verification - a practical way to verify programs

Data-flow Analysis - Part 2

Transcription:

Lecture 5. Data Flow Analysis Wei Le 2014.10

Abstraction-based Analysis dataflow analysis: combines model checking s fix point engine with abstract interpretation of data values abstract interpretation: interpretation of program executions over an abstract domain; the semantics of program statements is lifted to operate on a set of states, an element of an abstract domain, rather than a single concrete statements note: credit to Matt Dwyer

Dataflow Analysis What is dataflow analysis? The flow of data values The global properties of data at a program point

Reaching Definitions

Available Expressions

Live Variable Analysis

Generalizing Dataflow Analysis An instance of dataflow problem: What is the problem? The properties of dataflow problems: backward or forward (determine the direction of the dataflow) may or must (determine how to merge dataflow) Dataflow equation: Gen, Kill, In, Out (local information)

Generalizing Dataflow Analysis Goal: solving dataflow equations - determine dataflow for the whole program Reaching definitions: for each program point, what are the definitions can reach Available expressions: for each program point, what are the expressions available Live variables: for each program point, what are the variables available Framework: a set of data propagation algorithms for a set of dataflow problems Key of the algorithm: Stabilize in presence of loops fixpoint, using worklist algorithm Data structure for efficiency: bit vector to represent the global information Reaching definitions: each definition is a bit, each program point has a bitvector Available expressions: each expression is a bit, each program point has a bitvector Live variable analysis: each variable is a bit, each program point has a bitvector

Dataflow Algorithms Exhaustive (Dragon Book) Demand-driven [1] for forward problem, considering all possible paths from the entry to the given point, compute flow value for all the paths, and then meet the flow value at the end of the points

Conservative Analysis

Formal Model to Describe Dataflow Analysis [3, 2] Lattice: define domain of program properties computed by dataflow analysis (flow value) (the set of elements plus the order of these elements) Define flow functions (transfer functions: how each node affects the flow value) and merge functions over this domain using standard lattice operations

Lattice

Lattice

From Lattice to Dataflow Problems

From Lattice to Dataflow Problems

Transfer Functions

Transfer Functions Give a flow function, more conservative input leads to more conservative output IDFA is guaranteed to terminate if the flow function is monotonic and the lattice has a finite height

Flow Functions

WorkList Algorithm

Correctness

Termination

Evelyn Duesterwald, Rajiv Gupta, and Mary Lou Soffa. A practical framework for demand-driven interprocedural data flow analysis. ACM Transactions on Programming Languages and Systems, 19:992 1030, 1998. John B. Kam and Jeffrey D. Ullman. Global data flow analysis and iterative algorithms. J. ACM, 23(1):158 171, January 1976. Gary A. Kildall. A unified approach to global program optimization. In Proceedings of the 1st Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, POPL 73, pages 194 206, New York, NY, USA, 1973. ACM.