]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/tree/propagation/info/info-docs.factor
d44604cc290fdc0d1aed87ed2e13e88a3a428f39
[factor.git] / basis / compiler / tree / propagation / info / info-docs.factor
1 USING: classes compiler.tree help.markup help.syntax kernel math math.intervals
2 sequences ;
3 IN: compiler.tree.propagation.info
4
5 HELP: interval>literal
6 { $values
7   { "class" class }
8   { "interval" interval }
9   { "literal" "a literal value" }
10   { "literal?" boolean }
11 }
12 { $description "If interval has zero length and the class is sufficiently precise, we can turn it into a literal." } ;
13
14 HELP: literal-class
15 { $values { "obj" object } { "class" class } }
16 { $description "Handle forgotten tuples and singleton classes properly." } ;
17
18 HELP: node-input-infos
19 { $values { "node" node } { "seq" sequence } }
20 { $description "Lists the value infos for the input variables of an SSA tree node. For " { $link #call } " nodes, the inputs represents the values on the stack when the word is called." } ;
21
22 HELP: node-output-infos
23 { $values { "node" node } { "seq" sequence } }
24 { $description "Lists the value infos for the output variables of an SSA tree node." } ;
25
26 HELP: value-info
27 { $values { "value" integer } { "info" value-info-state } }
28 { $description "Gets the value info for the given SSA value. If none is found then a null empty interval is returned." } ;
29
30 HELP: value-info<=
31 { $values { "info1" value-info } { "info2" value-info } { "?" boolean } }
32 { $description "Checks if the first value info is equal to, or smaller than the second one." } ;
33
34 HELP: value-info-state
35 { $class-description "Represents constraints the compiler knows about the input and output variables to an SSA tree node. It has the following slots:"
36   { $table
37     { { $slot "class" } { "Class of values the variable can take." } }
38     { { $slot "interval" } { "Range of values the variable can take." } }
39     { { $slot "literal" } { "Literal value, if present." } }
40     { { $slot "literal?" } { "Whether the value of the variable is known at compile-time or not." } }
41     { { $slot "slots" } { "If the value is a literal tuple or fixed length type, then slots is a " { $link sequence } " of " { $link value-info-state } " encoding what is known about its slots at compile-time." } }
42   }
43   "Don't mutate value infos you receive, always construct new ones. We don't declare the slots read-only to allow cloning followed by writing, and to simplify constructors."
44 } ;
45
46 HELP: value-infos
47 { $var-description "Assoc stack of current value --> info mapping" } ;
48
49 HELP: wrap-interval
50 { $values { "interval" interval } { "class" class } { "interval'" interval } }
51 { $description "Wraps an interval to the given numeric types interval." } ;
52
53 ARTICLE: "compiler.tree.propagation.info" "Value info data type and operations"
54 "Querying words:"
55 { $subsections
56   node-input-infos
57   node-output-infos
58   value-info
59 }
60 "Value info operations:"
61 { $subsections
62   value-info<=
63   value-info-union
64   value-infos-union
65 } ;
66
67 ABOUT: "compiler.tree.propagation.info"