factor/basis/compiler/tree/tree-docs.factor

105 lines
4.4 KiB
Factor
Raw Normal View History

2016-08-31 20:16:30 -04:00
USING: alien assocs help.markup help.syntax kernel kernel.private
quotations sequences stack-checker.alien stack-checker.inlining
stack-checker.values stack-checker.visitor words ;
IN: compiler.tree
2014-05-06 17:24:32 -04:00
HELP: node
2015-09-20 05:39:34 -04:00
{ $class-description "Base class for all SSA tree nodes. The node is an " { $link identity-tuple } " which means that two different node instances with the same attributes are not equal." } ;
2014-05-06 17:24:32 -04:00
2014-05-06 12:09:34 -04:00
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
2015-09-20 05:39:34 -04:00
{ $class-description "SSA tree node that calls a function in a dynamically linked library." }
{ $see-also alien-invoke } ;
2014-05-06 12:09:34 -04:00
HELP: #alien-callback
2016-08-31 20:16:30 -04:00
{ $class-description "SSA tree node that constructs an alien callback. It is not a subclass of " { $link #alien-node } ". " } ;
HELP: #call
2014-05-06 17:24:32 -04:00
{ $class-description "SSA tree node that calls a word. It has the following slots:"
{ $table
{ { $slot "word" } { "The " { $link word } " to call." } }
{ { $slot "in-d" } { "Sequence of input variables to the call. The items are ordered from top to bottom of the stack." } }
{ { $slot "out-d" } { "Output values of the call." } }
{ { $slot "method" } { "If the called word is generic and inlined here, then 'method' contains the inlined " { $link quotation } "." } }
{ { $slot "body" } { "If the called word is generic and inlined, then 'body' is a sequence of SSA nodes built from the inlined method." } }
{ { $slot "info" } { "If the called word is generic and inlined, then the info slot contains an assoc of value infos for the body of the inlined generic. It is set during the propagation pass of the optimizer." } }
2014-05-06 17:24:32 -04:00
}
} ;
2015-09-20 05:39:34 -04:00
HELP: #call-recursive
{ $class-description "In a " { $link #recursive } " block of the SSA tree, this node represents a call back to the beginning of the block." }
{ $see-also #recursive } ;
HELP: #declare
{ $class-description "SSA tree node emitted when " { $link declare } " declarations are encountered." } ;
2015-09-20 05:39:34 -04:00
HELP: #enter-recursive
{ $class-description "This node works is placed first in the 'child' " { $link sequence } " for " { $link #recursive } " nodes and works like a header for it." }
2015-09-20 05:39:34 -04:00
{ $see-also #recursive #return-recursive } ;
HELP: #if
{ $class-description "SSA tree node that implements conditional branching. It has the following slots:"
{ $table
{ { $slot "children" }
{ "A two item " { $link sequence } ". The first item holds the instructions executed if the condition is true and the second those that are executed if it is not true." }
}
}
} ;
HELP: #introduce
{ $class-description "SSA tree node that puts an input value from the \"outside\" on the stack. It is used to \"introduce\" data stack parameter whenever they are needed. It has the following slots:"
{ $table
{ { $slot "out-d" } { "Array of values of the parameters being introduced." } }
}
} ;
2015-09-20 05:39:34 -04:00
HELP: #phi
{ $class-description "#phi is a SSA tree node type that unifies two branches in an " { $link #if } "." } ;
HELP: #push
{ $class-description "SSA tree node that puts a literal value on the stack. It has the following slots:"
{ $table
{ { $slot "out-d" } { "A one item array containing the " { $link <value> } " of the literal being pushed." } }
}
}
2014-12-30 20:46:35 -05:00
{ $notes "A " { $link quotation } " is also a literal." } ;
2015-09-20 05:39:34 -04:00
HELP: #recursive
{ $class-description "Instruction which encodes a loop. It has the following slots:"
{ $table
2015-09-20 05:39:34 -04:00
{ { $slot "child" } { "A sequence of nodes representing the body of the loop." } }
{ { $slot "loop?" } { "If " { $link t } ", the recursion is implemented using a jump, otherwise as a call back to the word." } }
}
2015-09-20 05:39:34 -04:00
}
{ $see-also inline-recursive-word } ;
2015-09-20 05:39:34 -04:00
HELP: #shuffle
{ $class-description "SSA tree node that represents a stack shuffling operation such as " { $link swap } ". It has the following slots:"
{ $table
2015-09-20 05:39:34 -04:00
{ { $slot "mapping" } { "An " { $link assoc } " that shows how the shuffle output values (the keys) correspond to their inputs (the values)." } }
}
} ;
HELP: node,
{ $values { "node" node } }
{ $description "Emits a node to the " { $link stack-visitor } " variable." } ;
ARTICLE: "compiler.tree" "High-level optimizer operating on lexical tree SSA IR"
"Node types:"
{ $subsections
#call
#declare
#shuffle
2015-09-20 05:39:34 -04:00
}
"Nodes for control flow:"
{ $subsections
#call-recursive
#enter-recursive
#recursive
#return-recursive
} ;
ABOUT: "compiler.tree"