! Copyright (C) 2004, 2005 Slava Pestov. ! See http://factor.sf.net/license.txt for BSD license. IN: compiler-frontend USING: arrays compiler-backend errors generic inference kernel lists math namespaces prettyprint sequences strings words ; : in-1 0 0 %peek-d , ; : in-2 0 1 %peek-d , 1 0 %peek-d , ; : in-3 0 2 %peek-d , 1 1 %peek-d , 2 0 %peek-d , ; : out-1 T{ vreg f 0 } 0 %replace-d , ; GENERIC: linearize* ( node -- ) : linearize ( dataflow -- linear ) #! Transform dataflow IR into linear IR. This strips out #! stack flow information, and flattens conditionals into #! jumps and labels. [ %prologue , linearize* ] { } make ; : linearize-next node-successor linearize* ; M: f linearize* ( f -- ) drop ; M: node linearize* ( node -- ) linearize-next ; M: #label linearize* ( node -- ) #! We remap the IR node's label to a new label object here, #! to avoid problems with two IR #label nodes having the #! same label in different lexical scopes.