Extending hammocks for parallelism detection ∗

Introduction and basic definitions Finding the independent parts of a Control Flow Graph (CFG) is important for exposing program parallelism. Two types of instruction dependences constrain the order of execution, dataand control-dependences (CD). Abstracting from data-dependences, it is useful to study the idealized parallelism allowed by program control structure. CD’s are assumed as the dependence relation of the trace (i.e., partially commutative) language defined by the DFA naturally associated to the CFG. Two CFG’s are control(C)-equivalent if they have identical CD’s and define the same trace language. The family of such C-equivalent CFG’s is a model for programs obtained from each other by commuting C-independent instructions. Since single instructions are a too fine-grained unit for efficient parallelization on modern computer architectures, we characterize larger program parts, called Movable Control Components (MCC) that can be executed in different order preserving C-equivalence. MCC is a new notion derived from the established concept of single-entry single-successor subgraph, also known as a hammock, by imposing that no cycle can span across different MCC’s. A recursive decomposition of a program into sets of mutually independent MCC’s is introduced. It is proven that all and only the C-equivalent CFG’s are obtained by local transformations that commute two successive MCC’s that are part of a linear sequence of such components. This study provides part of the theoretical base needed for on-going work on automatic program parallelization. We need to define some standard concepts from program and compiler theory. In a Control Flow Graph (CFG) [5] a node v predominates (resp. postdominates) node w, written v a w (resp. v ` w), if every path from START to w contains v (resp., if every path from w to END contains v). Both relations are tree-orders. The immediate postdominator ipostdom(S) of a set of nodes S is the least node i, in the ` order, such that i ∈ ⋂ n∈S postdom(n), the latter function denoting the set of postdominators of n. An edge n→ h is a back-edge if h a n. It is customary to assume that a node has at most two successors; nodes with two successors are conditional instructions. For a node h of a graph we consider the subgraph, denoted by SCC(h), which is the minimal Strongly Connected Component (SCC) containing h (excluding SCC(h) = {h} unless it is the only SCC of h); for a SCC S, the exit set, exit(S), includes the nodes in S having at least one successor out of S. The following definitions of Binary and Ternary Control Dependence relations (BCD, TCD) from [2] are equivalent to the standard ones [1, 4]. A node y is BCD-dependent on a node x iff x is a conditional instruction and is the only predecessor of u and v; there exists a path x, u, . , END that does not contain y; every path x, v, . , END contains y. y is TCD-dependent on x via v if y is BCD-dependent on x, v ∈ succ(x), and v predominates y. We name C-dependence any one of BCD and TCD. A hammock [4] H is a subgraph (VH , EH) of G with a distinguished node h in VH called entry node and a distinguished node s in V \ VH called successor such that all edges from (V \ VH) to VH ∗Partially supported by MIUR 2007TJNZRE 002 †Politecnico di Milano ‡Harvard University