Single-entry single-exit
Single-Entry Single-Exit regions are a fundamental concept in structured programming and control-flow analysis. A SESE region is a portion of a program with exactly one entry point and one exit point, enabling modular reasoning, formal verification, and compiler optimization. Although the term SESE was popularized in the late 1980s, the underlying ideas date back to the origins of structured programming and the development of flow-graph theory in the 1970s.
Concept and Definition
In a control-flow graph, a SESE region is typically defined as a subgraph with:- One entry edge that dominates all nodes in the region;
- One exit edge that post-dominates all nodes in the region;
- No other edges entering or leaving the subgraph.
- The first condition ensures that every path from the start of the CFG into the region passes through the region’s designated entry edge.
- The second condition ensures that every path from within the region to the end of the CFG passes through the region’s designated exit edge.
- The first two conditions are necessary but not sufficient to characterize SESE regions: dominance and postdominance alone do not prohibit edges that enter or leave the region without passing through the designated entry or exit.
- The third condition enforces boundary integrity: no edge may enter the region except through the designated entry edge, and no edge may leave the region except through the designated exit edge. This excludes side entrances, side exits, and backedges that would otherwise satisfy dominance and post-dominance.
Origins in Structured Programming (1960s)
The conceptual roots of SESE lie in structured programming, developed in the 1960s to address the complexity caused by unrestricted jumps. In 1964, Böhm defined a primitive programming language P′′ that was explicitly based on the SESE property:Böhm and showed that any program can be written using sequence, selection, and iteration. Dijkstra argued that programs must have clear control structure to be understandable and provably correct. Hoare, defining a logic for program correctness, assumed well-defined entry and exit points.
All structured control constructs introduced in this period naturally obey the single-entry single-exit discipline.
Formalization in Flow-Graph Theory (1970s)
Early work on control-flow analysis laid the foundation for the flow-graph representations used in SESE regions. The control-flow graph was first introduced in the context of compiler optimization by Frances E. Allen, who formalized CFGs as representations of basic blocks and control flow, providing a basis for dominance analysis and other structural techniques used in SESE identification.Kosaraju used these CFG representations to give SESE regions their formal graph-theoretic characterization. He defined single-entry single-exit regions within control-flow graphs and showed how structured programs can be decomposed into hierarchically nested SESE regions corresponding to standard control constructs such as conditionals and loops. This work demonstrated that SESE structure is not merely a stylistic guideline but a property that enables systematic program decomposition and facilitates formal program analysis and reasoning.
In the early to mid-1970s, Aho, Hopcroft, and Ullman extended these ideas, developing formal frameworks for
- CFGs
- Dominator theory
- Intervals and reducible regions
SESE as an Explicit Analytical Unit (1980s)
The term Single-Entry Single-Exit was explicitly named and popularized by Ferrante, Ottenstein, and Warren.Their contributions include:
- A precise SESE definition using domination and post-domination
- Systematic decomposition of programs into SESE regions
- Use of SESE regions as the structural basis for program dependence graphs
Applications
SESE regions are central to:- Program slicing
- Code refactoring
- Compiler optimization
- Parallelization and dependence analysis
- Formal verification