factor/basis/compiler/cfg/linear-scan/debugger/debugger.factor

27 lines
815 B
Factor
Raw Normal View History

! Copyright (C) 2008, 2009 Slava Pestov.
2008-09-15 02:54:48 -04:00
! See http://factorcode.org/license.txt for BSD license.
2008-11-04 18:23:20 -05:00
USING: accessors kernel sequences sets arrays math strings fry
namespaces prettyprint compiler.cfg.linear-scan.live-intervals
compiler.cfg.linear-scan.allocation compiler.cfg assocs ;
2008-09-15 02:54:48 -04:00
IN: compiler.cfg.linear-scan.debugger
: check-linear-scan ( live-intervals machine-registers -- )
[
[ clone ] map dup [ [ vreg>> ] keep ] H{ } map>assoc
live-intervals set
f
] dip
allocate-registers drop ;
2008-11-04 18:23:20 -05:00
: picture ( uses -- str )
dup last 1 + CHAR: space <string>
2008-11-04 18:23:20 -05:00
[ '[ CHAR: * swap _ set-nth ] each ] keep ;
: interval-picture ( interval -- str )
[ uses>> picture ]
[ vreg>> unparse ]
bi 2array ;
2008-11-04 18:23:20 -05:00
: live-intervals. ( seq -- )
[ interval-picture ] map simple-table. ;