factor/basis/compiler/cfg/cfg.factor

29 lines
633 B
Factor
Raw Normal View History

2008-07-20 05:24:37 -04:00
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel accessors namespaces assocs sequences sets fry ;
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-09-11 03:05:22 -04:00
! - "number" and "visited" is used by linearization.
2008-07-20 05:24:37 -04:00
TUPLE: basic-block < identity-tuple
2008-09-11 03:05:22 -04:00
visited
2008-07-20 05:24:37 -04:00
number
instructions
2008-09-17 01:46:38 -04:00
successors ;
2008-07-20 05:24:37 -04:00
: <basic-block> ( -- basic-block )
basic-block new
V{ } clone >>instructions
2008-09-17 01:46:38 -04:00
V{ } clone >>successors ;
2008-07-20 05:24:37 -04:00
2008-10-07 17:13:29 -04:00
TUPLE: mr instructions word label ;
2008-07-20 05:24:37 -04:00
: <mr> ( instructions word label -- mr )
mr new
swap >>label
swap >>word
swap >>instructions ;