2015-06-15 04:44:53 -04:00
|
|
|
USING: assocs compiler.cfg.def-use compiler.cfg.instructions
|
2015-07-28 14:39:51 -04:00
|
|
|
compiler.cfg.ssa.destruction.coalescing
|
|
|
|
compiler.cfg.ssa.destruction.leaders compiler.cfg.ssa.interference
|
|
|
|
compiler.cfg.utilities cpu.architecture grouping kernel make
|
|
|
|
namespaces random sequences tools.test ;
|
2015-06-15 04:44:53 -04:00
|
|
|
QUALIFIED: sets
|
|
|
|
IN: compiler.cfg.ssa.destruction.coalescing.tests
|
|
|
|
|
2015-07-28 14:39:51 -04:00
|
|
|
! initial-class-elements
|
2015-06-15 04:44:53 -04:00
|
|
|
{
|
2015-07-28 14:39:51 -04:00
|
|
|
H{
|
|
|
|
{
|
|
|
|
77
|
|
|
|
{ T{ vreg-info { vreg 77 } { value 77 } { bb "bb2" } } }
|
|
|
|
}
|
|
|
|
{
|
|
|
|
123
|
|
|
|
{
|
|
|
|
T{ vreg-info
|
|
|
|
{ vreg 123 }
|
|
|
|
{ value 123 }
|
|
|
|
{ bb "bb1" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-15 04:44:53 -04:00
|
|
|
} [
|
|
|
|
H{ { 123 "bb1" } { 77 "bb2" } } defs set
|
2015-07-28 14:39:51 -04:00
|
|
|
initial-class-elements
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
! initial-leaders
|
|
|
|
{
|
|
|
|
H{ { 65 65 } { 99 99 } { 62 62 } { 303 303 } }
|
|
|
|
} [
|
|
|
|
{
|
|
|
|
T{ ##load-vector
|
|
|
|
{ dst 62 }
|
|
|
|
{ val B{ 0 0 0 0 0 0 0 64 0 0 0 0 0 0 52 64 } }
|
|
|
|
{ rep double-2-rep }
|
|
|
|
}
|
|
|
|
T{ ##add-vector
|
|
|
|
{ dst 65 }
|
|
|
|
{ src1 62 }
|
|
|
|
{ src2 63 }
|
|
|
|
{ rep double-2-rep }
|
|
|
|
}
|
|
|
|
T{ ##allot
|
|
|
|
{ dst 99 }
|
|
|
|
{ size 24 }
|
|
|
|
{ temp 303 }
|
|
|
|
}
|
|
|
|
} insns>cfg initial-leaders
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
! init-coalescing
|
|
|
|
{
|
|
|
|
H{ { 118 118 } }
|
|
|
|
} [
|
|
|
|
{ T{ ##phi { dst 118 } { inputs H{ { 4 120 } { 2 119 } } } } } insns>cfg
|
|
|
|
dup compute-defs init-coalescing
|
2015-06-15 04:44:53 -04:00
|
|
|
leader-map get
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
! try-eliminate-copy
|
|
|
|
{ } [
|
|
|
|
10 10 f try-eliminate-copy
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
! coalesce-insn
|
|
|
|
{ V{ { 2 1 } } } [
|
|
|
|
[
|
|
|
|
T{ ##copy { src 1 } { dst 2 } { rep int-rep } } coalesce-insn
|
|
|
|
] V{ } make
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
{ V{ { 3 4 } { 7 8 } } } [
|
|
|
|
[
|
|
|
|
T{ ##parallel-copy { values V{ { 3 4 } { 7 8 } } } } coalesce-insn
|
|
|
|
] V{ } make
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
! All this work to make the 'values' order non-deterministic.
|
|
|
|
: make-phi-inputs ( -- assoc )
|
|
|
|
H{ } clone [
|
|
|
|
{ 2287 2288 } [
|
|
|
|
10 iota 1 sample first rot set-at
|
|
|
|
] with each
|
|
|
|
] keep ;
|
|
|
|
|
|
|
|
{ t } [
|
|
|
|
10 [
|
|
|
|
{ 2286 2287 2288 } sets:unique leader-map set
|
|
|
|
2286 make-phi-inputs ##phi new-insn
|
|
|
|
coalesce-insn
|
|
|
|
2286 leader
|
|
|
|
] replicate all-equal?
|
|
|
|
] unit-test
|