cooler-spill-site ( uses -- index )


Vocabulary
compiler.cfg.register-allocation.spill-sites

Inputs
usesan object


Outputs
indexan object


Definition


:: cooler-spill-site ( uses -- index )
uses length :> length length 2 /i
:> best! best uses split-site-cost
:> cost! cost :> median-cost best :> median length 3 + 4 /i
1 max :> lower length 3 * 4 /i length 1 - min
:> upper upper lower - 1 + <iota> [| offset |
offset lower + :> index index uses split-site-cost
:> candidate candidate cost < candidate cost =
index median - abs best median - abs < and or
candidate median-cost < and index uses loop-transition?
and [ candidate cost! index best! ] when
] each best ;