compiler.cfg.linear-scan.live-intervals: hairy- and clober-insn moved to
this vocablocals-and-roots
parent
1a71407112
commit
89e98e96a4
|
@ -855,25 +855,6 @@ TUPLE: gc-map scrub-d scrub-r gc-roots derived-roots ;
|
||||||
|
|
||||||
: <gc-map> ( -- gc-map ) gc-map new ;
|
: <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
|
UNION: def-is-use-insn
|
||||||
##box-alien
|
##box-alien
|
||||||
##box-displaced-alien
|
##box-displaced-alien
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: compiler.cfg compiler.cfg.instructions
|
USING: compiler.cfg compiler.cfg.def-use compiler.cfg.instructions
|
||||||
compiler.cfg.linear-scan.allocation cpu.architecture help.markup help.syntax
|
compiler.cfg.linear-scan.allocation help.markup help.syntax kernel
|
||||||
kernel math sequences ;
|
math sequences ;
|
||||||
IN: compiler.cfg.linear-scan.live-intervals
|
IN: compiler.cfg.linear-scan.live-intervals
|
||||||
|
|
||||||
HELP: <live-interval>
|
HELP: <live-interval>
|
||||||
|
@ -24,11 +24,17 @@ HELP: cfg>sync-points
|
||||||
{ $description "Creates a sequence of all sync points in the cfg." }
|
{ $description "Creates a sequence of all sync points in the cfg." }
|
||||||
{ $see-also sync-point } ;
|
{ $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
|
HELP: compute-live-intervals
|
||||||
{ $values { "cfg" cfg } { "intervals/sync-points" sequence } }
|
{ $values { "cfg" cfg } { "intervals/sync-points" sequence } }
|
||||||
{ $description "Computes the live intervals and sync points of a cfg." }
|
{ $description "Computes the live intervals and sync points of a cfg." }
|
||||||
{ $notes "The instructions must be numbered." } ;
|
{ $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
|
HELP: find-use
|
||||||
{ $values
|
{ $values
|
||||||
{ "insn#" integer }
|
{ "insn#" integer }
|
||||||
|
@ -101,18 +107,27 @@ HELP: sync-point
|
||||||
{ { $slot "keep-dst?" } { "Boolean that determines whether registers are spilled around this 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
|
HELP: to
|
||||||
{ $var-description "An integer representing a sequence number equal to the highest number in the currently processed block." } ;
|
{ $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"
|
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."
|
"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
|
$nl
|
||||||
"Liveness classes and constructors:"
|
"Liveness classes and constructors:"
|
||||||
{ $subsections <live-interval> live-interval-state }
|
{ $subsections <live-interval> live-interval-state }
|
||||||
"Recording liveness info:"
|
"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"
|
ABOUT: "compiler.cfg.linear-scan.live-intervals"
|
||||||
|
|
|
@ -81,14 +81,24 @@ M: insn compute-live-intervals* drop ;
|
||||||
n n live-interval ranges>> add-range
|
n n live-interval ranges>> add-range
|
||||||
n live-interval f (add-use) vreg rep-of >>def-rep drop ;
|
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 )
|
: uses-vregs* ( insn -- seq )
|
||||||
dup gc-map-insn? [
|
dup gc-map-insn? [
|
||||||
[ uses-vregs ] [ gc-map>> derived-roots>> values ] bi append
|
[ uses-vregs ] [ gc-map>> derived-roots>> values ] bi append
|
||||||
] [ uses-vregs ] if ;
|
] [ 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 -- )
|
M: vreg-insn compute-live-intervals* ( insn -- )
|
||||||
dup insn#>>
|
dup insn#>>
|
||||||
[ [ defs-vregs ] dip '[ _ f record-def ] each ]
|
[ [ defs-vregs ] dip '[ _ f record-def ] each ]
|
||||||
|
|
Loading…
Reference in New Issue