Docs: more docs for compiler.cfg.* words

db4
Björn Lindqvist 2014-05-18 19:45:09 +02:00 committed by John Benediktsson
parent 3d7b0dbf0a
commit 2d7f344109
5 changed files with 69 additions and 4 deletions

View File

@ -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." } ;

View File

@ -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." } ;

View File

@ -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." } ;

View File

@ -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

View File

@ -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." } ;