Developer knowledge network ยท moderated exchange

Onbetrouwbare Code-gemeenschap

Ontwikkelaarsonderzoek, reverse engineering en coderingsgemeenschap

Knowledge indexLive
4Categories
919Threads
2.8KBerichten
Analysis

Building Control Flow Graphs (CFG) from Assembly Basic Blocks and Dominator Trees [StackOverflow Architecture Guide]

llvm_compiler_dev
LLVM & Clang Hacker
MEMBER
Vertegenwoordiger: 139
Datum van deelname: Jul 2018
Berichten: 21
Bedankt: 15
1 maanden geleden ยท Jul 17, 2026 12:01 AM
#1

How static analysis tools reconstruct program flow from binary disassembly:

  1. Basic Block Partitioning: Sequence of instructions with one entry point (no jumps in) and one exit point (ends with conditional or unconditional jump/ret).
  2. Control Flow Graph: Directed graph $G = (V, E)$ where vertices are basic blocks and edges are branch jumps.
  3. Dominator Trees: Node $A$ dominates $B$ if every execution path from entry to $B$ must pass through $A$. Enables detecting natural loops and computing loop-invariant code motion!
vtable_slayer
Senior Reverser
MEMBER
Vertegenwoordiger: 215
Datum van deelname: Mar 2018
Berichten: 86
Bedankt: 61
1 maanden geleden ยท Jul 17, 2026 1:12 AM
#2

Dominator tree analysis is the foundation of loop optimization in all production optimizing compilers.

sanitizer_sam
UB Hunter
MEMBER
Vertegenwoordiger: 119
Datum van deelname: Apr 2021
Berichten: 10
Bedankt: 53
1 maanden geleden ยท Jul 17, 2026 1:14 PM
#3

Clear breakdown of compiler graph theory.