2008-07-20 05:24:37 -04:00
|
|
|
! Copyright (C) 2008 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2008-10-19 02:10:21 -04:00
|
|
|
USING: kernel arrays accessors namespaces assocs sequences sets fry ;
|
2008-07-20 05:24:37 -04:00
|
|
|
IN: compiler.cfg
|
|
|
|
|
2008-09-11 03:05:22 -04:00
|
|
|
TUPLE: cfg entry word label ;
|
2008-09-10 23:11:03 -04:00
|
|
|
|
2008-09-11 03:05:22 -04:00
|
|
|
C: <cfg> cfg
|
2008-09-10 23:11:03 -04:00
|
|
|
|
2008-07-20 05:24:37 -04:00
|
|
|
TUPLE: basic-block < identity-tuple
|
2008-10-22 19:38:30 -04:00
|
|
|
id
|
2008-07-20 05:24:37 -04:00
|
|
|
number
|
|
|
|
instructions
|
2008-10-22 19:38:30 -04:00
|
|
|
successors
|
|
|
|
gc ;
|
2008-07-20 05:24:37 -04:00
|
|
|
|
|
|
|
: <basic-block> ( -- basic-block )
|
|
|
|
basic-block new
|
|
|
|
V{ } clone >>instructions
|
2008-10-22 19:38:30 -04:00
|
|
|
V{ } clone >>successors
|
|
|
|
\ basic-block counter >>id ;
|
2008-07-20 05:24:37 -04:00
|
|
|
|
2008-10-19 02:10:21 -04:00
|
|
|
TUPLE: mr { instructions array } word label spill-counts ;
|
2008-07-20 05:24:37 -04:00
|
|
|
|
2008-09-17 20:31:35 -04:00
|
|
|
: <mr> ( instructions word label -- mr )
|
|
|
|
mr new
|
|
|
|
swap >>label
|
|
|
|
swap >>word
|
|
|
|
swap >>instructions ;
|