Notes on Control Flow Graph

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.


  1. 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.

This entry was posted in Programming Language. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s