compiler.cfg.builder.blocks: some cleanup
parent
3a9b297b3b
commit
5ca571e304
|
@ -53,7 +53,7 @@ HELP: emit-conditional
|
|||
{ $values
|
||||
{ "block" basic-block }
|
||||
{ "branches" "sequence of pairs" }
|
||||
{ "block'" basic-block }
|
||||
{ "block'/f" { $maybe basic-block } }
|
||||
}
|
||||
{ $description "Emits a sequence of conditional branches to the current " { $link cfg } ". Each branch is a pair where the first item is the entry basic block and the second the branches " { $link height-state } ". 'block' is the block in which the control flow is branched and \"block'\" the block in which it converges again." } ;
|
||||
|
||||
|
|
|
@ -3,12 +3,10 @@
|
|||
USING: accessors arrays compiler.cfg compiler.cfg.instructions
|
||||
compiler.cfg.stacks compiler.cfg.stacks.local compiler.cfg.utilities
|
||||
kernel make math namespaces sequences ;
|
||||
SLOT: in-d
|
||||
SLOT: out-d
|
||||
IN: compiler.cfg.builder.blocks
|
||||
|
||||
: set-basic-block ( basic-block -- )
|
||||
[ instructions>> building set ] [ begin-local-analysis ] bi ;
|
||||
dup begin-local-analysis instructions>> building set ;
|
||||
|
||||
: end-basic-block ( block -- )
|
||||
[ end-local-analysis ] when* building off ;
|
||||
|
@ -17,7 +15,7 @@ IN: compiler.cfg.builder.blocks
|
|||
<basic-block> swap [ over connect-bbs ] when* dup set-basic-block ;
|
||||
|
||||
: begin-basic-block ( block -- block' )
|
||||
dup [ end-local-analysis ] when* (begin-basic-block) ;
|
||||
dup end-basic-block (begin-basic-block) ;
|
||||
|
||||
: emit-trivial-block ( block quot: ( ..a block' -- ..b ) -- block' )
|
||||
##branch, swap begin-basic-block
|
||||
|
@ -52,7 +50,7 @@ IN: compiler.cfg.builder.blocks
|
|||
: with-branch ( block quot: ( ..a block -- ..b block' ) -- pair/f )
|
||||
[ [ begin-branch ] dip call end-branch ] with-scope ; inline
|
||||
|
||||
: emit-conditional ( block branches -- block' )
|
||||
: emit-conditional ( block branches -- block'/f )
|
||||
swap end-basic-block
|
||||
sift [ f ] [
|
||||
dup first second height-state set
|
||||
|
|
Loading…
Reference in New Issue