◄ WORLD V · SONNY 5DART 230 · a helldive at the net

THE BASIC BLOCK a straight run of code: one way in, one way out

Before a compiler can reason about your program it cuts it into basic blocks — maximal straight-line runs with a single entry and a single exit, no branch in the middle. A leader starts a block: the first instruction, any jump target, any instruction after a branch. Everything between two leaders is one block, and inside a block control cannot escape or enter partway. Every later analysis — liveness, reaching definitions, scheduling — is defined over these blocks, so getting the partition right is the foundation the whole optimizer stands on.

THE TECHNIQUE cut instructions at the leaders → maximal single-entry runs

Mark the leaders in a short instruction list (targets and post-branch points), then count the maximal straight-line blocks between them: live demo


HISTORY & CREDIT Frances E. Allen, 1970

“A program is a list of instructions.” — to an optimizer it is a graph of blocks. The list is what you typed; the blocks are what can actually be reasoned about, because inside one, order is total and control is captive. The block is the atom of every optimization that follows. cited

1970 · Frances E. Allen — “Control Flow Analysis”: formalizes the basic block and the flow graph as the substrate of global optimization — the work that later won her the Turing Award (2006), the first to a woman.
with · John Cocke — Allen & Cocke build the optimizing-compiler theory on blocks and intervals.
now · every compiler (GCC, LLVM, V8, i13) partitions into blocks first; the IR is a graph of them.

The block is where an optimizer stops seeing text and starts seeing structure. One entry, one exit — and suddenly you can prove things about what runs. Allen 1970

RECOMMEND FOR I-13 i13 already reports its blocks, computed

i13 already has this: its check ledger reports the program as regions — its own single-entry blocks. A short straight-line function is two regions (the function body and main):

$ i13 check bb.i13 VALID · 2 region(s) · peak stack 2 COVERED stack balance · control-structure pairing (per region) · call arity · function existence
Recommend: the basic block is already LIT in I-13 — its check reports 2 region(s), and a region IS i13's single-entry block, the unit its per-region control-structure pairing is proved over. The optimizer's foundational abstraction is one i13 chose for verification, not speed: the same partition that lets GCC schedule code lets i13 prove control is balanced. Nothing to add — name it.