静态分析 第三课 Data Flow Analysis(1)

本文概述了数据流分析(DFA)的应用,包括达到定义分析、活变量分析和可用表达式分析。介绍了DFA的基本原理,如输入输出状态、转移函数约束和控制流约束。数据流分析旨在找到一组安全近似约束的解决方案,用于抽象程序状态。算法通过向前或向后分析,确定变量定义的可达性,以检测可能未定义的变量。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Data Flow Analysis – Applications

  1. Overview of DFA
  2. Preliminaries of DFA
  3. Reaching Definitions Analysis
  4. Live Variables Analysis
  5. Available Expressions Analysis

Overview

How Data Flows on CFG?
How application-specific Data <- Abstraction
Flows through the <- Over-approximation(for most static analyses(may analysis))
Nodes(BBs/statements) and <- Transfer function
Edges(control flows) of <- Control-flow handling
CFG(a program)

may analysis:
outputs information that may be true(over approximation)

must analysis:
outputs information that must be true(under-approximation)

Both over- and under-approximations are for safety of analysis

Preliminaries of Data FLow Analysis

Input and Output States

Each execution of an IR statement transforms an input state to a new output state
The input(output) satate is associated with the program point before(after) the statement

在这里插入图片描述


In each data-flow analysis application, we associate with every program point a data-flow value that represents an abstraction of the set of all possible program states that can be observed for that point.

The set of possible data-flow values is the domain for this application

Data-flow analysis is to find a solution to a set of safe-approximation-directed constraints on the IN(s)'s and OUT(s)'s, for all statements
(transfer function or flows of control)

Notations for Transfer Function’s Constraints and Control Flow Constraints

  • Transfer Analysis
    Forward Analysis: OUT(s) = f(IN(s))
    Backward Analysis: IN(s) = f(OUT(s))

+Control flow within BB or among BBs
I N [ s i + 1 ] = O U T [ s i ] IN[s_{i+1}]=OUT[s_i] IN[si+1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值