Docs: more docs for compiler.cfg.* words
parent
3d7b0dbf0a
commit
2d7f344109
|
@ -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." } ;
|
|
@ -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." } ;
|
|
@ -11,6 +11,14 @@ HELP: vreg-insn
|
||||||
"Base class for instructions that uses vregs."
|
"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
|
HELP: ##inc-d
|
||||||
{ $class-description
|
{ $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."
|
"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
|
HELP: ##no-tco
|
||||||
{ $class-description "A dummy instruction that simply inhibits 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." } ;
|
||||||
|
|
|
@ -17,12 +17,8 @@ TUPLE: insn ;
|
||||||
|
|
||||||
TUPLE: vreg-insn < insn ;
|
TUPLE: vreg-insn < insn ;
|
||||||
|
|
||||||
! Instructions which do not have side effects; used for
|
|
||||||
! dead code elimination
|
|
||||||
TUPLE: flushable-insn < vreg-insn ;
|
TUPLE: flushable-insn < vreg-insn ;
|
||||||
|
|
||||||
! Instructions which are referentially transparent; used for
|
|
||||||
! value numbering
|
|
||||||
TUPLE: foldable-insn < flushable-insn ;
|
TUPLE: foldable-insn < flushable-insn ;
|
||||||
|
|
||||||
! Constants
|
! Constants
|
||||||
|
|
|
@ -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." } ;
|
Loading…
Reference in New Issue