]> gitweb.factorcode.org Git - factor.git/commitdiff
Docs: more compiler documentation
authorBjörn Lindqvist <bjourne@gmail.com>
Tue, 6 May 2014 16:09:34 +0000 (18:09 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 11 May 2014 00:13:48 +0000 (17:13 -0700)
basis/compiler/cfg/cfg-docs.factor
basis/compiler/cfg/instructions/instructions-doc.factor
basis/compiler/cfg/stacks/local/local-docs.factor [new file with mode: 0644]
basis/compiler/tree/tree-docs.factor

index bda3118f28c2406d1510fe08ad94440709cf81b4..01161043ac1ffec2561c8b7455ee485223a53cfa 100644 (file)
@@ -1,8 +1,11 @@
-USING: compiler.cfg help.markup help.syntax ;
+USING: compiler.cfg help.markup help.syntax vectors ;
 
 HELP: basic-block
 { $class-description
-  "Factors representation of a basic block in the cfg. A basic block is a sequence of instructions that always are executed sequentially and doesn't contain any branching."
+  "Factors representation of a basic block in the cfg. A basic block is a sequence of instructions that always are executed sequentially and doesn't contain any branching. It has the following slots:"
+  { $table
+    { { $slot "successors" } { "A " { $link vector } " of basic blocks that may be executed directly after this block. Most blocks only have one successor but a block that checks where an if-condition should branch to would have two for example." } }
+  }
 } ;
 
 HELP: <basic-block>
index 962dfb9767385a25a6ef7683a15344b98723864f..ba54bf4c3ba23dd06f32fdd830dbfc573ee55aae 100644 (file)
@@ -11,6 +11,11 @@ HELP: ##inc-d
   "An instruction that increases or decreases the data stacks size by n. For example, " { $link 2drop } " decreases it by two and pushing an item increases it by one."
 } ;
 
+HELP: ##alien-invoke
+{ $class-description
+  "An instruction for calling a function in a dynamically linked library."
+} ;
+
 HELP: ##set-slot
 { $class-description
   "An instruction for non-primitive non-immediate variant of " { $link set-slot } ". It has the following slots:"
diff --git a/basis/compiler/cfg/stacks/local/local-docs.factor b/basis/compiler/cfg/stacks/local/local-docs.factor
new file mode 100644 (file)
index 0000000..60b3c6a
--- /dev/null
@@ -0,0 +1,15 @@
+USING: compiler.cfg help.markup help.syntax ;
+IN: compiler.cfg.stacks.local
+
+HELP: current-height
+{ $class-description "A tuple used to keep track of the heights of the data and retain stacks in a " { $link basic-block } "." } ;
+
+HELP: emit-height-changes
+{ $description "Emits stack height change instructions to the CFG being built." }
+{ $examples
+  { $example
+    "USING: compiler.cfg.stacks.local make prettyprint ;"
+    "T{ current-height { emit-d 4 } { emit-r -2 } } current-height set [ emit-height-changes ] { } make ."
+    "{ T{ ##inc-d { n 4 } } T{ ##inc-r { n -2 } } }"
+  }
+} ;
index 70eb40bbfca5e0272445d93a10e21a77dfc04849..7c8d89473ff4a7b7d4bd10390abac6fdd4e8657a 100644 (file)
@@ -1,6 +1,13 @@
-USING: assocs help.markup help.syntax kernel sequences stack-checker.visitor ;
+USING: assocs help.markup help.syntax kernel sequences stack-checker.alien
+stack-checker.visitor ;
 IN: compiler.tree
 
+HELP: #alien-node
+{ $class-description "Base class for alien nodes. Its " { $snippet "params" } " slot holds an instance of the " { $link alien-node-params } " class." } ;
+
+HELP: #alien-invoke
+{ $class-description "SSA tree node that calls a function in a dynamically linked library." } ;
+
 HELP: #call
 { $class-description "SSA tree node that calls a word." } ;