Emit branches in the same order they're written in code
parent
ef6206d4bb
commit
b1aa3697cb
basis/compiler/cfg
linearization
rpo
|
@ -43,8 +43,8 @@ M: ##branch linearize-insn
|
|||
|
||||
: binary-conditional ( basic-block insn -- basic-block successor label2 src1 src2 cc )
|
||||
[ (binary-conditional) ]
|
||||
[ drop dup successors>> first useless-branch? ] 2bi
|
||||
[ [ number>> ] 3dip negate-cc ] [ [ swap number>> ] 3dip ] if ;
|
||||
[ drop dup successors>> second useless-branch? ] 2bi
|
||||
[ [ swap number>> ] 3dip ] [ [ number>> ] 3dip negate-cc ] if ;
|
||||
|
||||
M: ##compare-branch linearize-insn
|
||||
binary-conditional _compare-branch emit-branch ;
|
||||
|
|
|
@ -9,7 +9,10 @@ SYMBOL: visited
|
|||
: post-order-traversal ( bb -- )
|
||||
dup id>> visited get key? [ drop ] [
|
||||
dup id>> visited get conjoin
|
||||
[ successors>> [ post-order-traversal ] each ] [ , ] bi
|
||||
[
|
||||
successors>> <reversed>
|
||||
[ post-order-traversal ] each
|
||||
] [ , ] bi
|
||||
] if ;
|
||||
|
||||
: post-order ( bb -- blocks )
|
||||
|
|
Loading…
Reference in New Issue