Dominance is a fundamental concept in compilers based on static single assignment (SSA) form. It underpins a wide range of analyses and transformations and defines a core property of SSA: every use must be dominated by its definition. We argue that this reliance on dominance has become increasingly problematic -- both in terms of precision and applicability to modern higher-order languages. First, control flow overapproximates data flow, which makes dominance-based analyses inherently imprecise. Second, dominance is well-defined only for first-order control-flow graphs (CFGs). More critically, higher-order programs violate the assumptions underlying SSA and classic CFGs: without an explicit CFG, the very notion that all uses of a variable must be dominated by its definition loses meaning. We propose an alternative foundation based on free variables. In this view, $φ$-functions and function parameters directly express data dependencies, enabling analyses traditionally built on dominance while improving precision and naturally extending to higher-order programs. We further present an efficient technique for maintaining free-variable sets in a mutable intermediate representation (IR). For analyses requiring additional structure, we introduce the nesting tree -- a relaxed analogue of the dominator tree constructed from variable dependencies rather than control flow. Our benchmarks demonstrate that the algorithms and data structures presented in this paper scale log-linearly with program size in practice.
翻译:支配关系是基于静态单赋值(SSA)形式的编译器中的核心概念。它支撑着广泛的分析与变换,并定义了SSA的核心属性:每个变量的使用必须被其定义所支配。我们认为,这种对支配关系的依赖在精度和对现代高阶语言的适用性方面日益暴露出问题。首先,控制流对数据流的过度近似导致基于支配关系的分析存在固有精度损失。其次,支配关系仅在一阶控制流图(CFG)中有明确语义。更关键的是,高阶程序违背了SSA与传统CFG的基本假设:当显式CFG缺失时,"所有变量使用都必须被其定义支配"这一概念本身便失去意义。我们提出基于自由变量的替代基础。在此框架下,φ函数和函数参数直接表达数据依赖关系,既支持传统依赖支配关系的分析,又提升精度且自然扩展至高阶程序。我们进一步提出一种在可变中间表示(IR)中高效维护自由变量集的技术。对于需要额外结构的分析,我们引入嵌套树——这一基于变量依赖关系而非控制流构建的支配树松散等价物。基准测试表明,本文提出的算法与数据结构在实践中可实现程序规模的对数线性扩展。