compiler.cfg.builder.*: docs and tests
parent
249483fc4f
commit
2fe26444aa
|
@ -67,8 +67,12 @@ HELP: emit-trivial-block
|
||||||
{ $examples { $unchecked-example $[ ex-emit-trivial-block ] } } ;
|
{ $examples { $unchecked-example $[ ex-emit-trivial-block ] } } ;
|
||||||
|
|
||||||
HELP: end-branch
|
HELP: end-branch
|
||||||
{ $values { "block" basic-block } { "pair/f" "two-tuple" } }
|
{ $values
|
||||||
{ $description "pair is { final-bb final-height }" } ;
|
{ "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
|
HELP: set-basic-block
|
||||||
{ $values { "basic-block" basic-block } }
|
{ $values { "basic-block" basic-block } }
|
||||||
|
|
|
@ -39,7 +39,7 @@ SLOT: out-d
|
||||||
: begin-branch ( block -- block' )
|
: begin-branch ( block -- block' )
|
||||||
height-state [ clone-height-state ] change (begin-basic-block) ;
|
height-state [ clone-height-state ] change (begin-basic-block) ;
|
||||||
|
|
||||||
: end-branch ( block -- pair/f )
|
: end-branch ( block/f -- pair/f )
|
||||||
dup [
|
dup [
|
||||||
##branch,
|
##branch,
|
||||||
end-local-analysis
|
end-local-analysis
|
||||||
|
|
|
@ -270,6 +270,22 @@ SYMBOL: foo
|
||||||
predecessors>> first instructions>>
|
predecessors>> first instructions>>
|
||||||
] cfg-unit-test
|
] 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
|
! emit-loop-call
|
||||||
{ 1 "good" } [
|
{ 1 "good" } [
|
||||||
V{ } 0 insns>block dup set-basic-block
|
V{ } 0 insns>block dup set-basic-block
|
||||||
|
|
Loading…
Reference in New Issue