1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs accessors arrays namespaces kernel math
4 sequences compiler.instructions compiler.instructions.syntax ;
7 ! Machine representation. Flat list of instructions, all
8 ! registers allocated, with labels and jumps.
15 : <label> ( -- label ) \ <label> counter ;
16 : define-label ( name -- ) <label> swap set ;
17 : resolve-label ( label/name -- ) dup integer? [ get ] unless _label ;
19 TUPLE: _cond-branch vreg label ;
22 INSN: _branch-f < _cond-branch ;
23 INSN: _branch-t < _cond-branch ;
24 INSN: _if-intrinsic label quot vregs ;
26 M: _cond-branch uses-vregs vreg>> 1array ;
27 M: _if-intrinsic uses-vregs vregs>> values ;