Data-Flow Analysis

February 22, 2018 | Author: Anonymous | Category: Engineering & Technology, Computer Science
Share Embed Donate


Short Description

Download Data-Flow Analysis...

Description

Data-Flow Analysis (Chapter 8) Furman Michael

Outline • What is Data-Flow Analysis? • An example: Reaching Definitions • Basic Concepts: Lattices, Flow-Functions, and Fixed Points • Taxonomy of Data-Flow Problems and Solutions • Iterative Data-Flow Analysis

Data-Flow Analysis • Input: A control flow graph • Output: A control flow graph with “global” information at every basic block Examples – Constant expressions: x+y*z – Live variables The purpose of data- flow analysis is to provide global information about how a procedure manipulates its data. For example, constant – propogation analysis seeks to determine, whether all assignment to a practical variable that may provide the value of that variable at some particular point necessary give it the same constant value. If it so, a use of the variable at that point can be replaced by constant. Data flow analysis should, as any optimization, always attempt to get the greatest possible benefit from the analyses and code-improvement transformations without ever transforming correct code to incorrect code.

Compiler structure String of

characters Scaner Scanner

tokens Tokens Symbol Table And Access Routines

Parser Parser

AST AST Semantic Semantic analyzer Analizer

IR IR Code Generator

Object code

Object code structure Fig 1. Compiler structure

Os Interface

Optimizing compiler structure String of characters

String of characters Front - End IR Control Flow analysis CFG Data Flow Analysis CFG + information Program Transformation IR Instruction selection

Object Code Fig 2. Optimizing compiler structure

An Example Reaching Definitions • A definition --- an assignment to variable • An assignment d reaches a basic block if there exists an execution path to the basic block in which the value assigned at d is still active at the basic block

Running Example unsigned int fib(unsigned int m) {unsigned int f0=0, f1=1, f2, i; if (m
View more...

Comments

Copyright � 2017 NANOPDF Inc.
SUPPORT NANOPDF