paperbot · PL 论文追踪

全部论文 待读 收藏

P2 The Bounded Pathwidth of Control-Flow Graphs

控制流图的有界路径宽度
OOPSLA 7(OOPSLA2)2023匹配度 3/10 · 论文属于传统程序分析与编译优化,研究控制流图路径宽度及其在寄存器分配中的应用,虽兼具理论形式化与工程实现且涉及静态分析,但未涉及用户核心关注的 PL×AI/LLM、浮点程序分析或贝叶斯程序分析,因此匹配度较低。引用 9 inbox
Giovanna Kobus Conrado, Amir Kafshdar Goharshady, Chun Kit Lam
crossref: 2026-09-10

AI 速览

一句话:证明结构化程序控制流图具有有界路径宽度,并给出线性时间路径分解及更快的寄存器分配算法。

已有工作已知无 goto 结构化程序的控制流图具有树状结构和有界树宽,并用于加速寄存器分配、模型检测与数据流分析。但文献缺少程序控制流图路径宽度的界,仅有路径宽度不超过 O(log n) 倍树宽的一般不等式。本文证明结构化程序的控制流图具有有界路径宽度,给出线性时间算法构造小宽度路径分解,具体为嵌套深度 d 时路径宽度至多 2d;真实程序嵌套深度小,故路径宽度有界。作者指出路径宽度比树宽更强,树宽算法可直接沿用,基于路径宽度的动态规划更简单、验证更快。应用方面,给出更简洁高效的免溢出寄存器分配算法,并在 SDCC 嵌入式基准上取得 2–3 个数量级加速。

问题
结构化程序控制流图的树宽有界已被广泛利用,但其路径宽度是否有界在文献中未知;仅有路径宽度至多 O(log n) 倍树宽的一般界,不足以支持更优算法。
方法
证明嵌套深度为 d 的结构化程序控制流图路径宽度至多 2d,并设计线性时间算法构造对应小宽度路径分解;进一步以路径宽度替代树宽重新设计免溢出寄存器分配算法。
评估
通过理论复杂度分析显示寄存器分配算法获得指数级加速,并在 SDCC 的真实嵌入式基准上实验,报告 2–3 个数量级运行时间提升。
原文摘要(Abstract)

Pathwidth and treewidth are standard and well-studied graph sparsity parameters which intuitively model the degree to which a given graph resembles a path or a tree, respectively. It is well-known that the control-flow graphs of structured goto-free programs have a tree-like shape and bounded treewidth. This fact has been exploited to design considerably more efficient algorithms for a wide variety of static analysis and compiler optimization problems, such as register allocation, µ-calculus model-checking and parity games, data-flow analysis, cache management, and liftetime-optimal redundancy elimination. However, there is no bound in the literature for thepathwidthof programs, except the general inequality that the pathwidth of a graph is at mostO(lgn) times its treewidth, wherenis the number of vertices of the graph.In this work, we prove that control-flow graphs of structured programs have bounded pathwidth and provide a linear-time algorithm to obtain a path decomposition of small width. Specifically, we establish a bound of 2 ·don the pathwidth of programs with nesting depthd. Since real-world programs have small nesting depth, they also have bounded pathwidth. This is significant for a number of reasons: (i) ‍pathwidth is a strictly stronger parameter than treewidth, i.e. ‍any graph family with bounded pathwidth has bounded treewidth, but the converse does not hold; (ii) ‍any algorithm that is designed with treewidth in mind can be applied to bounded-pathwidth graphs with no change; (iii) ‍there are problems that are fixed-parameter tractable with respect to pathwidth but not treewidth; (iv) ‍verification algorithms that are designed based on treewidth would become significantly faster when using pathwidth as the parameter; and (v) ‍it is easier to design algorithms based on bounded pathwidth since one does not have to consider the often-challenging case of merge nodes in treewidth-based dynamic programming. Thus, we invite the static analysis and compiler optimization communities to adopt pathwidth as their parameter of choice instead of, or in addition to, treewidth. Intuitively, control-flow graphs are not only tree-like, but also path-like and one can obtain simpler and more scalable algorithms by relying on path-likeness instead of tree-likeness.As a motivating example, we provide a simpler and more efficient algorithm for spill-free register allocation using bounded pathwidth instead of treewidth. Our algorithm reduces the runtime fromO(n·r2 ·tw·r+ 2 ·r) toO(n·pw·rpw·r+r+ 1), wherenis the number of lines of code,ris the number of registers,pwis the pathwidth of the control-flow graph andtwis its treewidth. We provide extensive experimental results showing that our approach is applicable to a wide variety of real-world embedded benchmarks from SDCC and obtains runtime improvements of 2-3 orders of magnitude. This is because the pathwidth is equal to the treewidth, or one more, in the overwhelming majority of real-world CFGs and thus our algorithm provides an exponential runtime improvement. As such, the benefits of using pathwidth are not limited to the theoretical side and simplicity in algorithm design, but are also apparent in practice.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1860,
  title = {The Bounded Pathwidth of Control-Flow Graphs},
  author = {Giovanna Kobus Conrado and Amir Kafshdar Goharshady and Chun Kit Lam},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {OOPSLA2},
  year = {2023},
  doi = {10.1145/3622807}
}