Skip to content

Commit fa037e2

Browse files
committed
add dfg
1 parent 0a303c4 commit fa037e2

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

_posts/2025-03-10-Control-Flow-Graph.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ math: true
77
---
88

99

10-
# Control Flow Graph (CFG) - Program Analysis
10+
# Control Flow Graph (CFG)
1111

1212
## Overview
1313
A **Control Flow Graph (CFG)** 是程序计算和控制流的图表示。用于建模程序的执行路径,是静态分析的核心。
@@ -55,4 +55,24 @@ clang -fdump-tree-cfg my_program.cpp
5555
### 工具2 clang Static Analyzer
5656
```bash
5757
clang --analyze my_program.cpp
58-
```
58+
```
59+
60+
# 数据流图(data flow graph, DFG)
61+
62+
图数据流图(DFG,Data Flow Graph)是一种图形化表示,用于描述程序中数据之间的流动和依赖关系。每个节点通常表示一个操作或计算,每条边表示数据的流动和依赖。
63+
```cpp
64+
quad( a, b, c)
65+
t1 = a*c;
66+
t2 = 4*t1;
67+
t3 = b*b;
68+
t4 = t3 - t2;
69+
t5 = sqrt( t4);
70+
t6 = -b;
71+
t7 = t6 - t5;
72+
t8 = t7 + t5;
73+
t9 = 2*a;
74+
r1 = t7/t9;
75+
r2 = t8/t9;
76+
```
77+
78+
![dfg](../assets/LLM/dfg.gif "dfg")

assets/LLM/dfg.gif

3.09 KB
Loading

0 commit comments

Comments
 (0)