梦见小孩子是什么意思| 六味地黄丸主治什么| 什么东西补血效果最好| 阔腿裤配什么鞋子好看| 银手镯为什么会变黑| 氯雷他定什么时候吃| 什么体质不易怀孕| 榴莲有什么营养价值| 毳毛是什么| 皮肌炎是什么症状| 特别的意思是什么| 天天喝可乐有什么危害| 抹茶是什么做的| 球菌阳性是什么意思| 什么叫射频消融| 做爱是什么感觉| 喝酒后手麻是什么原因| 总是低烧是什么原因造成的| 喝牛奶不能和什么一起吃| uva是什么意思| 指教是什么意思| 数字17代表什么意思| 为什么怀孕会孕酮低| 璋字五行属什么| 什么中药可以降糖| 夏天吃什么菜| 黑色搭配什么颜色好看| 部长是什么职位| 丙烯颜料用什么洗掉| 用黄瓜敷脸有什么功效| 黄疸严重会造成什么后果| 双性人是什么意思| 心脏杂音是什么意思| 胡塞武装是什么| 妃是什么意思| 主动脉瓣退行性变是什么意思| 什么叫筋膜炎| 奶粉二段和三段有什么区别| 中老年补钙吃什么钙片好| 腹部胀气是什么原因| 脸热发红是什么原因| 什么是脱肛| 马失前蹄下一句是什么| 舌裂是什么原因造成的| 蛇怕什么| 人生只剩归途什么意思| 宬字五行属什么| 吃什么可以让阴茎变硬| 浪琴手表属于什么档次| 狗为什么喜欢吃屎| 狗狗为什么喜欢舔人| 吃什么润肺| 牙龈和牙齿分离是什么原因| 农历六月十五是什么星座| 瘦脸针的危害有什么副作用| 越南人说什么语言| 云南白药植物长什么样| 男性尿道疼痛小便刺痛吃什么药| 劳力士手表什么档次| 阴囊潮湿是什么症状| 吃蒸苹果有什么好处| 下眼袋浮肿是什么原因| 出脚汗是什么原因| 消化内科是看什么病的| 皮包公司是什么意思| 沉的右边念什么| 童子尿能治什么病| 手指头发麻是什么原因引起的| 肝囊肿挂什么科| 急性呼吸道感染是什么引起的| 酵母提取物是什么| 腮腺炎是什么原因引起的| 番薯是什么时候传入中国的| 舌苔厚有齿痕吃什么药| 肋骨痛挂什么科| 紫砂壶泡什么茶最好| 宝宝肋骨外翻是什么原因| 尊字五行属什么| 回复1是什么意思| 乳腺彩超挂什么科| 胃有息肉的症状是什么| 断袖是什么意思| 经常感冒吃什么增强抵抗力| 共济会是什么组织| 农历十月初五是什么星座| 三里屯有什么好玩的地方| 净身高是什么意思| 祛痘用什么药膏| 细菌感染是什么原因引起的| iga是什么意思| 一切有为法是什么意思| 膝盖缝里面疼什么原因| 伤官配印是什么意思| nba下个赛季什么时候开始| 所见的意思是什么| zm是什么意思| 诺贝尔奖为什么没有数学奖| 细菌性阴道病用什么药| 为什么空腹喝牛奶会拉肚子| ber什么意思| 乙亥五行属什么| 补气血什么季节补最好| 十五的月亮十六圆是什么意思| 小寄居蟹吃什么| 10月26是什么星座| 乳腺发炎吃什么消炎药| 肩膀疼去医院挂什么科| 楚门的世界是什么意思| 消化内科是看什么病的| daddy是什么意思| 帝加口念什么| 属猴配什么属相最好| 点痣用什么方法最好| 浑水摸鱼是什么意思| 天天喝奶茶有什么危害| 安宫牛黄丸治什么病| 绩效工资是什么| 为什么会得肾结石| 慈字五行属什么| 国历是什么意思| rm是什么意思| 印第安人属于什么人种| 内心的os是什么意思| 什么是党的根本大法| 破冰是什么意思| 失代偿期是什么意思| 戒指丢了暗示着什么| 36是什么码| 扬州瘦马什么意思| 颈椎痛吃什么药| 牙齿疼是什么原因| 南京有什么好玩的地方| 护士节送什么花| 嫩绿的什么| 为什么手脚老是出汗| 脱发是什么原因| 背部长痘痘是什么原因造成| 鸭跖草用什么除草剂| 三点水加一个心读什么| 吃什么润肠通便| naco是什么牌子| 欧诗漫是个什么档次| 甲亢查什么| 什么是微创手术| 一个金字旁一个先读什么| 困是什么原因| 白毫银针属于什么茶| 胳膊疼挂什么科| 梦见梅花鹿是什么预兆| gold是什么牌子| 两会什么时候开| 红细胞计数偏低是什么意思| 煸是什么意思| 科举制什么时候废除| 避孕环是什么样子图片| 五味指的是什么| 美国白宫是干什么的| 脚面疼是什么原因引起的| 梅毒螺旋体抗体是什么意思| 控制血糖吃什么食物| 乳腺结节不能吃什么| 肠道门诊看什么病| 弥补是什么意思| 舌面有裂纹是什么原因| 慷慨解囊是什么意思| b型o型生出来的孩子什么血型| George是什么意思| 烈士家属有什么待遇| 锌过量会引发什么症状| 追龙什么意思| 勾心斗角是什么生肖| 容易淤青的体质叫什么| 欣字属于五行属什么| 风寒感冒吃什么药效果好| 肾造瘘是什么意思| 腹泻能吃什么食物| 夏天喝什么粥| 至死不渝是什么意思| 什么是指标到校| 胰腺炎可以吃什么| 什么叫专业| 安康鱼是什么鱼| 胆囊炎吃什么食物好| 心脾两虚吃什么食物补最快| 一什么猪| 日本为什么侵华| 魔芋是什么植物| 随诊复查是什么意思| 肩周炎是什么原因造成的| 吉士是什么| 生日送什么礼物最好| 活在当下是什么意思| 梦见好多衣服是什么意思| 埋线是什么| 男人左手断掌是什么命| chase是什么意思| 踮脚走路有什么好处| 右位是什么意思| michaelkors是什么牌子| 阑尾炎在什么位置| 米虫长什么样| 孕妇什么时候吃dha效果比较好| vogue什么意思| 世界上最高的塔是什么塔| 爱放屁什么原因| 卡他症状是什么意思| 梦见坐飞机是什么预兆| 姚字五行属什么| 慢慢地什么填词语| 为什么吃西瓜会拉肚子| 脸肿是什么原因引起的| 什么的蚜虫| 妇科假丝酵母菌是什么病| 喆读什么| 槟榔是什么东西| 湿毒是什么原因引起的| rt表示什么意思| 吃什么食物能升白细胞| 表面是什么意思| 轻度肠化是什么意思| 手足口是什么病毒| 瘙痒是什么意思| 拔智齿第二天可以吃什么| 子宫内膜薄是什么原因| 肾气不固吃什么中成药| 例假发黑是什么原因| 装垃圾的工具叫什么| 陈皮和橘子皮有什么区别| 流产吃什么药可以堕胎| 孩子鼻子流鼻血是什么原因| 推崇是什么意思| rpr是什么检查项目| 总是流鼻血是什么原因| 抽血前喝水有什么影响| 为什么清真不吃猪肉| 什么是牙槽骨突出图片| 圣罗兰属于什么档次| 波涛澎湃是什么意思| gypsophila什么意思| 山东为什么简称鲁| 秋天的落叶像什么| 累觉不爱是什么意思| 声音有磁性是什么意思| 下体瘙痒用什么药| 2021年属什么生肖| 溶栓治疗是什么意思| 阴历六月十八是什么日子| 突然晕厥是什么原因| 无花果和什么不能一起吃| 怀孕6个月吃什么好| 阴道有腥臭味用什么药| 眼袋肿是什么原因| 两个叉念什么| 上海有什么好玩的地方| 伸筋草主治什么病| 冷敷眼睛有什么好处| 早晨六点是什么时辰| 乙肝两对半15阳性是什么意思| 舌头有齿痕吃什么药| 什么是萎缩性胃炎| 大学生入伍有什么好处| 胃溃疡吃什么药好得快| 陈皮和橘子皮有什么区别| 7月22日什么星座| 百度

