factor/unfinished/compiler/cfg/cfg.factor

28 lines
574 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
2008-09-10 23:11:03 -04:00
label
2008-07-20 05:24:37 -04:00
instructions
successors
2008-09-10 23:11:03 -04:00
predecessors ;
2008-07-20 05:24:37 -04:00
: <basic-block> ( -- basic-block )
basic-block new
V{ } clone >>instructions
V{ } clone >>successors
V{ } clone >>predecessors ;
2008-09-11 03:05:22 -04:00
TUPLE: mr instructions word label ;
2008-07-20 05:24:37 -04:00
2008-09-11 03:05:22 -04:00
C: <mr> mr