Finding Natural Loops Algorithm 9.46:Constructing the natural loop of a back edge. INPUT:A flow graph G and a back edge n>d. OUTPUT:The set loop consisting of all nodes in the natural loop of n-d. METHOD:Let loop be {n,d).Mark d as "visited,"so that the search does not reach beyond d.Perform a depth-first search on the reverse control-flow graph starting with node n.Insert all the nodes visited in this search into loop.This procedure finds all the nodes that reach n without going through d. CS308 Compiler Theory 12Finding Natural Loops CS308 Compiler Theory 12