compiler.*: more docs

modern-harvey2
Björn Lindqvist 2017-07-05 00:51:26 +02:00
parent 1eed7e7f5b
commit aab79a655c
9 changed files with 72 additions and 8 deletions

View File

@ -78,3 +78,10 @@ HELP: cfg-changed
HELP: spill-offset HELP: spill-offset
{ $values { "n" integer } { "offset" integer } } { $values { "n" integer } { "offset" integer } }
{ $description "Offset in the current " { $link stack-frame } " to byte at index 'n' in the spill area." } ; { $description "Offset in the current " { $link stack-frame } " to byte at index 'n' in the spill area." } ;
ARTICLE: "compiler.cfg" "Control Flow Graph IR"
"The compiler.cfg vocab and subvocabs implements the part of the optimizing compiler that analyzes code in the CFG format. The vocab " { $vocab-link "compiler.cfg.builder" } " defines words for building the CFG from SSA IR and the rest of the vocabs in the hierarchy optimization steps that are then applied to it. The graph is then passed to the " { $vocab-link "compiler.codegen" } " vocab which emits machine code."
$nl
"The main datatype in the vocab is the " { $link cfg } " tuple. It represents the CFG of a Factor word. The cfg tuple has a slot 'entry' pointing to a " { $link basic-block } ". This block in turn points to other basic blocks, and together they form the call flow graph of the word." ;
ABOUT: "compiler.cfg"

View File

