Table of Contents
Fetching ...

VEIL: Reading Control Flow Graphs Like Code

Philipp Schaad, Tal Ben-Nun, Torsten Hoefler

TL;DR

VEIL addresses the readability gap of large CFGs by introducing a dominator-analysis–based layered layout that enforces CFG-specific aesthetics. It formalizes the Happening-Before ordering and Edge Direction Grouping criteria and integrates them into a three-phase Sugiyama-style pipeline (layer assignment, crossing minimization, coordinate assignment). Through extensive evaluation on real CFGs (Polybench, CLOUDSC, Linux kernel), VEIL achieves perfect Happening-Before compliance, substantial reductions in graph area, and improved edge grouping and readability relative to Dagre and Graphviz dot, while maintaining competitive layout times. Overall, VEIL demonstrates how domain-aware layout algorithms can substantially enhance program understanding and debugging by visually encoding execution order and loop/branch structures.

Abstract

Control flow graphs (CFGs) are essential tools for understanding program behavior, yet the size of real-world CFGs makes them difficult to interpret. With thousands of nodes and edges, sophisticated graph drawing algorithms are required to present them on screens in ways that make them readable and understandable. However, being designed for general graphs, these algorithms frequently break the natural flow of execution, placing later instructions before earlier ones and obscuring critical program structures. In this paper, we introduce a set of criteria specifically tailored for CFG visualization, focusing on preserving execution order and making complex structures easier to follow. Building on these criteria, we present VEIL, a new layout algorithm that uses dominator analysis to produce clearer, more intuitive CFG layouts. Through a study of CFGs from real-world applications, we show how our method improves readability and provides improved layout performance compared to state of the art graph drawing techniques.

VEIL: Reading Control Flow Graphs Like Code

TL;DR

VEIL addresses the readability gap of large CFGs by introducing a dominator-analysis–based layered layout that enforces CFG-specific aesthetics. It formalizes the Happening-Before ordering and Edge Direction Grouping criteria and integrates them into a three-phase Sugiyama-style pipeline (layer assignment, crossing minimization, coordinate assignment). Through extensive evaluation on real CFGs (Polybench, CLOUDSC, Linux kernel), VEIL achieves perfect Happening-Before compliance, substantial reductions in graph area, and improved edge grouping and readability relative to Dagre and Graphviz dot, while maintaining competitive layout times. Overall, VEIL demonstrates how domain-aware layout algorithms can substantially enhance program understanding and debugging by visually encoding execution order and loop/branch structures.

Abstract

Control flow graphs (CFGs) are essential tools for understanding program behavior, yet the size of real-world CFGs makes them difficult to interpret. With thousands of nodes and edges, sophisticated graph drawing algorithms are required to present them on screens in ways that make them readable and understandable. However, being designed for general graphs, these algorithms frequently break the natural flow of execution, placing later instructions before earlier ones and obscuring critical program structures. In this paper, we introduce a set of criteria specifically tailored for CFG visualization, focusing on preserving execution order and making complex structures easier to follow. Building on these criteria, we present VEIL, a new layout algorithm that uses dominator analysis to produce clearer, more intuitive CFG layouts. Through a study of CFGs from real-world applications, we show how our method improves readability and provides improved layout performance compared to state of the art graph drawing techniques.

Paper Structure

This paper contains 21 sections, 6 equations, 7 figures, 1 algorithm.

Figures (7)

  • Figure 1: Excerpt of a CFG as visualized by Compiler Explorer godbolt, showing x86 assembly instructions in each basic block.
  • Figure 2: CFG of a conditionally executed 2-level loop nest drawn using different layouts to illustrate the effects of aesthetics criteria.
  • Figure 3: Examples of regular and inverted loops in CFGs together with their dominator and post-dominator trees.
  • Figure 4: Criteria metrics across all 30 Polybench applications. Arrows indicate whether higher ($\uparrow$) or lower ($\downarrow$) values are better.
  • Figure 5: Various loop nests found in CLOUDSC demonstrate how existing approaches (dot) fail to respect happens-before relationships and edge direction grouping, decreasing readability. VEIL drawings of the same loop nests offer improved readability.
  • ...and 2 more figures