compiler.cfg.utilities: move value-info utilities to compiler.tree.propagation.info

db4
Slava Pestov 2009-07-26 21:10:33 -05:00
parent 1319d8e549
commit fc41140720
2 changed files with 21 additions and 15 deletions

View File

@ -5,21 +5,6 @@ compiler.cfg compiler.cfg.instructions cpu.architecture kernel
layouts locals make math namespaces sequences sets vectors fry ;
IN: compiler.cfg.utilities
: value-info-small-fixnum? ( value-info -- ? )
literal>> {
{ [ dup fixnum? ] [ tag-fixnum small-enough? ] }
[ drop f ]
} cond ;
: value-info-small-tagged? ( value-info -- ? )
dup literal?>> [
literal>> {
{ [ dup fixnum? ] [ tag-fixnum small-enough? ] }
{ [ dup not ] [ drop t ] }
[ drop f ]
} cond
] [ drop f ] if ;
PREDICATE: kill-block < basic-block
instructions>> {
[ length 2 = ]
@ -59,3 +44,9 @@ SYMBOL: visited
swap >vector
\ ##branch new-insn over push
>>instructions ;
: has-phis? ( bb -- ? )
instructions>> first ##phi? ;
: if-has-phis ( bb quot: ( bb -- ) -- )
[ dup has-phis? ] dip [ drop ] if ; inline

View File

@ -306,3 +306,18 @@ SYMBOL: value-infos
dup in-d>> last node-value-info
literal>> first immutable-tuple-class?
] [ drop f ] if ;
: value-info-small-fixnum? ( value-info -- ? )
literal>> {
{ [ dup fixnum? ] [ tag-fixnum small-enough? ] }
[ drop f ]
} cond ;
: value-info-small-tagged? ( value-info -- ? )
dup literal?>> [
literal>> {
{ [ dup fixnum? ] [ tag-fixnum small-enough? ] }
{ [ dup not ] [ drop t ] }
[ drop f ]
} cond
] [ drop f ] if ;