This is a post that first introduces the control flow graph, and then discusses the possibility of using control flow graph as an important feature of the program.
- Engineering a Compiler (2nd edition) Keith Cooper
Part I: Control-Flow Graph
The simplest unit of control flow in a program is a basic block. The basic block is made up of a sequence of branch free operations. A control-flow graph (CFG) is a directed graph, G = <N, E>. Each node n belongs to N corresponds to a basic block. Each edge e = (ni, nj) belongs to E corresponds to a possible transfer of control from block ni to nj.
Each CFG has a unique entry node, n0 and a unique exit node nf.