]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.cfg.*: a bunch of new docstrings and other doc fixes
authorBjörn Lindqvist <bjourne@gmail.com>
Wed, 8 Apr 2015 06:20:55 +0000 (08:20 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 29 Apr 2015 16:31:56 +0000 (09:31 -0700)
basis/compiler/cfg/block-joining/block-joining-docs.factor
basis/compiler/cfg/builder/builder-docs.factor
basis/compiler/cfg/dce/dce-docs.factor [new file with mode: 0644]
basis/compiler/cfg/dce/dce.factor
basis/compiler/cfg/gc-checks/gc-checks-docs.factor
basis/compiler/cfg/gc-checks/gc-checks.factor
basis/compiler/cfg/intrinsics/allot/allot-docs.factor [new file with mode: 0644]
basis/compiler/cfg/stacks/stacks-docs.factor

index 54564ca7b260644ac0b7b88eaa82f6c7407c982b..3ff80b1be6b7f0e512ed60f4a14258f42d49e9af 100644 (file)
@@ -5,6 +5,10 @@ HELP: join-block?
 { $values { "bb" basic-block } { "?" "a boolean" } }
 { $description "Whether the block can be joined with its predecessor or not." } ;
 
+HELP: join-blocks
+{ $values { "cfg" cfg } }
+{ $description "A compiler pass when optimizing the cfg." } ;
+
 ARTICLE: "compiler.cfg.block-joining" "Block Joining"
 "Joining blocks that are not calls and are connected by a single CFG edge. This pass does not update " { $link ##phi } " nodes and should therefore only run before stack analysis." ;
 
index fde3973bbeca97f5613b6760fab934ffe50d312f..f360f4f880580899ac863e2616ac7b0c91cd8131 100644 (file)
@@ -61,6 +61,10 @@ HELP: emit-call
 }
 { $see-also call-height } ;
 
+HELP: emit-loop-call
+{ $values { "basic-block" basic-block } }
+{ $description "Sets the given block as the successor of the current block. Then ends the block." } ;
+
 HELP: emit-node
 { $values { "node" node } }
 { $description "Emits CFG instructions for the given SSA node." } ;
diff --git a/basis/compiler/cfg/dce/dce-docs.factor b/basis/compiler/cfg/dce/dce-docs.factor
new file mode 100644 (file)
index 0000000..a868cbb
--- /dev/null
@@ -0,0 +1,11 @@
+USING: compiler.cfg help.markup help.syntax math sequences ;
+IN: compiler.cfg.dce
+
+HELP: eliminate-dead-code
+{ $values { "cfg" cfg } }
+{ $description "Even though we don't use predecessors directly, we depend on the predecessors pass updating phi nodes to remove dead inputs." } ;
+
+ARTICLE: "compiler.cfg.dce" "Dead code elimination"
+"Eliminates dead code." ;
+
+ABOUT: "compiler.cfg.dce"
index 93986fd20d6e09adfe05d1cdf46d61b76c573ca1..93ff029ce1710a2d17108ed59c278f6261ac0305 100644 (file)
@@ -117,9 +117,6 @@ M: insn live-insn? drop t ;
 
 : eliminate-dead-code ( cfg -- )
     init-dead-code
-    ! Even though we don't use predecessors directly, we depend
-    ! on the predecessors pass updating phi nodes to remove dead
-    ! inputs.
     {
         [ needs-predecessors ]
         [ [ [ build-liveness-graph ] each ] simple-analysis ]
index 2fc95c54fdb60d28e23f63ba4044e34a54c8adda..a6c9cc86b460eee972a4f83dfa15043661272b05 100644 (file)
@@ -4,25 +4,9 @@ IN: compiler.cfg.gc-checks
 
 <PRIVATE
 
-HELP: insert-gc-checks
-{ $values { "cfg" cfg }  }
-{ $description "Inserts gc checks in each " { $link basic-block } " in the cfg where they are needed." } ;
-
-HELP: insert-gc-check?
-{ $values { "bb" basic-block } { "?" "a boolean" } }
-{ $description "Whether to insert a gc check in the block or not." } ;
-
-HELP: blocks-with-gc
-{ $values { "cfg" cfg } { "bbs" "a " { $link sequence } " of " { $link basic-block } } }
-{ $description "Lists all basic blocks in the cfg that needs gc checks." } ;
-
-HELP: allocation-size*
-{ $values { "insn" insn } { "n" number } }
-{ $description "Number of bytes allocated by the given instruction." } ;
-
 HELP: allocation-size
 { $values { "insns" { $link sequence } " of " { $link insn } } { "n" number } }
-{ $description "Calculates the total number of bytes allocated by the block." }
+{ $description "Calculates the total number of bytes allocated by the instructions in a block." }
 { $examples
   { $unchecked-example
     "USING: accessors compiler.cfg.debugger compiler.cfg.gc-checks.private kernel prettyprint sequences ;"
@@ -31,11 +15,34 @@ HELP: allocation-size
   }
 } ;
 
-PRIVATE>
+HELP: allocation-size*
+{ $values { "insn" insn } { "n" number } }
+{ $description "Number of bytes allocated by the given instruction." } ;
 
-ARTICLE: "compiler.cfg.gc-checks" "Garbage collection check insertion"
-"This pass runs after representation selection, since it needs to know which vregs can contain tagged pointers." ;
+HELP: blocks-with-gc
+{ $values { "cfg" cfg } { "bbs" "a " { $link sequence } " of " { $link basic-block } } }
+{ $description "Lists all basic blocks in the cfg that needs gc checks." } ;
+
+HELP: gc-check-offsets
+{ $values { "insns" sequence } { "seq" sequence } }
+{ $description "A basic block is divided into sections by " { $link ##call } " and " { $link ##phi } " instructions. For every section with at least one allocation, record the offset of its first instruction  in a sequence." } ;
+
+HELP: insert-gc-check?
+{ $values { "bb" basic-block } { "?" "a boolean" } }
+{ $description "Whether to insert a gc check in the block or not." } ;
+
+HELP: insert-gc-checks
+{ $values { "cfg" cfg }  }
+{ $description "Inserts gc checks in each " { $link basic-block } " in the cfg where they are needed." } ;
+
+PRIVATE>
 
 HELP: process-block
 { $values { "bb" basic-block } }
 { $description "Process a block that needs a gc check. New blocks are allocated and connected for the gc branches." } ;
+
+
+ARTICLE: "compiler.cfg.gc-checks" "Garbage collection check insertion"
+"This pass runs after representation selection, since it needs to know which vregs can contain tagged pointers." ;
+
+ABOUT: "compiler.cfg.gc-checks"
index 280678c3886475ab7c51cf8da836eeb0d8e5b800..9d89a7ff2e465486f545fafb9227821776b0ec6b 100644 (file)
@@ -29,10 +29,6 @@ M: ##allocation gc-check-offsets* 3drop t ;
 M: insn gc-check-offsets* 2drop ;
 
 : gc-check-offsets ( insns -- seq )
-    ! A basic block is divided into sections by call and phi
-    ! instructions. For every section with at least one
-    ! allocation, record the offset of its first instruction
-    ! in a sequence.
     [
         [ 0 f ] dip
         [ gc-check-offsets* ] each-index
@@ -122,9 +118,7 @@ M: ##box-displaced-alien allocation-size* drop 5 cells ;
 
 PRIVATE>
 
-:: insert-gc-checks ( cfg -- )
-    cfg blocks-with-gc [
-        cfg needs-predecessors
-        [ process-block ] each
-        cfg cfg-changed
-    ] unless-empty ;
+: insert-gc-checks ( cfg -- )
+    [ needs-predecessors ]
+    [ blocks-with-gc [ process-block ] each ]
+    [ cfg-changed ] tri ;
diff --git a/basis/compiler/cfg/intrinsics/allot/allot-docs.factor b/basis/compiler/cfg/intrinsics/allot/allot-docs.factor
new file mode 100644 (file)
index 0000000..da294ab
--- /dev/null
@@ -0,0 +1,11 @@
+USING: compiler.tree help.markup help.syntax ;
+IN: compiler.cfg.intrinsics.allot
+
+HELP: emit-<tuple-boa>
+{ $values { "node" node } }
+{ $description "Emits optimized cfg instructions for building and allocating tuples." } ;
+
+ARTICLE: "compiler.cfg.intrinsics.allot" "Generating instructions for inline memory allocation"
+"Generating instructions for inline memory allocation" ;
+
+ABOUT: "compiler.cfg.intrinsics.allot"
index 720548dc4337c2d2dbce583d4c5770f3284cb5dd..a1b6ce816119119cb26e5ac55107bfbc5e308cf0 100644 (file)
@@ -12,7 +12,7 @@ HELP: begin-stack-analysis
 { $see-also height-state } ;
 
 HELP: end-stack-analysis
-{ $description "Ends the stack analysis of the current cfg." } ;
+{ $description "Ends the stack analysis of the current cfg. This is the last step of the cfg construction (but comes before all optimization passes)." } ;
 
 HELP: adjust-d
 { $values { "n" number } }
@@ -26,7 +26,7 @@ HELP: store-vregs
   { "vregs" "a " { $link sequence } " of vregs" }
   { "loc-class" "either " { $link ds-loc } " or " { $link rs-loc } }
 }
-{ $description "Stores one or more virtual register values on the data or retain stack. The " { $link replace-mapping } " dynamic variable is modified but the " { $link height-state } " is not touched" } ;
+{ $description "Stores one or more virtual register values on the data or retain stack. The " { $link replaces } " dynamic variable is modified but the " { $link height-state } " is not touched" } ;
 
 HELP: 2inputs
 { $values { "vreg1" "a vreg" } { "vreg2" "a vreg" } }