]> gitweb.factorcode.org Git - factor.git/blob - unfinished/compiler/machine/debugger/debugger.factor
ogg plays but 1) sound is broken and 2) it doesn't recognize EOF anymore, so it hangs...
[factor.git] / unfinished / compiler / machine / debugger / debugger.factor
1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors kernel namespaces sequences assocs io
4 prettyprint inference generator optimizer
5 compiler.vops
6 compiler.tree.builder
7 compiler.tree.optimizer
8 compiler.cfg.builder
9 compiler.cfg.simplifier
10 compiler.machine.builder
11 compiler.machine.simplifier ;
12 IN: compiler.machine.debugger
13
14 : tree>linear ( tree word -- linear )
15     [
16         init-counter
17         build-cfg
18         [ simplify-cfg build-mr simplify-mr ] assoc-map
19     ] with-scope ;
20
21 : linear. ( linear -- )
22     [
23         "==== " write swap .
24         [ . ] each
25     ] assoc-each ;
26
27 : linearized-quot. ( quot -- )
28     build-tree optimize-tree
29     "Anonymous quotation" tree>linear
30     linear. ;
31
32 : linearized-word. ( word -- )
33     dup build-tree-from-word nip optimize-tree
34     dup word-dataflow nip optimize swap tree>linear linear. ;
35
36 : >basic-block ( quot -- basic-block )
37     build-tree optimize-tree
38     [
39         init-counter
40         "Anonymous quotation" build-cfg
41         >alist first second simplify-cfg
42     ] with-scope ;
43
44 : basic-block. ( basic-block -- )
45     instructions>> [ . ] each ;