When I reading the llvm document, especially the BasicBlock
part, the concept “successor” appears a lot, so what is it?
Both terms, basic block
and successor
, are coming from the field of Control Flow Analysis (or CFA).
In CFA, a program is represented using Control Flow Graph (or CFG).
Each vertex (or node) in a CFG is a basic block. Since CFG is a directed graph, a basic block may have incoming and outcoming edges. E.g.: A -> B -> C. Incoming edges are coming from predecessors, and the outcoming edges are leading to successors.
The set of successors/predecessors for the mentioned example (A -> B -> C
):
pred(A) = {}
succ(A) = {B}
pred(B) = {A}
succ(B) = {C}
pred(C) = {B}
succ(C) = {}