From 89e98e96a451e1b1a07f58ba93559e095b281f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Sun, 3 Apr 2016 05:53:18 +0200 Subject: [PATCH] compiler.cfg.linear-scan.live-intervals: hairy- and clober-insn moved to this vocab --- .../cfg/instructions/instructions.factor | 19 -------------- .../live-intervals/live-intervals-docs.factor | 25 +++++++++++++++---- .../live-intervals/live-intervals.factor | 16 +++++++++--- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/basis/compiler/cfg/instructions/instructions.factor b/basis/compiler/cfg/instructions/instructions.factor index 5cefdb44b5..b95d4953b0 100644 --- a/basis/compiler/cfg/instructions/instructions.factor +++ b/basis/compiler/cfg/instructions/instructions.factor @@ -855,25 +855,6 @@ TUPLE: gc-map scrub-d scrub-r gc-roots derived-roots ; : ( -- 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 diff --git a/basis/compiler/cfg/linear-scan/live-intervals/live-intervals-docs.factor b/basis/compiler/cfg/linear-scan/live-intervals/live-intervals-docs.factor index 56a86ae2a5..1c7058bf45 100644 --- a/basis/compiler/cfg/linear-scan/live-intervals/live-intervals-docs.factor +++ b/basis/compiler/cfg/linear-scan/live-intervals/live-intervals-docs.factor @@ -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: @@ -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-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" diff --git a/basis/compiler/cfg/linear-scan/live-intervals/live-intervals.factor b/basis/compiler/cfg/linear-scan/live-intervals/live-intervals.factor index 2c506f745b..c0fe254eca 100644 --- a/basis/compiler/cfg/linear-scan/live-intervals/live-intervals.factor +++ b/basis/compiler/cfg/linear-scan/live-intervals/live-intervals.factor @@ -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 ]