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的核心属性:每个使用点必须被其定义点所支配。我们认为,这种对支配关系的依赖在精确性及对现代高阶语言的适用性方面已日益成为问题。首先,控制流过度近似了数据流,这使得基于支配关系的分析天生不精确。其次,支配关系仅在一阶控制流图上有良好定义。更关键的是,高阶程序违背了SSA和经典控制流图的基本假设:在没有显式控制流图的情况下,变量所有使用点均需被其定义点支配这一概念本身失去了意义。我们提出了一种基于自由变量的替代基础。在此观点下,φ函数和函数参数直接表达数据依赖关系,使得传统上建立在支配关系之上的分析得以实现,同时提高了精确度并自然扩展至高阶程序。我们进一步提出了一种高效的技术,用于在可变中间表示中维护自由变量集。对于需要额外结构的分析,我们引入了嵌套树——一种从变量依赖关系而非控制流构建的支配者树的宽松类比。基准测试表明,本文提出的算法和数据结构在实际应用中随程序规模呈对数线性扩展。