Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2009-08-02 18:46:27 -05:00
commit df6c87d350
2 changed files with 4 additions and 28 deletions

View File

@ -39,7 +39,6 @@ cfg new 1 get >>entry 4 set
[ ] [ 4 get precompute-liveness ] unit-test
[ H{ } ] [ back-edge-targets get ] unit-test
[ H{ } ] [ phi-outs get ] unit-test
[ t ] [ 1 get R_q { 1 2 3 } [ get ] map unique = ] unit-test
[ t ] [ 2 get R_q { 2 } [ get ] map unique = ] unit-test
[ t ] [ 3 get R_q { 3 } [ get ] map unique = ] unit-test
@ -107,7 +106,7 @@ cfg new 1 get >>entry 5 set
[ f ] [ V int-regs 1 2 get live-in? ] unit-test
[ f ] [ V int-regs 2 2 get live-in? ] unit-test
[ t ] [ V int-regs 0 2 get live-out? ] unit-test
[ f ] [ V int-regs 0 2 get live-out? ] unit-test
[ f ] [ V int-regs 1 2 get live-out? ] unit-test
[ f ] [ V int-regs 2 2 get live-out? ] unit-test
@ -116,7 +115,7 @@ cfg new 1 get >>entry 5 set
[ f ] [ V int-regs 2 3 get live-in? ] unit-test
[ f ] [ V int-regs 0 3 get live-out? ] unit-test
[ t ] [ V int-regs 1 3 get live-out? ] unit-test
[ f ] [ V int-regs 1 3 get live-out? ] unit-test
[ f ] [ V int-regs 2 3 get live-out? ] unit-test
[ f ] [ V int-regs 0 4 get live-in? ] unit-test
@ -200,8 +199,6 @@ cfg new 1 get >>entry 0 set
[ f ] [ 10 get back-edge-target? ] unit-test
[ f ] [ 11 get back-edge-target? ] unit-test
[ f ] [ 1 11 [a,b] [ get phi-outs get at ] any? ] unit-test
[ f ] [ V int-regs 0 1 get live-in? ] unit-test
[ f ] [ V int-regs 1 1 get live-in? ] unit-test
[ f ] [ V int-regs 2 1 get live-in? ] unit-test

View File

@ -21,10 +21,6 @@ SYMBOL: R_q-sets
! Targets of back edges
SYMBOL: back-edge-targets
! hashtable of nodes => sets of vregs, where the vregs are inputs
! to phi nodes in a successor node
SYMBOL: phi-outs
: T_q ( q -- T_q )
T_q-sets get at ;
@ -34,9 +30,6 @@ SYMBOL: phi-outs
: back-edge-target? ( block -- ? )
back-edge-targets get key? ;
: phi-out? ( vreg node -- ? )
phi-outs get at key? ;
: next-R_q ( q -- R_q )
[ ] [ successors>> ] [ number>> ] tri
'[ number>> _ >= ] filter
@ -52,27 +45,14 @@ SYMBOL: phi-outs
[ back-edge-targets get conjoin ] [ drop ] if
] each ;
: set-phi-out ( block vreg -- )
swap phi-outs get [ drop H{ } clone ] cache conjoin ;
: set-phi-outs ( q -- )
instructions>> [
dup ##phi? [
inputs>> [ set-phi-out ] assoc-each
] [ drop ] if
] each ;
: init-R_q ( -- )
H{ } clone R_q-sets set
H{ } clone back-edge-targets set
H{ } clone phi-outs set ;
H{ } clone back-edge-targets set ;
: compute-R_q ( cfg -- )
init-R_q
post-order [
[ set-R_q ]
[ set-back-edges ]
[ set-phi-outs ] tri
[ set-R_q ] [ set-back-edges ] bi
] each ;
! This algorithm for computing T_q uses equation (1)
@ -150,7 +130,6 @@ PRIVATE>
[let | def [ vreg def-of ] |
{
{ [ node def eq? ] [ vreg uses-of def only? not ] }
{ [ vreg node phi-out? ] [ t ] }
{ [ def node strictly-dominates? ] [ vreg node (live-out?) ] }
[ f ]
} cond