Handbook
Glossary
weighted-ssa-affinities ( cfg graph -- affinities )
Vocabulary
compiler
.
cfg
.
register-allocation
.
chordal
Inputs
cfg
an
object
graph
an
object
Outputs
affinities
an
object
Definition
USING:
accessors
assocs
compiler.cfg.def-use
compiler.cfg.instructions
compiler.cfg.loop-detection
compiler.cfg.register-allocation.ssa.phases
compiler.cfg.rpo
kernel
math
math.functions
math.order
sequences
;
IN:
compiler.cfg.register-allocation.chordal
::
weighted-ssa-affinities
( cfg graph -- affinities )
graph
keys
[
H{
}
clone
]
H{
}
map>assoc
:>
affinities cfg
needs-loops
cfg
[|
bb |
8 bb
loop-nesting-at
3
min
^
:>
weight bb
instructions>>
[|
insn |
insn
##phi?
[
insn
inputs>>
values
[|
source |
insn
dst>>
source weight graph affinities
add-weighted-affinity
]
each
]
[
insn
##copy?
insn
##tagged>integer?
or
[
insn
dst>>
insn
src>>
weight graph
affinities
add-weighted-affinity
]
[
insn
phase-split-insn?
insn
def-is-use-insn?
not
and
insn
defs-vregs
length
1
=
and
insn
uses-vregs
empty?
not
and
[
insn
defs-vregs
first
insn
uses-vregs
first
weight 8
/
graph affinities
add-weighted-affinity
]
when
]
if
]
if
]
each
]
each-basic-block
affinities
;