《古惑狼三部曲》绿色度测评报告

百度 为何宝骏的舒适性会被比下去呢?那是因为出现了这辆车A800。

In computer science, a control-flow graph (CFG) is a representation, using graph notation, of all paths that might be traversed through a program during its execution. The control-flow graph was conceived by Frances E. Allen,[1] who noted that Reese T. Prosser used boolean connectivity matrices for flow analysis before.[2]

Some CFG examples:
(a) an if-then-else
(b) a while loop
(c) a natural loop with two exits, e.g. while with an if...break in the middle; non-structured but reducible
(d) an irreducible CFG: a loop with two entry points, e.g. goto into a while or for loop
A control-flow graph used by the Rust compiler to perform codegen.

The CFG is essential to many compiler optimizations and static-analysis tools.

Definition

edit

In a control-flow graph each node in the graph represents a basic block, i.e. a straight-line sequence of code with a single entry point and a single exit point, where no branches or jumps occur within the block. Basic blocks start with jump targets and end with jumps or branch instructions. Directed edges are used to represent jumps in the control flow. There are, in most presentations, two specially designated blocks: the entry block, through which control enters into the flow graph, and the exit block, through which all control flow leaves.[3]

Because of its construction procedure, in a CFG, every edge A→B has the property that:

outdegree(A) > 1 or indegree(B) > 1 (or both).[4]

The CFG can thus be obtained, at least conceptually, by starting from the program's (full) flow graph—i.e. the graph in which every node represents an individual instruction—and performing an edge contraction for every edge that falsifies the predicate above, i.e. contracting every edge whose source has a single exit and whose destination has a single entry. This contraction-based algorithm is of no practical importance, except as a visualization aid for understanding the CFG construction, because the CFG can be more efficiently constructed directly from the program by scanning it for basic blocks.[4]

Example

edit

Consider the following fragment of code:

0: (A) t0 = read_num
1: (A) if t0 mod 2 == 0
2: (B)     print t0 + " is even."
3: (B)     goto 5
4: (C) print t0 + " is odd."
5: (D) end program

In the above, we have 4 basic blocks: A from 0 to 1, B from 2 to 3, C at 4 and D at 5. In particular, in this case, A is the "entry block", D the "exit block" and lines 4 and 5 are jump targets. A graph for this fragment has edges from A to B, A to C, B to D and C to D.

Reachability

edit

Reachability is a graph property useful in optimization.

If a subgraph is not connected from the subgraph containing the entry block, that subgraph is unreachable during any execution, and so is unreachable code; under normal conditions it can be safely removed.

If the exit block is unreachable from the entry block, an infinite loop may exist. Not all infinite loops are detectable, see Halting problem. A halting order may also exist there.

Unreachable code and infinite loops are possible even if the programmer does not explicitly code them: optimizations like constant propagation and constant folding followed by jump threading can collapse multiple basic blocks into one, cause edges to be removed from a CFG, etc., thus possibly disconnecting parts of the graph.

Domination relationship

edit

A block M dominates a block N if every path from the entry that reaches block N has to pass through block M. The entry block dominates all blocks.

In the reverse direction, block M postdominates block N if every path from N to the exit has to pass through block M. The exit block postdominates all blocks.

It is said that a block M immediately dominates block N if M dominates N, and there is no intervening block P such that M dominates P and P dominates N. In other words, M is the last dominator on all paths from entry to N. Each block has a unique immediate dominator.

Similarly, there is a notion of immediate postdominator, analogous to immediate dominator.

The dominator tree is an ancillary data structure depicting the dominator relationships. There is an arc from Block M to Block N if M is an immediate dominator of N. This graph is a tree, since each block has a unique immediate dominator. This tree is rooted at the entry block. The dominator tree can be calculated efficiently using Lengauer–Tarjan's algorithm.

A postdominator tree is analogous to the dominator tree. This tree is rooted at the exit block.

Special edges

edit

A back edge is an edge that points to a block that has already been met during a depth-first (DFS) traversal of the graph. Back edges are typical of loops.

A critical edge is an edge which is neither the only edge leaving its source block, nor the only edge entering its destination block. These edges must be split: a new block must be created in the middle of the edge, in order to insert computations on the edge without affecting any other edges.

An abnormal edge is an edge whose destination is unknown. Exception handling constructs can produce them. These edges tend to inhibit optimization.

An impossible edge (also known as a fake edge) is an edge which has been added to the graph solely to preserve the property that the exit block postdominates all blocks. It cannot ever be traversed.

Loop management

edit

A loop header (sometimes called the entry point of the loop) is a dominator that is the target of a loop-forming back edge. The loop header dominates all blocks in the loop body. A block may be a loop header for more than one loop. A loop may have multiple entry points, in which case it has no "loop header".

Suppose block M is a dominator with several incoming edges, some of them being back edges (so M is a loop header). It is advantageous to several optimization passes to break M up into two blocks Mpre and Mloop. The contents of M and back edges are moved to Mloop, the rest of the edges are moved to point into Mpre, and a new edge from Mpre to Mloop is inserted (so that Mpre is the immediate dominator of Mloop). In the beginning, Mpre would be empty, but passes like loop-invariant code motion could populate it. Mpre is called the loop pre-header, and Mloop would be the loop header.

Reducibility

edit

A reducible CFG is one with edges that can be partitioned into two disjoint sets: forward edges, and back edges, such that:[5]

Structured programming languages are often designed such that all CFGs they produce are reducible, and common structured programming statements such as IF, FOR, WHILE, BREAK, and CONTINUE produce reducible graphs. To produce irreducible graphs, statements, such as GOTO, are needed. Irreducible CFGs can be produced by some compiler optimizations, such as tail call elimination. Many loop optimizations require reducible CFGs. In order to convert a irreducible CFG into a reducible CFG, either nodes must be duplicated or variables must be introduced. GOTO statements can sometimes produce reducible control flow graphs.

Loop connectedness

edit

The loop connectedness of a CFG is defined with respect to a given depth-first search tree (DFST) of the CFG. This DFST should be rooted at the start node and cover every node of the CFG.

Edges in the CFG which run from a node to one of its DFST ancestors (including itself) are called back edges.

The loop connectedness is the largest number of back edges found in any cycle-free path of the CFG. In a reducible CFG, the loop connectedness is independent of the DFST chosen.[6][7]

Loop connectedness has been used to reason about the time complexity of data-flow analysis.[6]

Inter-procedural control-flow graph

edit

While control-flow graphs represent the control flow of a single procedure, inter-procedural control-flow graphs represent the control flow of whole programs.[8]

See also

edit

References

edit
  1. ^ Frances E. Allen (July 1970). "Control flow analysis". SIGPLAN Notices. 5 (7): 1–19. doi:10.1145/390013.808479.
  2. ^ Reese T. Prosser (1959). "Applications of Boolean matrices to the analysis of flow diagrams". Papers presented at the December 1–3, 1959, eastern joint IRE-AIEE-ACM computer conference. pp. 133–138. doi:10.1145/1460299.1460314.
  3. ^ Yousefi, Javad (2015). "Masking wrong-successor Control Flow Errors employing data redundancy". 2015 5th International Conference on Computer and Knowledge Engineering (ICCKE). IEEE. pp. 201–205. doi:10.1109/ICCKE.2015.7365827. ISBN 978-1-4673-9280-8.
  4. ^ a b Peri L. Tarr; Alexander L. Wolf (2011). Engineering of Software: The Continuing Contributions of Leon J. Osterweil. Springer Science & Business Media. p. 58. ISBN 978-3-642-19823-6.
  5. ^ "Archived copy" (PDF). Archived from the original (PDF) on 2025-08-05. Retrieved 2025-08-05.{{cite web}}: CS1 maint: archived copy as title (link)
  6. ^ a b Kam, John B.; Ullman, Jeffrey D. (2025-08-05). "Global Data Flow Analysis and Iterative Algorithms". Journal of the ACM. 23 (1): 158–171. doi:10.1145/321921.321938. ISSN 0004-5411. S2CID 162375.
  7. ^ Offner, Carl. "Notes on Graph Algorithms Used in Optimizing Compilers" (PDF). Archived (PDF) from the original on 2025-08-05. Retrieved 13 April 2018.
  8. ^ "Control Flow Analysis" (PDF). 2016. Archived (PDF) from the original on 2025-08-05.
edit
Examples
鼻炎看什么科 美国什么时候建国的 米诺地尔搽剂和米诺地尔酊有什么区别 光明会到底是干什么的 心悸是什么原因引起的
肠胃不好能吃什么水果 万寿菊什么时候开花 四平八稳是什么生肖 眼角痒用什么眼药水 老年痴呆症又叫什么
9点到11点是什么经络 阴道瘙痒用什么药 为什么会有牙结石 同房有点痛什么原因 红烧排骨用什么排骨比较好
右眼皮跳什么原因 伏是什么意思 铂金是什么颜色 忘乎所以是什么意思 72年属什么生肖属相
鲁迅是著名的什么家hcv8jop9ns8r.cn hpv有什么症状hcv8jop1ns1r.cn 牵牛花是什么颜色hcv8jop1ns1r.cn 乙肝表面抗体定量偏高什么意思mmeoe.com 丑五行属什么hcv9jop6ns8r.cn
后背酸疼是什么原因hcv8jop0ns3r.cn 居家是什么意思adwl56.com 今年三十岁属什么生肖hcv8jop6ns9r.cn 怀孕吐得厉害吃什么可以缓解hcv8jop0ns5r.cn 腰间盘膨出吃什么药效果好hcv9jop4ns2r.cn
什么的什么是什么的伞hcv9jop5ns5r.cn 月经推迟7天是什么原因hcv9jop4ns2r.cn 手脚爱出汗是什么原因clwhiglsz.com 什么的大自然hcv8jop1ns8r.cn 大条是什么意思hcv8jop7ns2r.cn
超脱是什么意思hcv8jop7ns0r.cn 口腔溃疡吃什么水果好得快hcv9jop1ns9r.cn 纣王叫什么名字hcv9jop4ns8r.cn 退职是什么意思hcv8jop7ns0r.cn 小恙是什么意思hcv7jop6ns5r.cn
百度