compiler.cfg.*: more docs

char-rename
Björn Lindqvist 2016-11-14 03:20:50 +01:00
parent 4d9367249b
commit ffef75f8a7
8 changed files with 87 additions and 14 deletions

View File

@ -284,7 +284,11 @@ HELP: ##slot-imm
} { $see-also %slot-imm } ;
HELP: ##spill
{ $class-description "Instruction that copies a value from a register to a " { $link spill-slot } "." } ;
{ $class-description "Instruction that copies a value from a register to a " { $link spill-slot } "."
{ $table
{ { $slot "rep" } { "Register representation which is necessary when spilling SIMD registers." } }
}
} { $see-also ##reload } ;
HELP: ##store-memory-imm
{ $class-description "Instruction that copies an 8 byte value from a XMM register to a memory location addressed by a normal register. This instruction is often turned into a cheaper " { $link ##store-memory } " instruction in the " { $link value-numbering } " pass."

View File

@ -1,6 +1,7 @@
USING: compiler.cfg.linear-scan
compiler.cfg.linear-scan.allocation.state
compiler.cfg.linear-scan.live-intervals help.markup help.syntax math ;
compiler.cfg.linear-scan.live-intervals cpu.architecture help.markup
help.syntax math ;
IN: compiler.cfg.linear-scan.allocation.spilling
HELP: assign-spill
@ -8,6 +9,11 @@ HELP: assign-spill
{ $description "Assigns a spill slot for the live interval." }
{ $see-also assign-spill-slot } ;
HELP: last-use-rep
{ $values { "live-interval" live-interval-state } { "rep" representation } }
{ $description "Gets the last usage representation for the interval. Used when determining what representation it should have when spilled." }
{ $see-also first-use-rep } ;
HELP: spill-after
{ $values
{ "after" live-interval-state }
@ -64,6 +70,8 @@ ARTICLE: "compiler.cfg.linear-scan.allocation.spilling" "Spill slot assignment"
"Words and dynamic variables for assigning spill slots to spilled registers during the " { $link linear-scan } " compiler pass."
$nl
"Splitting live intervals:"
{ $subsections split-for-spill } ;
{ $subsections split-for-spill }
"Usage representations:"
{ $subsections first-use-rep last-use-rep } ;
ABOUT: "compiler.cfg.linear-scan.allocation.spilling"

View File

@ -14,7 +14,7 @@ IN: compiler.cfg.linear-scan.allocation.spilling
: trim-after-ranges ( live-interval -- )
dup first-use n>> swap [ fix-lower-bound ] change-ranges drop ;
: last-use-rep ( live-interval -- rep/f )
: last-use-rep ( live-interval -- rep )
last-use [ def-rep>> ] [ use-rep>> ] bi or ; inline
: assign-spill ( live-interval -- )

View File

@ -12,6 +12,10 @@ HELP: activate-intervals
HELP: active-intervals
{ $var-description { $link assoc } " of active live intervals. The keys are register class symbols and the values vectors of " { $link live-interval-state } "." } ;
HELP: active-intervals-for
{ $values { "live-interval" live-interval-state } { "seq" sequence } }
{ $description "Finds the active live intervals sharing the same register class as the given interval." } ;
HELP: add-active
{ $values { "live-interval" live-interval-state } }
{ $description "Adds a live interval to the " { $link active-intervals } " assoc." }
@ -69,7 +73,14 @@ HELP: registers
{ $var-description "Mapping from register classes to sequences of machine registers." } ;
HELP: spill-slots
{ $var-description "Mapping from pairs of vregs and represenation sizes to spill slots." } ;
{ $var-description "Mapping from pairs of vregs and represenation sizes to spill slots." }
{ $see-also init-allocator } ;
HELP: unhandled-min-heap
{ $var-description { $link min-heap } " of all live intervals and sync points which still needs processing. It is used by " { $link (allocate-registers) } ". The key of the heap is a pair of values, " { $slot "start" } " and " { $slot "end" } " for the " { $link live-interval-state } " tuple and " { $slot "n" } " and 1/0.0 for the " { $link sync-point } " tuple. That way smaller live intervals are always processed before larger ones and all live intervals before sync points." } ;
ARTICLE: "compiler.cfg.linear-scan.allocation.state" "Live interval state"
"Active intervals:"
{ $subsections active-intervals active-intervals-for add-active } ;
ABOUT: "compiler.cfg.linear-scan.allocation.state"

View File

@ -44,6 +44,11 @@ HELP: insert-reload
{ $description "Inserts a " { $link ##reload } " instruction for a live interval." }
{ $see-also handle-reload insert-spill } ;
HELP: insert-spill
{ $values { "live-interval" live-interval-state } }
{ $description "Inserts a " { $link ##spill } " instruction for a live interval." }
{ $see-also insert-reload } ;
HELP: machine-edge-live-ins
{ $var-description "Mapping from basic blocks to predecessors to values which are live on a particular incoming edge." } ;
@ -92,6 +97,11 @@ $nl
expire-old-intervals
remove-pending
}
"Spilling & reloading:"
{ $subsections
insert-reload
insert-spill
}
"Vreg transformations:"
{ $subsections
vreg>reg

View File

@ -1,6 +1,6 @@
USING: compiler.cfg compiler.cfg.def-use compiler.cfg.instructions
compiler.cfg.linear-scan.allocation help.markup help.syntax kernel
math sequences ;
compiler.cfg.linear-scan.allocation cpu.architecture help.markup
help.syntax kernel math sequences ;
IN: compiler.cfg.linear-scan.live-intervals
HELP: <live-interval>
@ -32,6 +32,13 @@ HELP: compute-live-intervals
{ $description "Computes the live intervals and sync points of a cfg." }
{ $notes "The instructions must be numbered." } ;
HELP: (find-use)
{ $values
{ "insn#" integer }
{ "live-interval" live-interval-state }
{ "vreg-use" vreg-use }
} { $description "Finds the last use of the live interval before the instruction point." } ;
HELP: find-use
{ $values
{ "insn#" integer }
@ -77,7 +84,7 @@ HELP: live-interval-state
}
{
{ $slot "spill-rep" }
{ "Representation the vreg will have when it is spilled." }
{ { $link representation } " the vreg will have when it is spilled." }
}
{
{ $slot "spill-to" }
@ -95,12 +102,16 @@ HELP: live-interval-state
{ $notes "The " { $slot "uses" } " and " { $slot "ranges" } " will never be empty because then the interval would be unused." } ;
HELP: live-intervals
{ $var-description "Mapping from vreg to " { $link live-interval-state } "." } ;
{ $var-description "Mapping from vreg to " { $link live-interval-state } ". The data is computed in the " { $link cfg>live-intervals } " word." } ;
HELP: record-def
{ $values { "vreg" integer } { "n" integer } { "spill-slot?" boolean } }
{ $description "Records that the 'vreg' is defined at the instruction numbered 'n'." } ;
HELP: record-use
{ $values { "vreg" integer } { "n" integer } { "spill-slot?" boolean } }
{ $description "Records that the virtual register was used at the given instruction point." } ;
HELP: record-temp
{ $values { "vreg" number } { "n" number } }
{ $description "Assigns the interval [n,n] to vreg:s live interval." } ;
@ -121,11 +132,18 @@ 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." } ;
HELP: vreg-use
{ $class-description "Models a usage at an instruction point in the CFG of a virtual register." } ;
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 }
{ $subsections
<live-interval>
live-interval-state
vreg-use
}
"Recording liveness info:"
{ $subsections
compute-live-intervals*
@ -139,6 +157,12 @@ $nl
clobber-insn
hairy-clobber-insn
insn>sync-point
}
"Dynamic variables:"
{ $subsections
from
live-intervals
to
} ;

View File

@ -19,7 +19,12 @@ HELP: next-vreg-rep
HELP: rep-of
{ $values { "vreg" number } { "rep" representation } }
{ $description "Gets the representation for a virtual register. This word cannot be called before representation selection has run; use any-rep for " { $link ##copy } " instructions and so on." }
{ $notes "Throws " { $link bad-vreg } " if the representation for the vreg isn't known." } ;
{ $notes
{ $list
{ "Throws " { $link bad-vreg } " if the representation for the vreg isn't known." }
"A virtual register can change representation during its lifetime so this word can't always be used."
}
} ;
HELP: representations
{ $var-description "Mapping from vregs to their representations. This data is set by the "
@ -34,6 +39,9 @@ HELP: vreg-counter
{ $var-description "Virtual registers, used by CFG and machine IRs, are just integers." } ;
ARTICLE: "compiler.cfg.registers" "Virtual single-assignment registers"
"Virtual register assignment." ;
"Virtual register assignment."
$nl
"Getting and setting representations:"
{ $subsections rep-of set-rep-of } ;
ABOUT: "compiler.cfg.registers"

View File

@ -1,9 +1,17 @@
USING: cpu.architecture help.markup help.syntax ;
USING: compiler.cfg compiler.cfg.registers cpu.architecture
help.markup help.syntax ;
IN: compiler.cfg.representations
HELP: select-representations
{ $values { "cfg" cfg } }
{ $description "Entry point for the representation selection compiler pass. After this word hasn run, the " { $link representations } " hashtable has been filled with vregs and what their preferred representations are." } ;
ARTICLE: "compiler.cfg.representations" "Virtual register representation selection"
"Virtual register representation selection. This is where decisions about integer tagging and float and vector boxing are made. The appropriate conversion operations inserted after a cost analysis."
$nl
"Good representation selection is very important for Factor because it uses tagged pointers. If the best representations are selected, then the number of conversions between " { $link int-rep } " and " { $link tagged-rep } " is minimized." ;
"Good representation selection is very important for Factor because it uses tagged pointers. If the best representations are selected, then the number of conversions between " { $link int-rep } " and " { $link tagged-rep } " is minimized."
$nl
"Entry point:"
{ $subsections select-representations } ;
ABOUT: "compiler.cfg.representations"