【浅析】程序分析中的数据流图(data flow graph)和控制流图(control flow graph)

前言

创作开始时间:2021年4月9日09:17:11

如题。看了一些网页文献,大概对这两种流图有了一定的理解,这里简单地记录一下,尤其是一些例子,感觉比较直观。

1、data flow graphs

参考:

A data-flow graph (DFG) is a graph which represents a data dependancies between a number of operations. Any algorithm consists of a number of ordered operations. Since examples are always better than words, consider the procedure for finding the root of a quadratic equation (algorithm assumes real roots).

一块代码:

quad( a, b, c)
t1 = a*c;
t2 = 4*t1;
t3 = b*b;
t4 = t3 - t2;
t5 = sqrt( t4);
t6 = -b;
t7 = t6 - t5;
t8 = t7 + t5;
t9 = 2*a;
r1 = t7/t9;
r2 = t8/t9;

对应的数据流图是:
在这里插入图片描述

(时间紧急,就不在这里自己画了)

另可参考:

2、Control Flow Graph

参考:

控制流图(Control Flow Graph, CFG)也叫控制流程图,是一个过程或程序的抽象表现,是用在编译器中的一个抽象数据结构,由编译器在内部维护,代表了一个程序执行过程中会遍历到的所有路径。它用图的形式表示一个过程内所有基本块执行的可能流向, 也能反映一个过程的实时执行过程。

  • 参考百科。讲的还可以。

小结

以上。以后有机会再完善一下。基本上看这几个网页就可以理解了。

创作结束时间:2021年4月9日09:23:39

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值