The Bounded Pathwidth of Control-Flow Graphs

被引:1
|
作者
Conrado, Giovanna Kobus [1 ]
Goharshady, Amir Kafshdar [1 ]
Lam, Chun Kit [1 ]
机构
[1] Hong Kong Univ Sci & Technol, Dept Math, Dept Comp Sci & Engn, Clear Water Bay, Hong Kong, Peoples R China
来源
关键词
Control-flow Graphs; Parameterized Algorithms; Pathwidth; Treewidth; TREE-WIDTH; REGISTER ALLOCATION; TREEWIDTH; MINORS; ALGORITHMS; HARDNESS;
D O I
10.1145/3622807
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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, mu-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 the pathwidth of programs, except the general inequality that the pathwidth of a graph is at most O (lg n) times its treewidth, where n is 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 center dot d on the pathwidth of programs with nesting depth d. 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 from O (n center dot r(2 center dot tw center dot r+2 center dot r)) to O (n center dot pw center dot r(pw center dot A +r) (+1)), where n is the number of lines of code, A is the number of registers, pw is the pathwidth of the control-flow graph and tw is 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.
引用
收藏
页数:26
相关论文
共 50 条
  • [21] Control-Flow Carrying Code
    Lin, Yan
    Cheng, Xiaoyang
    Gao, Debin
    PROCEEDINGS OF THE 2019 ACM ASIA CONFERENCE ON COMPUTER AND COMMUNICATIONS SECURITY (ASIACCS '19), 2019, : 3 - 14
  • [22] Generating Functionally Equivalent Programs Having Non-isomorphic Control-Flow Graphs
    Geraud, Remi
    Koscina, Mirko
    Lenczner, Paul
    Naccache, David
    Saulpic, David
    SECURE IT SYSTEMS, NORDSEC 2017, 2017, 10674 : 265 - 279
  • [23] Partial Control-Flow Linearization
    Moll, Simon
    Hack, Sebastian
    PROCEEDINGS OF THE 39TH ACM SIGPLAN CONFERENCE ON PROGRAMMING LANGUAGE DESIGN AND IMPLEMENTATION, PLDI 2018, 2018, : 543 - 556
  • [24] A pointcut language for control-flow
    Douence, R
    Teboul, L
    GENERATIVE PROGRAMMING AND COMPONENT ENGINEERING 2004, PROCEEDINGS, 2004, 3286 : 95 - 114
  • [25] Demand Control-Flow Analysis
    Germane, Kimball
    McCarthy, Jay
    Adams, Michael D.
    Might, Matthew
    VERIFICATION, MODEL CHECKING, AND ABSTRACT INTERPRETATION, VMCAI 2019, 2019, 11388 : 226 - 246
  • [26] Partial Control-Flow Linearization
    Moll, Simon
    Hack, Sebastian
    ACM SIGPLAN NOTICES, 2018, 53 (04) : 560 - 573
  • [27] Opaque Control-Flow Integrity
    Mohan, Vishwath
    Larsen, Per
    Brunthaler, Stefan
    Hamlen, Kevin W.
    Franz, Michael
    22ND ANNUAL NETWORK AND DISTRIBUTED SYSTEM SECURITY SYMPOSIUM (NDSS 2015), 2015,
  • [28] Combined WCET Analysis of Bitcode and Machine Code using Control-Flow Relation Graphs
    Huber, Benedikt
    Prokesch, Daniel
    Puschner, Peter
    ACM SIGPLAN NOTICES, 2013, 48 (05) : 163 - 172
  • [29] A survey of control-flow obfuscations
    Majumdar, Anirban
    Thomborson, Clark
    Drape, Stephen
    INFORMATION SYSTEMS SECURITY, PROCEEDINGS, 2006, 4332 : 353 - +
  • [30] Modular Control-Flow Integrity
    Niu, Ben
    Tan, Gang
    ACM SIGPLAN NOTICES, 2014, 49 (06) : 577 - 587