factor/unfinished/compiler/machine/debugger/debugger.factor

46 lines
1.1 KiB
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: accessors kernel namespaces sequences assocs io
2008-08-11 03:49:37 -04:00
prettyprint inference generator optimizer
compiler.vops
compiler.tree.builder
compiler.tree.optimizer
compiler.cfg.builder
compiler.cfg.simplifier
compiler.machine.builder
compiler.machine.simplifier ;
IN: compiler.machine.debugger
2008-07-20 05:24:37 -04:00
2008-08-11 03:49:37 -04:00
: tree>linear ( tree word -- linear )
2008-07-20 05:24:37 -04:00
[
init-counter
build-cfg
[ simplify-cfg build-mr simplify-mr ] assoc-map
] with-scope ;
: linear. ( linear -- )
[
"==== " write swap .
[ . ] each
] assoc-each ;
: linearized-quot. ( quot -- )
2008-08-11 03:49:37 -04:00
build-tree optimize-tree
"Anonymous quotation" tree>linear
2008-07-20 05:24:37 -04:00
linear. ;
: linearized-word. ( word -- )
2008-08-11 03:49:37 -04:00
dup build-tree-from-word nip optimize-tree
dup word-dataflow nip optimize swap tree>linear linear. ;
2008-07-20 05:24:37 -04:00
: >basic-block ( quot -- basic-block )
2008-08-11 03:49:37 -04:00
build-tree optimize-tree
2008-07-20 05:24:37 -04:00
[
init-counter
"Anonymous quotation" build-cfg
>alist first second simplify-cfg
] with-scope ;
: basic-block. ( basic-block -- )
instructions>> [ . ] each ;