compiler.cfg.utilities: add loop-entry? word

db4
Slava Pestov 2009-07-28 08:47:50 -05:00
parent e6f5eab598
commit ff81b055a5
2 changed files with 4 additions and 2 deletions

View File

@ -26,8 +26,7 @@ M: insn linearize-insn , drop ;
[ number>> ] bi@ 1 - = ; inline [ number>> ] bi@ 1 - = ; inline
: emit-loop-entry? ( bb successor -- ? ) : emit-loop-entry? ( bb successor -- ? )
[ back-edge? not ] [ back-edge? not ] [ nip loop-entry? ] 2bi and ;
[ nip dup predecessors>> [ swap back-edge? ] with any? ] 2bi and ;
: emit-branch ( bb successor -- ) : emit-branch ( bb successor -- )
2dup emit-loop-entry? [ _loop-entry ] when 2dup emit-loop-entry? [ _loop-entry ] when

View File

@ -15,6 +15,9 @@ PREDICATE: kill-block < basic-block
: back-edge? ( from to -- ? ) : back-edge? ( from to -- ? )
[ number>> ] bi@ >= ; [ number>> ] bi@ >= ;
: loop-entry? ( bb -- ? )
dup predecessors>> [ swap back-edge? ] with any? ;
: empty-block? ( bb -- ? ) : empty-block? ( bb -- ? )
instructions>> { instructions>> {
[ length 1 = ] [ length 1 = ]