diff --git a/basis/compiler/cfg/builder/blocks/blocks-docs.factor b/basis/compiler/cfg/builder/blocks/blocks-docs.factor new file mode 100644 index 0000000000..7a03dd4499 --- /dev/null +++ b/basis/compiler/cfg/builder/blocks/blocks-docs.factor @@ -0,0 +1,5 @@ +USING: compiler.cfg help.markup help.syntax ; +IN: compiler.cfg.builder.blocks + +HELP: make-kill-block +{ $description "Marks the current " { $link basic-block } " being processed as a kill block." } ; diff --git a/basis/compiler/cfg/builder/builder-docs.factor b/basis/compiler/cfg/builder/builder-docs.factor new file mode 100644 index 0000000000..60c4052d9f --- /dev/null +++ b/basis/compiler/cfg/builder/builder-docs.factor @@ -0,0 +1,25 @@ +USING: compiler.tree help.markup help.syntax sequences words ; +IN: compiler.cfg.builder + +HELP: emit-node +{ $values { "node" node } } +{ $description "Emits some kind of code for the node." } ; + +HELP: trivial-branch? +{ $values + { "nodes" "a " { $link sequence } " of " { $link node } " instances" } + { "value" "the pushed value or " { $link f } } + { "?" "a boolean" } +} +{ $description "Checks whether nodes is a trivial branch or not. The branch is counted as trivial if all it does is push a literal value on the stack." } +{ $examples + { $example + "USING: compiler.cfg.builder prettyprint ;" + "{ T{ #push { literal 25 } } } trivial-branch? . ." + "t\n25" + } +} ; + +HELP: build-cfg +{ $values { "nodes" sequence } { "word" word } { "procedures" sequence } } +{ $description "Builds one or more cfgs from the given word." } ; diff --git a/basis/compiler/cfg/instructions/instructions-doc.factor b/basis/compiler/cfg/instructions/instructions-doc.factor index d3531537fd..04b3cc6a12 100644 --- a/basis/compiler/cfg/instructions/instructions-doc.factor +++ b/basis/compiler/cfg/instructions/instructions-doc.factor @@ -11,6 +11,14 @@ HELP: vreg-insn "Base class for instructions that uses vregs." } ; +HELP: flushable-insn +{ $class-description + "Instructions which do not have side effects; used for dead code elimination." } ; + +HELP: foldable-insn +{ $class-description + "Instructions which are referentially transparent; used for value numbering." } ; + HELP: ##inc-d { $class-description "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." @@ -90,3 +98,9 @@ HELP: ##return HELP: ##no-tco { $class-description "A dummy instruction that simply inhibits TCO." } ; + +HELP: ##copy +{ $class-description "Instruction that copies a value from one register to another." } ; + +HELP: ##compare-integer +{ $class-description "This instruction is emitted for integer comparisons." } ; diff --git a/basis/compiler/cfg/instructions/instructions.factor b/basis/compiler/cfg/instructions/instructions.factor index 2f1b2eaf6e..62018e436f 100644 --- a/basis/compiler/cfg/instructions/instructions.factor +++ b/basis/compiler/cfg/instructions/instructions.factor @@ -17,12 +17,8 @@ TUPLE: insn ; TUPLE: vreg-insn < insn ; -! Instructions which do not have side effects; used for -! dead code elimination TUPLE: flushable-insn < vreg-insn ; -! Instructions which are referentially transparent; used for -! value numbering TUPLE: foldable-insn < flushable-insn ; ! Constants diff --git a/basis/compiler/cfg/rpo/rpo-docs.factor b/basis/compiler/cfg/rpo/rpo-docs.factor new file mode 100644 index 0000000000..73e3c8eee0 --- /dev/null +++ b/basis/compiler/cfg/rpo/rpo-docs.factor @@ -0,0 +1,25 @@ +USING: compiler.cfg help.markup help.syntax quotations sequences ; +IN: compiler.cfg.rpo + +HELP: number-blocks +{ $values { "blocks" sequence } } +{ $description "Initializes the " { $slot "number" } " slot of each " { $link basic-block } "." } +{ $examples + { $example + "USING: compiler.cfg compiler.cfg.rpo prettyprint ;" + "10 [ <basic-block> ] replicate dup number-blocks [ number>> ] map ." + "{ 9 8 7 6 5 4 3 2 1 0 }" + } +} ; + +HELP: post-order +{ $values { "cfg" cfg } { "blocks" sequence } } +{ $description "Lists the blocks in the cfg sorted in descending order on the " { $slot "number" } " slot. The blocks are first numbered if they haven't already been." } ; + +HELP: each-basic-block +{ $values { "cfg" cfg } { "quot" quotation } } +{ $description "Applies a quotation to each basic block in the cfg." } ; + +HELP: optimize-basic-block +{ $values { "bb" basic-block } { "quot" quotation } } +{ $description "Performs one " { $link simple-optimization } " step. The quotation takes the instructions of the basic block and returns them back in an optimized form." } ;