]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.cfg.ssa.cssa, compiler.cfg.ssa.destruction, compiler.utilities: docs & tests
authorBjörn Lindqvist <bjourne@gmail.com>
Sat, 18 Apr 2015 11:08:09 +0000 (13:08 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 29 Apr 2015 16:31:58 +0000 (09:31 -0700)
basis/compiler/cfg/ssa/cssa/cssa-docs.factor [new file with mode: 0644]
basis/compiler/cfg/ssa/cssa/cssa.factor
basis/compiler/cfg/ssa/destruction/destruction-docs.factor [new file with mode: 0644]
basis/compiler/cfg/ssa/destruction/destruction.factor
basis/compiler/utilities/utilities-docs.factor [new file with mode: 0644]
basis/compiler/utilities/utilities-tests.factor [new file with mode: 0644]

diff --git a/basis/compiler/cfg/ssa/cssa/cssa-docs.factor b/basis/compiler/cfg/ssa/cssa/cssa-docs.factor
new file mode 100644 (file)
index 0000000..b516256
--- /dev/null
@@ -0,0 +1,7 @@
+USING: compiler.cfg.representations help.markup help.syntax ;
+IN: compiler.cfg.ssa.cssa
+
+ARTICLE: "compiler.cfg.ssa.cssa" "Conventional SSA Form"
+"Convert SSA to conventional SSA. This pass runs after representation selection (see " { $link select-representations } "), so it must keep track of representations when introducing new values." ;
+
+ABOUT: "compiler.cfg.ssa.cssa"
index ce472c8536854b51c95cb1d117cddbb970e413d0..9b08c217c38242c50d4b101da2f8fe27ff437ed0 100644 (file)
@@ -7,10 +7,6 @@ namespaces sequences ;
 FROM: assocs => change-at ;
 IN: compiler.cfg.ssa.cssa
 
-! Convert SSA to conventional SSA. This pass runs after representation
-! selection, so it must keep track of representations when introducing
-! new values.
-
 SYMBOLS: edge-copies phi-copies ;
 
 : init-copies ( bb -- )
diff --git a/basis/compiler/cfg/ssa/destruction/destruction-docs.factor b/basis/compiler/cfg/ssa/destruction/destruction-docs.factor
new file mode 100644 (file)
index 0000000..b773447
--- /dev/null
@@ -0,0 +1,12 @@
+USING: compiler.cfg.instructions help.markup help.syntax ;
+IN: compiler.cfg.ssa.destruction
+
+ARTICLE: "compiler.cfg.ssa.destruction" "SSA Destruction"
+"Because of the design of the register allocator, this pass has three peculiar properties."
+{ $list
+  "Instead of renaming vreg usages in the CFG, a map from vregs to canonical representatives is computed. This allows the register allocator to use the original SSA names to get reaching definitions."
+  { "Useless " { $link ##copy } " instructions, and all " { $link ##phi } " instructions, are eliminated, so the register allocator does not have to remove any redundant operations." }
+  { "This pass computes live sets and fills out the " { $slot "gc-roots" } " slots of GC maps with " { $vocab-link "compiler.cfg.liveness" } ", so the linear scan register allocator does not need to compute liveness again." }
+} ;
+
+ABOUT: "compiler.cfg.ssa.destruction"
index c017578cf02755ed3cbbc8b139c170af61fe8201..1c53e53c70db43f9b4c3ec522942e0fca09dccdf 100644 (file)
@@ -11,20 +11,6 @@ kernel locals make namespaces sequences sets ;
 FROM: namespaces => set ;
 IN: compiler.cfg.ssa.destruction
 
-! Because of the design of the register allocator, this pass
-! has three peculiar properties.
-!
-! 1) Instead of renaming vreg usages in the CFG, a map from
-! vregs to canonical representatives is computed. This allows
-! the register allocator to use the original SSA names to get
-! reaching definitions.
-! 2) Useless ##copy instructions, and all ##phi instructions,
-! are eliminated, so the register allocator does not have to
-! remove any redundant operations.
-! 3) This pass computes live sets and fills out GC maps with
-! compiler.cfg.liveness, so the linear scan register allocator
-! does not need to compute liveness again.
-
 ! Maps leaders to equivalence class elements.
 SYMBOL: class-element-map
 
diff --git a/basis/compiler/utilities/utilities-docs.factor b/basis/compiler/utilities/utilities-docs.factor
new file mode 100644 (file)
index 0000000..66b2d77
--- /dev/null
@@ -0,0 +1,7 @@
+USING: assocs compiler.cfg.ssa.destruction.leaders help.markup help.syntax math
+sequences ;
+IN: compiler.utilities
+
+HELP: compress-path
+{ $values { "source" integer } { "assoc" assoc } { "destination" integer } }
+{ $description "Gets the original definer for a vreg number. Then inserts a direct path from 'source' to that definer. For example if the assoc is " { $code "{ { 1 2 } { 2 3 } { 3 4 } { 4 4 } }" } "then the original definer of 1 is 4. The word is used by " { $link leader } " to figure out what the top leader of a vreg is." } ;
diff --git a/basis/compiler/utilities/utilities-tests.factor b/basis/compiler/utilities/utilities-tests.factor
new file mode 100644 (file)
index 0000000..6e4d2d5
--- /dev/null
@@ -0,0 +1,9 @@
+USING: compiler.utilities kernel tools.test ;
+IN: compiler.utilities.tests
+
+{
+    9
+    H{ { 9 9 } { 44 9 } { 7 9 } }
+} [
+    7 H{ { 7 44 } { 44 9 } { 9 9 } } [ compress-path ] keep
+] unit-test