@ -62,6 +62,10 @@ HELP: ##allot
} }
} ; } ;
HELP: ##bit-count
{ $class-description "Specialized instruction for counting the number of lit bits in an integer." }
{ $see-also %bit-count } ;
HELP: ##box HELP: ##box
{ $class-description { $class-description
"This instruction boxes a value into a tagged pointer." "This instruction boxes a value into a tagged pointer."
@ -521,6 +525,7 @@ $nl
{ $subsections { $subsections
##add-vector ##add-vector
##add-sub-vector ##add-sub-vector
##bit-count
##compare-float-ordered-branch ##compare-float-ordered-branch
##div-vector ##div-vector
##horizontal-add-vector ##horizontal-add-vector

View File

@ -1,6 +1,14 @@
USING: cpu.architecture help.markup help.syntax make ; USING: cpu.architecture help.markup help.syntax make ;
IN: compiler.cfg.representations.conversion IN: compiler.cfg.representations.conversion
HELP: emit-conversion
{ $values
{ "dst" "vreg" }
{ "src" "vreg" }
{ "dst-rep" representation }
{ "src-rep" representation }
} { $description "Emits an instruction converting a virtual register from one representation to another." } ;
HELP: tagged>rep HELP: tagged>rep
{ $values { "dst" "vreg" } { "src" "vreg" } { "rep" representation } } { $values { "dst" "vreg" } { "src" "vreg" } { "rep" representation } }
{ $description "Emits an instruction to the current " { $link make } { $description "Emits an instruction to the current " { $link make }

View File

@ -37,7 +37,6 @@ TUPLE: label-fixup-state { label label } { class integer } { offset integer } ;
[ [ compute-relative-label ] map concat ] [ [ compute-relative-label ] map concat ]
bi* ; bi* ;
! Binary literals
SYMBOL: binary-literal-table SYMBOL: binary-literal-table
: add-binary-literal ( obj -- label ) : add-binary-literal ( obj -- label )

View File

@ -1,4 +1,4 @@
USING: assocs help.markup help.syntax sequences words ; USING: assocs help.markup help.syntax kernel sequences words ;
IN: compiler.crossref IN: compiler.crossref
HELP: compiled-crossref HELP: compiled-crossref
@ -8,6 +8,10 @@ HELP: delete-compiled-xref
{ $values { "word" word } } { $values { "word" word } }
{ $description "Deletes cross-referencing data for a word. Used when the optimizing compiler forgets a word." } ; { $description "Deletes cross-referencing data for a word. Used when the optimizing compiler forgets a word." } ;
HELP: dependencies-satisfied?
{ $values { "word" word } { "cache" assoc } { "?" boolean } }
{ $description "Checks if all the words dependencies are satisfied or not." } ;
HELP: load-dependencies HELP: load-dependencies
{ $values { "word" word } { "seq" sequence } } { $values { "word" word } { "seq" sequence } }
{ $description "Outputs a sequence of the words dependencies." } ; { $description "Outputs a sequence of the words dependencies." } ;
@ -19,3 +23,8 @@ HELP: remove-xref
HELP: store-dependencies HELP: store-dependencies
{ $values { "word" word } { "assoc" assoc } } { $values { "word" word } { "assoc" assoc } }
{ $description "Stores the dependencies in 'assoc' in the word attribute \"dependencies\"." } ; { $description "Stores the dependencies in 'assoc' in the word attribute \"dependencies\"." } ;
ARTICLE: "compiler.crossref" "Crossreferencing word dependencies."
"A vocab that keeps track on how words depends on each other and their dependence types." ;o
ABOUT: "compiler.crossref"

View File

@ -0,0 +1,18 @@
USING: compiler.tree help.markup help.syntax sequences ;
IN: compiler.tree.propagation.branches
HELP: child-constraints
{ $values { "node" node } { "seq" sequence } }
{ $description "For conditionals, an assoc of child node # --> constraint." } ;
HELP: condition-value
{ $var-description "When propagating an " { $link #if } " node, this variable holds the value that is being dispatched on." } ;
HELP: live-branches
{ $values { "#branch" #branch } { "indices" sequence } }
{ $description "Outputs a sequence of true and false values indicating which of the branches that are possibly live." } ;
ARTICLE: "compiler.tree.propagation.branches" "Sparse propagation for branches"
"Sparse propagation for branches" ;
ABOUT: "compiler.tree.propagation.branches"

View File

@ -8,7 +8,6 @@ namespaces sequences stack-checker.branches ;
FROM: sets => union ; FROM: sets => union ;
IN: compiler.tree.propagation.branches IN: compiler.tree.propagation.branches
! For conditionals, an assoc of child node # --> constraint
GENERIC: child-constraints ( node -- seq ) GENERIC: child-constraints ( node -- seq )
M: #if child-constraints M: #if child-constraints

View File

@ -1,5 +1,6 @@
USING: compiler.tree compiler.tree.propagation.info help.markup USING: classes compiler.tree compiler.tree.propagation.info
help.syntax quotations sequences words ; help.markup help.syntax quotations sequences
stack-checker.dependencies words ;
IN: compiler.tree.propagation.simple IN: compiler.tree.propagation.simple
HELP: call-outputs-quot HELP: call-outputs-quot
@ -15,8 +16,7 @@ HELP: propagate-predicate
{ $values { "#call" #call } { "word" word } { "infos" sequence } } { $values { "#call" #call } { "word" word } { "infos" sequence } }
{ $description "We need to force the caller word to recompile when the class is redefined, since now we're making assumptions but the class definition itself." } ; { $description "We need to force the caller word to recompile when the class is redefined, since now we're making assumptions but the class definition itself." } ;
ARTICLE: "compiler.tree.propagation.simple" ARTICLE: "compiler.tree.propagation.simple" "Propagation for straight-line code"
"Propagation for straight-line code"
"Propagation for straight-line code" ; "Propagation for straight-line code" ;
ABOUT: "compiler.tree.propagation.simple" ABOUT: "compiler.tree.propagation.simple"

View File

@ -33,7 +33,11 @@ HELP: #call-recursive
{ $see-also #recursive } ; { $see-also #recursive } ;
HELP: #declare HELP: #declare
{ $class-description "SSA tree node emitted when " { $link declare } " declarations are encountered." } ; { $class-description "SSA tree node emitted when " { $link declare } " declarations are encountered. It has the following slots:"
{ $table
{ { $slot "declaration" } { { $link assoc } " that maps values to the types they are declared as." } }
}
} ;
HELP: #enter-recursive 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." } { $class-description "This node works is placed first in the 'child' " { $link sequence } " for " { $link #recursive } " nodes and works like a header for it." }
@ -99,6 +103,21 @@ ARTICLE: "compiler.tree" "High-level optimizer operating on lexical tree SSA IR"
#enter-recursive #enter-recursive
#recursive #recursive
#return-recursive #return-recursive
#terminate
}
"Nodes for alien ffi:"
{ $subsections
#alien-node
#alien-invoke
#alien-indirect
#alien-assembly
#alien-callback
}
"Nodes for branching:"
{ $subsections
#dispatch
#if
#phi
} ; } ;
ABOUT: "compiler.tree" ABOUT: "compiler.tree"