Control Flow Graph IR


The compiler.cfg vocab and subvocabs implements the part of the optimizing compiler that analyzes code in the CFG format. The vocab compiler.cfg.builder defines words for building the CFG from SSA IR and the rest of the vocabs in the hierarchy optimization steps that are then applied to it. The graph is then passed to the compiler.codegen vocab which emits machine code.

The main datatype in the vocab is the cfg tuple. It represents the CFG of a Factor word. The cfg tuple has a slot 'entry' pointing to a basic-block. This block in turn points to other basic blocks, and together they form the call flow graph of the word.