<mixed-loop-pressure> ( count hot-count hot cold -- graph )


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

Inputs
countan object
hot-countan object
hotan object
coldan object


Outputs
graphan object


Definition


:: <mixed-loop-pressure>
( count hot-count hot cold -- graph )
H{ } clone representations set 0 vreg-counter set
fresh-int :> input fresh-int :> counter fresh-int
:> next-counter fresh-int :> result f :> values! [
##prologue, input D: 0 ##peek, count <iota>
[| i | fresh-int dup input i 1 + tag-fixnum ##add-imm, ]
map values! ##branch,
] { } make 0 insns>block
:> entry <basic-block> :> header f :> hot-result! [
values hot-count head hot sum-rounds
hot-result! next-counter counter 1 tag-fixnum ##sub-imm,
##branch,
] { } make 2 insns>block :> body [
values cold sum-rounds
:> cold-result fresh-int :> total total cold-result
result ##add, total D: 0 ##replace,
##epilogue, ##return,
] { } make 3 insns>block :> done [
counter
H{ { entry input } { body next-counter } } ##phi, result
H{ { entry input } { body hot-result } } ##phi,
counter 0 cc> ##compare-integer-imm-branch,
] V{ } make header instructions<< entry header connect-bbs
header body connect-bbs header done connect-bbs
body header connect-bbs loop-pressure-clobber? get [
body [
hot-count 1 - cut
[ f { } { } { } { } 0 0 [ ] ##alien-assembly, ] V{ }
make swap append append
] change-instructions drop
] when entry block>cfg ;