compiler.cfg.linear-scan.live-intervals: hairy- and clober-insn moved to

this vocab
locals-and-roots
Björn Lindqvist 2016-04-03 05:53:18 +02:00
parent 1a71407112
commit 89e98e96a4
3 changed files with 33 additions and 27 deletions

View File

@ -855,25 +855,6 @@ TUPLE: gc-map scrub-d scrub-r gc-roots derived-roots ;
: <gc-map> ( -- gc-map ) gc-map new ;
! Instructions that clobber registers. They receive inputs and
! produce outputs in spill slots.
UNION: hairy-clobber-insn
##call-gc
alien-call-insn
##callback-inputs
##callback-outputs
##unbox-long-long ;
! Instructions that clobber registers but are allowed to produce
! outputs in registers. Inputs are in spill slots, except for
! inputs coalesced with the output, in which case that input
! will be in a register.
UNION: clobber-insn
hairy-clobber-insn
##unbox
##box
##box-long-long ;
UNION: def-is-use-insn
##box-alien
##box-displaced-alien

View File

@ -1,6 +1,6 @@
USING: compiler.cfg compiler.cfg.instructions
compiler.cfg.linear-scan.allocation cpu.architecture help.markup help.syntax
kernel math sequences ;
USING: compiler.cfg compiler.cfg.def-use compiler.cfg.instructions
compiler.cfg.linear-scan.allocation help.markup help.syntax kernel
math sequences ;
IN: compiler.cfg.linear-scan.live-intervals
HELP: <live-interval>
@ -24,11 +24,17 @@ HELP: cfg>sync-points
{ $description "Creates a sequence of all sync points in the cfg." }
{ $see-also sync-point } ;
HELP: clobber-insn
{ $class-description "Instructions that clobber registers but are allowed to produce outputs in registers. Inputs are in spill slots, except for inputs coalesced with the output, in which case that input will be in a register." } ;
HELP: compute-live-intervals
{ $values { "cfg" cfg } { "intervals/sync-points" sequence } }
{ $description "Computes the live intervals and sync points of a cfg." }
{ $notes "The instructions must be numbered." } ;
HELP: hairy-clobber-insn
{ $class-description "Instructions that clobber registers. They receive inputs and produce outputs in spill slots." } ;
HELP: find-use
{ $values
{ "insn#" integer }
@ -101,18 +107,27 @@ HELP: sync-point
{ { $slot "keep-dst?" } { "Boolean that determines whether registers are spilled around this sync point." } }
}
}
{ $see-also cfg>sync-points insn } ;
{ $see-also cfg>sync-points clobber-insn hairy-clobber-insn insn } ;
HELP: to
{ $var-description "An integer representing a sequence number equal to the highest number in the currently processed block." } ;
HELP: uses-vregs*
{ $values { "insn" insn } { "seq" sequence } }
{ $description "Like " { $link uses-vregs } " except it also includes gc-maps base pointers. The point is to make their values available even if the base pointers themselves are never used again." } ;
ARTICLE: "compiler.cfg.linear-scan.live-intervals" "Live interval utilities"
"This vocab contains words for managing live intervals. The main word is " { $link compute-live-intervals } " which goes through the " { $link cfg } " and returns a sequence of " { $link live-interval-state } " instances which encodes all liveness information for it."
$nl
"Liveness classes and constructors:"
{ $subsections <live-interval> live-interval-state }
"Recording liveness info:"
{ $subsections record-def record-use record-temp } ;
{ $subsections
compute-live-intervals*
record-def
record-use
record-temp
} ;
ABOUT: "compiler.cfg.linear-scan.live-intervals"

View File

@ -81,14 +81,24 @@ M: insn compute-live-intervals* drop ;
n n live-interval ranges>> add-range
n live-interval f (add-use) vreg rep-of >>def-rep drop ;
! Extend lifetime intervals of base pointers, so that their
! values are available even if the base pointer is never used
! again.
: uses-vregs* ( insn -- seq )
dup gc-map-insn? [
[ uses-vregs ] [ gc-map>> derived-roots>> values ] bi append
] [ uses-vregs ] if ;
UNION: hairy-clobber-insn
##call-gc
alien-call-insn
##callback-inputs
##callback-outputs
##unbox-long-long ;
UNION: clobber-insn
hairy-clobber-insn
##unbox
##box
##box-long-long ;
M: vreg-insn compute-live-intervals* ( insn -- )
dup insn#>>
[ [ defs-vregs ] dip '[ _ f record-def ] each ]