Removing phi-outs set in SSA liveness checking
parent
3b78d03e2a
commit
765efc1a66
|
@ -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
|
||||
|
@ -86,8 +85,8 @@ V{ } 1 test-bb
|
|||
V{ } 2 test-bb
|
||||
V{ } 3 test-bb
|
||||
V int-regs 2
|
||||
2 get V int-regs 0 2array
|
||||
3 get V int-regs 1 2array
|
||||
2 V int-regs 0 2array
|
||||
3 V int-regs 1 2array
|
||||
2array \ ##phi new-insn 1vector
|
||||
4 test-bb
|
||||
test-diamond
|
||||
|
@ -109,7 +108,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
|
||||
|
||||
|
@ -118,7 +117,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
|
||||
|
@ -202,8 +201,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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue