compiler.cfg.builder.*: docs and tests

locals-and-roots
Björn Lindqvist 2016-05-24 17:22:38 +02:00
parent 249483fc4f
commit 2fe26444aa
3 changed files with 23 additions and 3 deletions

View File

@ -67,8 +67,12 @@ HELP: emit-trivial-block
{ $examples { $unchecked-example $[ ex-emit-trivial-block ] } } ;
HELP: end-branch
{ $values { "block" basic-block } { "pair/f" "two-tuple" } }
{ $description "pair is { final-bb final-height }" } ;
{ $values
{ "block/f" { $maybe basic-block } }
{ "pair/f" "two-tuple" }
}
{ $description "The pair is a two tuple on the format { final-bb final-height }." }
{ $see-also with-branch } ;
HELP: set-basic-block
{ $values { "basic-block" basic-block } }

View File

@ -39,7 +39,7 @@ SLOT: out-d
: begin-branch ( block -- block' )
height-state [ clone-height-state ] change (begin-basic-block) ;
: end-branch ( block -- pair/f )
: end-branch ( block/f -- pair/f )
dup [
##branch,
end-local-analysis

View File

@ -270,6 +270,22 @@ SYMBOL: foo
predecessors>> first instructions>>
] cfg-unit-test
! emit-if
{ V{ 3 2 } } [
<basic-block> dup set-basic-block ##branch,
T{ #if
{ in-d { 9 } }
{ children
{
{ T{ #push { literal 3 } { out-d { 6 } } } }
{ T{ #push { literal 2 } { out-d { 7 } } } }
}
}
{ live-branches { t t } }
} emit-if
predecessors>> [ instructions>> first val>> ] map
] cfg-unit-test
! emit-loop-call
{ 1 "good" } [
V{ } 0 insns>block dup set-basic-block