Compilers
In a control-flow graph, what do the nodes and edges represent?
- ANodes are variables, and edges are the order in which values were assigned
- BNodes are basic blocks, and edges are branches or transitions between blocks
- CNodes are functions, and edges are include relationships between files
Show answer and explanation
Answer: B. Nodes are basic blocks, and edges are branches or transitions between blocks
A control-flow graph has basic blocks as nodes and, as edges, the possible transitions from one block to the next: both targets of a conditional branch, or falling through to the following block. Back edges reveal loops, and the graph supports analyses of where variable values flow. Calls between functions are shown in a separate call graph, and file include relationships are unrelated.
- A. It is not a graph of variables and assignment order.
- B. Correct. It shows basic blocks and the transitions between them.
- C. Function calls are represented in a separate call graph.