compiler.cfg.linear-scan.allocation.state: sub docs and tests

db4
Björn Lindqvist 2014-11-15 07:22:28 +01:00 committed by John Benediktsson
parent 0a30bd9218
commit 1eac4afc8b
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,19 @@
USING: assocs compiler.cfg compiler.cfg.instructions cpu.architecture
help.markup help.syntax math ;
IN: compiler.cfg.linear-scan.allocation.state
HELP: init-allocator
{ $values { "registers" { $link assoc } " mapping from register class to available machine registers." } }
{ $description "Initializes the state for the register allocator." }
{ $see-also reg-class } ;
HELP: next-spill-slot
{ $values { "size" "number of bytes required" } { "spill-slot" spill-slot } }
{ $description "Creates a new " { $link spill-slot } " of the given size and also allocates space in the " { $link cfg } " in the 'cfg' dynamic variable for it." } ;
HELP: spill-slots
{ $var-description "Mapping from vregs to spill slots." } ;
HELP: align-spill-area
{ $values { "align" integer } }
{ $description "This word is used to ensure that the alignment of the spill area in the " { $link cfg } " is equal to the largest " { $link spill-slot } "." } ;

View File

@ -0,0 +1,14 @@
USING: combinators.extras compiler.cfg compiler.cfg.instructions
compiler.cfg.linear-scan.allocation.state kernel namespaces tools.test ;
IN: compiler.cfg.linear-scan.allocation.state.tests
{
T{ spill-slot f 0 }
T{ spill-slot f 8 }
T{ cfg { spill-area-size 16 } }
} [
H{ } clone spill-slots set
T{ cfg { spill-area-size 0 } } cfg set
[ 8 next-spill-slot ] twice
cfg get
] unit-test