x86-64: Better printing of FS: prefix
[sbcl.git] / src / compiler / vop.lisp
blob3b7b70ef15f3560486377422b2f0893adddb62ea
1 ;;;; structures for the second (virtual machine) intermediate
2 ;;;; representation in the compiler, IR2
4 ;;;; This software is part of the SBCL system. See the README file for
5 ;;;; more information.
6 ;;;;
7 ;;;; This software is derived from the CMU CL system, which was
8 ;;;; written at Carnegie Mellon University and released into the
9 ;;;; public domain. The software is in the public domain and is
10 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
11 ;;;; files for more information.
13 (in-package "SB!C")
15 ;;; the largest number of TNs whose liveness changes that we can have
16 ;;; in any block
17 (defconstant local-tn-limit 64)
19 (deftype local-tn-number () `(integer 0 (,local-tn-limit)))
20 (deftype local-tn-count () `(integer 0 ,local-tn-limit))
21 (deftype local-tn-vector () `(simple-vector ,local-tn-limit))
22 (deftype local-tn-bit-vector () `(simple-bit-vector ,local-tn-limit))
24 ;;; type of an SC number
25 (deftype sc-number () `(integer 0 (,sc-number-limit)))
27 ;;; types for vectors indexed by SC numbers
28 (deftype sc-vector () `(simple-vector ,sc-number-limit))
29 (deftype sc-bit-vector () `(simple-bit-vector ,sc-number-limit))
31 (deftype sc-locations ()
32 '(simple-array sc-offset 1))
33 (declaim (inline make-sc-locations))
34 (defun make-sc-locations (locations)
35 (make-array (length locations)
36 :element-type 'sc-offset
37 :initial-contents locations))
39 ;;; the different policies we can use to determine the coding strategy
40 (deftype ltn-policy ()
41 '(member :safe :small :fast :fast-safe))
43 ;;;; PRIMITIVE-TYPEs
45 ;;; A PRIMITIVE-TYPE is used to represent the aspects of type
46 ;;; interesting to the VM. Selection of IR2 translation templates is
47 ;;; done on the basis of the primitive types of the operands, and the
48 ;;; primitive type of a value is used to constrain the possible
49 ;;; representations of that value.
50 (defstruct (primitive-type (:copier nil))
51 ;; the name of this PRIMITIVE-TYPE
52 (name nil :type symbol :read-only t)
53 ;; a list of the SC numbers for all the SCs that a TN of this type
54 ;; can be allocated in
55 (scs nil :type list :read-only t)
56 ;; the Lisp type equivalent to this type. If this type could never be
57 ;; returned by PRIMITIVE-TYPE, then this is the NIL (or empty) type.
58 ;; TYPE-SPECIFIER is too general - this doesn't allow CLASS/CLASSOID.
59 (specifier (missing-arg) :type (or symbol list) :read-only t))
61 (defprinter (primitive-type)
62 name)
64 ;;;; IR1 annotations used for IR2 conversion
66 ;;; BLOCK-INFO
67 ;;; Holds the IR2-BLOCK structure. If there are overflow blocks,
68 ;;; then this points to the first IR2-BLOCK. The BLOCK-INFO of the
69 ;;; dummy component head and tail are dummy IR2 blocks that begin
70 ;;; and end the emission order thread.
71 ;;;
72 ;;; COMPONENT-INFO
73 ;;; Holds the IR2-COMPONENT structure.
74 ;;;
75 ;;; LVAR-INFO
76 ;;; Holds the IR2-LVAR structure. LVARs whose values aren't used
77 ;;; won't have any. XXX
78 ;;;
79 ;;; CLEANUP-INFO
80 ;;; If non-null, then a TN in which the affected dynamic
81 ;;; environment pointer should be saved after the binding is
82 ;;; instantiated.
83 ;;;
84 ;;; PHYSENV-INFO
85 ;;; Holds the IR2-PHYSENV structure.
86 ;;;
87 ;;; TAIL-SET-INFO
88 ;;; Holds the RETURN-INFO structure.
89 ;;;
90 ;;; NLX-INFO-INFO
91 ;;; Holds the IR2-NLX-INFO structure.
92 ;;;
93 ;;; LEAF-INFO
94 ;;; If a non-set lexical variable, the TN that holds the value in
95 ;;; the home environment. If a constant, then the corresponding
96 ;;; constant TN. If an XEP lambda, then the corresponding
97 ;;; Entry-Info structure.
98 ;;;
99 ;;; BASIC-COMBINATION-INFO
100 ;;; The template chosen by LTN, or
101 ;;; :FULL if this is definitely a full call.
102 ;;; :FUNNY if this is an oddball thing with IR2-convert.
103 ;;; :LOCAL if this is a local call.
105 ;;; NODE-TAIL-P
106 ;;; After LTN analysis, this is true only in combination nodes that are
107 ;;; truly tail recursive.
109 ;;; An IR2-BLOCK holds information about a block that is used during
110 ;;; and after IR2 conversion. It is stored in the BLOCK-INFO slot for
111 ;;; the associated block.
112 (defstruct (ir2-block (:include block-annotation)
113 (:constructor make-ir2-block (block))
114 (:copier nil))
115 ;; the IR2-BLOCK's number, which differs from BLOCK's BLOCK-NUMBER
116 ;; if any blocks are split. This is assigned by lifetime analysis.
117 (number nil :type (or index null))
118 ;; information about unknown-values LVARs that is used by stack
119 ;; analysis to do stack simulation. An UNKNOWN-VALUES LVAR is PUSHED
120 ;; if its DEST is in another block. Similarly, a LVAR is POPPED if
121 ;; its DEST is in this block but has its uses elsewhere. The LVARs
122 ;; are in the order that are pushed/popped in the block. Note that
123 ;; the args to a single MV-COMBINATION appear reversed in POPPED,
124 ;; since we must effectively pop the last argument first. All pops
125 ;; must come before all pushes (although internal MV uses may be
126 ;; interleaved.) POPPED is computed by LTN, and PUSHED is computed
127 ;; by stack analysis.
128 (pushed () :type list)
129 (popped () :type list)
130 ;; the result of stack analysis: lists of all the unknown-values
131 ;; LVARs on the stack at the block start and end, topmost LVAR
132 ;; first.
133 (start-stack () :type list)
134 (end-stack () :type list)
135 ;; the first and last VOP in this block. If there are none, both
136 ;; slots are null.
137 (start-vop nil :type (or vop null))
138 (last-vop nil :type (or vop null))
139 ;; the number of local TNs actually allocated
140 (local-tn-count 0 :type local-tn-count)
141 ;; a vector that maps local TN numbers to TNs. Some entries may be
142 ;; NIL, indicating that that number is unused. (This allows us to
143 ;; delete local conflict information without compressing the LTN
144 ;; numbers.)
146 ;; If an entry is :MORE, then this block contains only a single VOP.
147 ;; This VOP has so many more arguments and/or results that they
148 ;; cannot all be assigned distinct LTN numbers. In this case, we
149 ;; assign all the more args one LTN number, and all the more results
150 ;; another LTN number. We can do this, since more operands are
151 ;; referenced simultaneously as far as conflict analysis is
152 ;; concerned. Note that all these :MORE TNs will be global TNs.
153 (local-tns (make-array local-tn-limit) :type local-tn-vector)
154 ;; Bit-vectors used during lifetime analysis to keep track of
155 ;; references to local TNs. When indexed by the LTN number, the
156 ;; index for a TN is non-zero in WRITTEN if it is ever written in
157 ;; the block, and in LIVE-OUT if the first reference is a read.
158 (written (make-array local-tn-limit :element-type 'bit
159 :initial-element 0)
160 :type local-tn-bit-vector)
161 (live-out (make-array local-tn-limit :element-type 'bit)
162 :type local-tn-bit-vector)
163 ;; This is similar to the above, but is updated by lifetime flow
164 ;; analysis to have a 1 for LTN numbers of TNs live at the end of
165 ;; the block. This takes into account all TNs that aren't :LIVE.
166 (live-in (make-array local-tn-limit :element-type 'bit :initial-element 0)
167 :type local-tn-bit-vector)
168 ;; a thread running through the global-conflicts structures for this
169 ;; block, sorted by TN number
170 (global-tns nil :type (or global-conflicts null))
171 ;; the assembler label that points to the beginning of the code for
172 ;; this block, or NIL when we haven't assigned a label yet
173 (%label nil)
174 ;; the assembler label that points to the trampoline for this block,
175 ;; or NIL if unassigned yet. Only meaningful for local call targets.
176 (%trampoline-label nil)
177 ;; T if the preceding block assumes it can drop thru to %label
178 (dropped-thru-to nil)
179 ;; list of LOCATION-INFO structures describing all the interesting
180 ;; (to the debugger) locations in this block
181 (locations nil :type list))
183 (defprinter (ir2-block)
184 (pushed :test pushed)
185 (popped :test popped)
186 (start-vop :test start-vop)
187 (last-vop :test last-vop)
188 (local-tn-count :test (not (zerop local-tn-count)))
189 (%label :test %label))
191 ;;; An IR2-LVAR structure is used to annotate LVARs that are used as a
192 ;;; function result LVARs or that receive MVs.
193 (defstruct (ir2-lvar
194 (:constructor make-ir2-lvar (primitive-type))
195 (:copier nil))
196 ;; If this is :DELAYED, then this is a single value LVAR for which
197 ;; the evaluation of the use is to be postponed until the evaluation
198 ;; of destination. This can be done for ref nodes or predicates
199 ;; whose destination is an IF.
201 ;; If this is :FIXED, then this LVAR has a fixed number of values,
202 ;; with the TNs in LOCS.
204 ;; If this is :UNKNOWN, then this is an unknown-values LVAR, using
205 ;; the passing locations in LOCS.
207 ;; If this is :UNUSED, then this LVAR should never actually be used
208 ;; as the destination of a value: it is only used tail-recursively.
209 (kind :fixed :type (member :delayed :fixed :unknown :unused))
210 ;; The primitive-type of the first value of this LVAR. This is
211 ;; primarily for internal use during LTN, but it also records the
212 ;; type restriction on delayed references. In multiple-value
213 ;; contexts, this is null to indicate that it is meaningless. This
214 ;; is always (primitive-type (lvar-type cont)), which may be more
215 ;; restrictive than the tn-primitive-type of the value TN. This is
216 ;; becase the value TN must hold any possible type that could be
217 ;; computed (before type checking.) XXX
218 (primitive-type nil :type (or primitive-type null))
219 ;; Locations used to hold the values of the LVAR. If the number of
220 ;; values if fixed, then there is one TN per value. If the number of
221 ;; values is unknown, then this is a two-list of TNs holding the
222 ;; start of the values glob and the number of values. Note that
223 ;; since type checking is the responsibility of the values receiver,
224 ;; these TNs primitive type is only based on the proven type
225 ;; information.
226 (locs nil :type list)
227 (stack-pointer nil :type (or tn null)))
229 (defprinter (ir2-lvar)
230 kind
231 primitive-type
232 locs)
234 ;;; An IR2-COMPONENT serves mostly to accumulate non-code information
235 ;;; about the component being compiled.
236 (def!struct (ir2-component (:copier nil))
237 ;; the counter used to allocate global TN numbers
238 (global-tn-counter 0 :type index)
239 ;; NORMAL-TNS is the head of the list of all the normal TNs that
240 ;; need to be packed, linked through the Next slot. We place TNs on
241 ;; this list when we allocate them so that Pack can find them.
243 ;; RESTRICTED-TNS are TNs that must be packed within a finite SC. We
244 ;; pack these TNs first to ensure that the restrictions will be
245 ;; satisfied (if possible).
247 ;; WIRED-TNs are TNs that must be packed at a specific location. The
248 ;; SC and OFFSET are already filled in.
250 ;; CONSTANT-TNs are non-packed TNs that represent constants.
251 (normal-tns nil :type (or tn null))
252 (restricted-tns nil :type (or tn null))
253 (wired-tns nil :type (or tn null))
254 (constant-tns nil :type (or tn null))
255 ;; a list of all the :COMPONENT TNs (live throughout the component).
256 ;; These TNs will also appear in the {NORMAL,RESTRICTED,WIRED} TNs
257 ;; as appropriate to their location.
258 (component-tns () :type list)
259 ;; If this component has a NFP, then this is it.
260 (nfp nil :type (or tn null))
261 ;; a list of the explicitly specified save TNs (kind
262 ;; :SPECIFIED-SAVE). These TNs will also appear in the
263 ;; {NORMAL,RESTRICTED,WIRED} TNs as appropriate to their location.
264 (specified-save-tns () :type list)
265 ;; a list of all the blocks whose IR2-BLOCK has a non-null value for
266 ;; POPPED. This slot is initialized by LTN-ANALYZE as an input to
267 ;; STACK-ANALYZE.
268 (values-receivers nil :type list)
269 ;; an adjustable vector that records all the constants in the
270 ;; constant pool. A non-immediate :CONSTANT TN with offset 0 refers
271 ;; to the constant in element 0, etc. Normal constants are
272 ;; represented by the placing the CONSTANT leaf in this vector. A
273 ;; load-time constant is distinguished by being a cons (KIND .
274 ;; WHAT). KIND is a keyword indicating how the constant is computed,
275 ;; and WHAT is some context.
277 ;; These load-time constants are recognized:
279 ;; (:entry . <function>)
280 ;; Is replaced by the code pointer for the specified function.
281 ;; This is how compiled code (including DEFUN) gets its hands on
282 ;; a function. <function> is the XEP lambda for the called
283 ;; function; its LEAF-INFO should be an ENTRY-INFO structure.
285 ;; (:label . <label>)
286 ;; Is replaced with the byte offset of that label from the start
287 ;; of the code vector (including the header length.)
289 ;; A null entry in this vector is a placeholder for implementation
290 ;; overhead that is eventually stuffed in somehow.
291 (constants (make-array 10 :fill-pointer 0 :adjustable t) :type vector)
292 ;; some kind of info about the component's run-time representation.
293 ;; This is filled in by the VM supplied SELECT-COMPONENT-FORMAT function.
294 format
295 ;; a list of the ENTRY-INFO structures describing all of the entries
296 ;; into this component. Filled in by entry analysis.
297 (entries nil :type list)
298 ;; head of the list of :ALIAS TNs in this component, threaded by TN-NEXT
299 (alias-tns nil :type (or tn null))
300 ;; SPILLED-VOPS is a hashtable translating from "interesting" VOPs
301 ;; to a list of the TNs spilled at that VOP. This is used when
302 ;; computing debug info so that we don't consider the TN's value to
303 ;; be valid when it is in fact somewhere else. SPILLED-TNS has T for
304 ;; every "interesting" TN that is ever spilled, providing a
305 ;; representation that is more convenient some places.
306 (spilled-vops (make-hash-table :test 'eq) :type hash-table)
307 (spilled-tns (make-hash-table :test 'eq) :type hash-table)
308 ;; dynamic vop count info. This is needed by both ir2-convert and
309 ;; setup-dynamic-count-info. (But only if we are generating code to
310 ;; collect dynamic statistics.)
311 #!+sb-dyncount
312 (dyncount-info nil :type (or null dyncount-info)))
314 ;;; An ENTRY-INFO condenses all the information that the dumper needs
315 ;;; to create each XEP's function entry data structure. ENTRY-INFO
316 ;;; structures are sometimes created before they are initialized,
317 ;;; since IR2 conversion may need to compile a forward reference. In
318 ;;; this case the slots aren't actually initialized until entry
319 ;;; analysis runs.
320 (defstruct (entry-info (:copier nil))
321 ;; TN, containing closure (if needed) for this function in the home
322 ;; environment.
323 (closure-tn nil :type (or null tn))
324 ;; a label pointing to the entry vector for this function, or NIL
325 ;; before ENTRY-ANALYZE runs
326 (offset nil :type (or label null))
327 ;; If this function was defined using DEFUN, then this is the name
328 ;; of the function, a symbol or (SETF <symbol>). Otherwise, this is
329 ;; some string that is intended to be informative.
330 (name "<not computed>" :type (or simple-string list symbol))
331 ;; the argument list that the function was defined with.
332 (arguments nil :type list)
333 ;; a function type specifier representing the arguments and results
334 ;; of this function
335 (type 'function :type (or list (member function)))
336 ;; docstring and/or xref information for the XEP
337 (info nil :type (or null simple-vector string (cons string simple-vector))))
339 ;;; An IR2-PHYSENV is used to annotate non-LET LAMBDAs with their
340 ;;; passing locations. It is stored in the PHYSENV-INFO.
341 (defstruct (ir2-physenv (:copier nil))
342 ;; TN info for closed-over things within the function: an alist
343 ;; mapping from NLX-INFOs and LAMBDA-VARs to TNs holding the
344 ;; corresponding thing within this function
346 ;; Elements of this list have a one-to-one correspondence with
347 ;; elements of the PHYSENV-CLOSURE list of the PHYSENV object that
348 ;; links to us.
349 (closure (missing-arg) :type list :read-only t)
350 ;; the TNs that hold the OLD-FP and RETURN-PC within the function.
351 ;; We always save these so that the debugger can do a backtrace,
352 ;; even if the function has no return (and thus never uses them).
353 ;; Null only temporarily.
354 (old-fp nil :type (or tn null))
355 (return-pc nil :type (or tn null))
356 ;; The passing location for the RETURN-PC. The return PC is treated
357 ;; differently from the other arguments, since in some
358 ;; implementations we may use a call instruction that requires the
359 ;; return PC to be passed in a particular place.
360 (return-pc-pass (missing-arg) :type tn :read-only t)
361 ;; True if this function has a frame on the number stack. This is
362 ;; set by representation selection whenever it is possible that some
363 ;; function in our tail set will make use of the number stack.
364 (number-stack-p nil :type boolean)
365 ;; a list of all the :ENVIRONMENT TNs live in this environment
366 (live-tns nil :type list)
367 ;; a list of all the :DEBUG-ENVIRONMENT TNs live in this environment
368 (debug-live-tns nil :type list)
369 ;; a label that marks the start of elsewhere code for this function,
370 ;; or null until this label is assigned by codegen. Used for
371 ;; maintaining the debug source map.
372 (elsewhere-start nil :type (or label null))
373 ;; a label that marks the first location in this function at which
374 ;; the environment is properly initialized, i.e. arguments moved
375 ;; from their passing locations, etc. This is the start of the
376 ;; function as far as the debugger is concerned.
377 (environment-start nil :type (or label null))
378 (closure-save-tn nil :type (or tn null))
379 #!+unwind-to-frame-and-call-vop
380 (bsp-save-tn nil :type (or tn null)))
382 (defprinter (ir2-physenv)
383 closure
384 old-fp
385 return-pc
386 return-pc-pass
387 closure-save-tn)
389 ;;; A RETURN-INFO is used by GTN to represent the return strategy and
390 ;;; locations for all the functions in a given TAIL-SET. It is stored
391 ;;; in the TAIL-SET-INFO.
392 (defstruct (return-info (:copier nil))
393 ;; The return convention used:
394 ;; -- If :UNKNOWN, we use the standard return convention.
395 ;; -- If :FIXED, we use the known-values convention.
396 (kind (missing-arg) :type (member :fixed :unknown))
397 ;; the number of values returned, or :UNKNOWN if we don't know.
398 ;; COUNT may be known when KIND is :UNKNOWN, since we may choose the
399 ;; standard return convention for other reasons.
400 (count (missing-arg) :type (or index (member :unknown)))
401 ;; If count isn't :UNKNOWN, then this is a list of the
402 ;; primitive-types of each value.
403 (types () :type list)
404 ;; If kind is :FIXED, then this is the list of the TNs that we
405 ;; return the values in.
406 (locations () :type list))
407 (defprinter (return-info)
408 kind
409 count
410 types
411 locations)
413 (defstruct (ir2-nlx-info (:copier nil))
414 ;; If the kind is :ENTRY (a lexical exit), then in the home
415 ;; environment, this holds a VALUE-CELL object containing the unwind
416 ;; block pointer. In the other cases nobody directly references the
417 ;; unwind-block, so we leave this slot null.
418 (home nil :type (or tn null))
419 ;; the saved control stack pointer
420 (save-sp (missing-arg) :type tn)
421 ;; the list of dynamic state save TNs
422 (dynamic-state (list* (make-stack-pointer-tn)
423 (make-dynamic-state-tns))
424 :type list)
425 ;; the target label for NLX entry
426 (target (gen-label) :type label))
427 (defprinter (ir2-nlx-info)
428 home
429 save-sp
430 dynamic-state)
432 ;;;; VOPs and templates
434 ;;; A VOP is a Virtual Operation. It represents an operation and the
435 ;;; operands to the operation.
436 (def!struct (vop (:constructor make-vop (block node info args results))
437 (:copier nil))
438 ;; VOP-INFO structure containing static info about the operation
439 (info nil :type (or vop-info null))
440 ;; the IR2-BLOCK this VOP is in
441 (block (missing-arg) :type ir2-block)
442 ;; VOPs evaluated after and before this one. Null at the
443 ;; beginning/end of the block, and temporarily during IR2
444 ;; translation.
445 (next nil :type (or vop null))
446 (prev nil :type (or vop null))
447 ;; heads of the TN-REF lists for operand TNs, linked using the
448 ;; ACROSS slot
449 (args nil :type (or tn-ref null))
450 (results nil :type (or tn-ref null))
451 ;; head of the list of write refs for each explicitly allocated
452 ;; temporary, linked together using the ACROSS slot
453 (temps nil :type (or tn-ref null))
454 ;; head of the list of all TN-REFs for references in this VOP,
455 ;; linked by the NEXT-REF slot. There will be one entry for each
456 ;; operand and two (a read and a write) for each temporary.
457 (refs nil :type (or tn-ref null))
458 ;; stuff that is passed uninterpreted from IR2 conversion to
459 ;; codegen. The meaning of this slot is totally dependent on the VOP.
460 codegen-info
461 ;; the node that generated this VOP, for keeping track of debug info
462 (node nil :type (or node null))
463 ;; LOCAL-TN-BIT-VECTOR representing the set of TNs live after args
464 ;; are read and before results are written. This is only filled in
465 ;; when VOP-INFO-SAVE-P is non-null.
466 (save-set nil :type (or local-tn-bit-vector null)))
468 ;;; A TN-REF object contains information about a particular reference
469 ;;; to a TN. The information in TN-REFs largely determines how TNs are
470 ;;; packed.
471 (def!struct (tn-ref (:constructor make-tn-ref (tn write-p))
472 (:copier nil))
473 ;; the TN referenced
474 (tn (missing-arg) :type tn)
475 ;; Is this is a write reference? (as opposed to a read reference)
476 (write-p nil :type boolean)
477 ;; the link for a list running through all TN-REFs for this TN of
478 ;; the same kind (read or write)
479 (next nil :type (or tn-ref null))
480 ;; the VOP where the reference happens, or NIL temporarily
481 (vop nil :type (or vop null))
482 ;; the link for a list of all TN-REFs in VOP, in reverse order of
483 ;; reference
484 (next-ref nil :type (or tn-ref null))
485 ;; the link for a list of the TN-REFs in VOP of the same kind
486 ;; (argument, result, temp)
487 (across nil :type (or tn-ref null))
488 ;; If true, this is a TN-REF also in VOP whose TN we would like
489 ;; packed in the same location as our TN. Read and write refs are
490 ;; always paired: TARGET in the read points to the write, and
491 ;; vice-versa.
492 (target nil :type (or null tn-ref))
493 ;; the load TN allocated for this operand, if any
494 (load-tn nil :type (or tn null)))
496 ;;; A TEMPLATE object represents a particular IR2 coding strategy for
497 ;;; a known function.
498 (def!struct (template (:constructor nil)
499 (:copier nil)
500 #-sb-xc-host (:pure t))
501 ;; the symbol name of this VOP. This is used when printing the VOP
502 ;; and is also used to provide a handle for definition and
503 ;; translation.
504 (name nil :type symbol)
505 ;; the arg/result type restrictions. We compute this from the
506 ;; PRIMITIVE-TYPE restrictions to make life easier for IR1 phases
507 ;; that need to anticipate LTN's template selection.
508 (type (missing-arg) :type ctype)
509 ;; lists of restrictions on the argument and result types. A
510 ;; restriction may take several forms:
511 ;; -- The restriction * is no restriction at all.
512 ;; -- A restriction (:OR <primitive-type>*) means that the operand
513 ;; must have one of the specified primitive types.
514 ;; -- A restriction (:CONSTANT <predicate> <type-spec>) means that the
515 ;; argument (not a result) must be a compile-time constant that
516 ;; satisfies the specified predicate function. In this case, the
517 ;; constant value will be passed as an info argument rather than
518 ;; as a normal argument. <type-spec> is a Lisp type specifier for
519 ;; the type tested by the predicate, used when we want to represent
520 ;; the type constraint as a Lisp function type.
522 ;; If RESULT-TYPES is :CONDITIONAL, then this is an IF-FOO style
523 ;; conditional that yields its result as a control transfer. The
524 ;; emit function takes two info arguments: the target label and a
525 ;; boolean flag indicating whether to negate the sense of the test.
527 ;; If RESULT-TYPES is a cons whose car is :CONDITIONAL, then this is
528 ;; a flag-setting VOP. The rest is a list of condition descriptors to
529 ;; be interpreted by the BRANCH-IF VOP (see $ARCH/pred.lisp).
530 (arg-types nil :type list)
531 (result-types nil :type (or list (member :conditional) (cons (eql :conditional))))
532 ;; the primitive type restriction applied to each extra argument or
533 ;; result following the fixed operands. If NIL, no extra
534 ;; args/results are allowed. Otherwise, either * or a (:OR ...) list
535 ;; as described for the {ARG,RESULT}-TYPES.
536 (more-args-type nil :type (or (member nil *) cons))
537 (more-results-type nil :type (or (member nil *) cons))
538 ;; If true, this is a function that is called with no arguments to
539 ;; see whether this template can be emitted. This is used to
540 ;; conditionally compile for different target hardware
541 ;; configuarations (e.g. FP hardware.)
542 (guard nil :type (or function null))
543 ;; the policy under which this template is the best translation.
544 ;; Note that LTN might use this template under other policies if it
545 ;; can't figure out anything better to do.
546 (ltn-policy (missing-arg) :type ltn-policy)
547 ;; the base cost for this template, given optimistic assumptions
548 ;; such as no operand loading, etc.
549 (cost (missing-arg) :type index)
550 ;; If true, then this is a short noun-like phrase describing what
551 ;; this VOP "does", i.e. the implementation strategy. This is for
552 ;; use in efficiency notes.
553 (note nil :type (or string null))
554 ;; the number of trailing arguments to VOP or %PRIMITIVE that we
555 ;; bundle into a list and pass into the emit function. This provides
556 ;; a way to pass uninterpreted stuff directly to the code generator.
557 (info-arg-count 0 :type index))
558 (defprinter (template)
559 name
560 arg-types
561 result-types
562 (more-args-type :test more-args-type :prin1 more-args-type)
563 (more-results-type :test more-results-type :prin1 more-results-type)
564 ltn-policy
565 cost
566 (note :test note)
567 (info-arg-count :test (not (zerop info-arg-count))))
569 ;;; A VOP-INFO object holds the constant information for a given
570 ;;; virtual operation. We include TEMPLATE so that functions with a
571 ;;; direct VOP equivalent can be translated easily.
572 (def!struct (vop-info (:include template) (:copier nil))
573 ;; If true, causes special casing of TNs live after this VOP that
574 ;; aren't results:
575 ;; -- If T, all such TNs that are allocated in a SC with a defined
576 ;; save-sc will be saved in a TN in the save SC before the VOP
577 ;; and restored after the VOP. This is used by call VOPs. A bit
578 ;; vector representing the live TNs is stored in the VOP-SAVE-SET.
579 ;; -- If :FORCE-TO-STACK, all such TNs will made into :ENVIRONMENT TNs
580 ;; and forced to be allocated in SCs without any save-sc. This is
581 ;; used by NLX entry vops.
582 ;; -- If :COMPUTE-ONLY, just compute the save set, don't do any saving.
583 ;; This is used to get the live variables for debug info.
584 (save-p nil :type (member t nil :force-to-stack :compute-only))
585 ;; info for automatic emission of move-arg VOPs by representation
586 ;; selection. If NIL, then do nothing special. If non-null, then
587 ;; there must be a more arg. Each more arg is moved to its passing
588 ;; location using the appropriate representation-specific MOVE-ARG
589 ;; VOP. The first (fixed) argument must be the control-stack frame
590 ;; pointer for the frame to move into. The first info arg is the
591 ;; list of passing locations.
593 ;; Additional constraints depend on the value:
595 ;; :FULL-CALL
596 ;; None.
598 ;; :LOCAL-CALL
599 ;; The second (fixed) arg is the NFP for the called function (from
600 ;; ALLOCATE-FRAME.)
602 ;; :KNOWN-RETURN
603 ;; If needed, the old NFP is computed using COMPUTE-OLD-NFP.
604 (move-args nil :type (member nil :full-call :local-call :known-return))
605 ;; a list of sc-vectors representing the loading costs of each fixed
606 ;; argument and result
607 (arg-costs nil :type list)
608 (result-costs nil :type list)
609 ;; if true, SC-VECTORs representing the loading costs for any more
610 ;; args and results
611 (more-arg-costs nil :type (or sc-vector null))
612 (more-result-costs nil :type (or sc-vector null))
613 ;; lists of SC-VECTORs mapping each SC to the SCs that we can load
614 ;; into. If a SC is directly acceptable to the VOP, then the entry
615 ;; is T. Otherwise, it is a list of the SC numbers of all the SCs
616 ;; that we can load into. This list will be empty if there is no
617 ;; load function which loads from that SC to an SC allowed by the
618 ;; operand SC restriction.
619 (arg-load-scs nil :type list)
620 (result-load-scs nil :type list)
621 ;; a function that emits assembly code for a use of this VOP when it
622 ;; is called with the VOP structure. This is null if this VOP has no
623 ;; specified generator (i.e. if it exists only to be inherited by
624 ;; other VOPs).
625 (generator-function nil :type (or function null))
626 ;; a list of things that are used to parameterize an inherited
627 ;; generator. This allows the same generator function to be used for
628 ;; a group of VOPs with similar implementations.
629 (variant nil :type list)
630 ;; the number of arguments and results. Each regular arg/result
631 ;; counts as one, and all the more args/results together count as 1.
632 (num-args 0 :type index)
633 (num-results 0 :type index)
634 ;; a vector of the temporaries the vop needs. See EMIT-VOP
635 ;; in vmdef for information on how the temps are encoded.
636 (temps nil :type (or null (simple-array (unsigned-byte 16) 1)))
637 ;; the order all the refs for this vop should be put in. Each
638 ;; operand is assigned a number in the following ordering: args,
639 ;; more-args, results, more-results, temps. This vector represents
640 ;; the order the operands should be put into in the next-ref link.
641 (ref-ordering nil :type (or null (simple-array (unsigned-byte 8) 1)))
642 ;; a vector of the various targets that should be done. Each element
643 ;; encodes the source ref (shifted 8, it is also encoded in
644 ;; MAX-VOP-TN-REFS) and the dest ref index.
645 (targets nil :type (or null (simple-array (unsigned-byte 16) 1))))
646 (!set-load-form-method vop-info (:xc :target) :ignore-it)
648 ;; These printers follow the definition of VOP-INFO because they
649 ;; want to inline VOP-INFO-NAME, and it's less code to move them here
650 ;; than to move the defstructs of VOP-INFO and TEMPLATE.
651 (defprinter (vop)
652 (info :prin1 (vop-info-name info))
653 args
654 results
655 (codegen-info :test codegen-info))
656 (defprinter (tn-ref)
658 write-p
659 (vop :test vop :prin1 (vop-info-name (vop-info vop))))
662 ;;;; SBs and SCs
664 ;;; copied from docs/internals/retargeting.tex by WHN 19990707:
666 ;;; A Storage Base represents a physical storage resource such as a
667 ;;; register set or stack frame. Storage bases for non-global
668 ;;; resources such as the stack are relativized by the environment
669 ;;; that the TN is allocated in. Packing conflict information is kept
670 ;;; in the storage base, but non-packed storage resources such as
671 ;;; closure environments also have storage bases.
673 ;;; Some storage bases:
674 ;;; General purpose registers
675 ;;; Floating point registers
676 ;;; Boxed (control) stack environment
677 ;;; Unboxed (number) stack environment
678 ;;; Closure environment
680 ;;; A storage class is a potentially arbitrary set of the elements in
681 ;;; a storage base. Although conceptually there may be a hierarchy of
682 ;;; storage classes such as "all registers", "boxed registers", "boxed
683 ;;; scratch registers", this doesn't exist at the implementation
684 ;;; level. Such things can be done by specifying storage classes whose
685 ;;; locations overlap. A TN shouldn't have lots of overlapping SC's as
686 ;;; legal SC's, since time would be wasted repeatedly attempting to
687 ;;; pack in the same locations.
689 ;;; ...
691 ;;; Some SCs:
692 ;;; Reg: any register (immediate objects)
693 ;;; Save-Reg: a boxed register near r15 (registers easily saved in a call)
694 ;;; Boxed-Reg: any boxed register (any boxed object)
695 ;;; Unboxed-Reg: any unboxed register (any unboxed object)
696 ;;; Float-Reg, Double-Float-Reg: float in FP register.
697 ;;; Stack: boxed object on the stack (on control stack)
698 ;;; Word: any 32bit unboxed object on nstack.
699 ;;; Double: any 64bit unboxed object on nstack.
701 ;;; The SB structure represents the global information associated with
702 ;;; a storage base.
703 (defstruct (sb (:copier nil))
704 ;; for indirecting access of read/write slots of this SB into an
705 ;; identically indexed SB object local to the particular compilation
706 (%index 0 :type (mod 8) :read-only t) ; arbitrary limit
707 ;; name, for printing and reference
708 (name nil :type symbol :read-only t)
709 ;; the kind of storage base (which determines the packing
710 ;; algorithm)
711 (kind :non-packed :type (member :finite :unbounded :non-packed) :read-only t)
712 ;; the number of elements in the SB. If finite, this is the total
713 ;; size. If unbounded, this is the size that the SB is initially
714 ;; allocated at.
715 (size 0 :type index :read-only t))
716 (defprinter (sb)
717 name)
719 ;;; A FINITE-SB holds information needed by the packing algorithm for
720 ;;; finite SBs.
721 (defstruct (finite-sb (:include sb) (:copier nil) (:conc-name fsb-))
722 ;; the minimum number of location by which to grow this SB
723 ;; if it is :unbounded
724 (size-increment 1 :type index :read-only t)
725 ;; current-size must always be a multiple of this. It is assumed
726 ;; to be a power of two.
727 (size-alignment 1 :type index :read-only t)
728 ;; the number of locations currently allocated in this SB
729 (current-size 0 :type index)
730 ;; the last location packed in, used by pack to scatter TNs to
731 ;; prevent a few locations from getting all the TNs, and thus
732 ;; getting overcrowded, reducing the possibilities for targeting.
733 (last-offset 0 :type index)
734 ;; a vector containing, for each location in this SB, a vector
735 ;; indexed by IR2 block numbers, holding local conflict bit vectors.
736 ;; A TN must not be packed in a given location within a particular
737 ;; block if the LTN number for that TN in that block corresponds to
738 ;; a set bit in the bit-vector.
739 (conflicts '#() :type simple-vector)
740 ;; a vector containing, for each location in this SB, a bit-vector
741 ;; indexed by IR2 block numbers. If the bit corresponding to a block
742 ;; is set, then the location is in use somewhere in the block, and
743 ;; thus has a conflict for always-live TNs.
744 (always-live '#() :type simple-vector)
745 (always-live-count '#() :type simple-vector)
746 ;; a vector containing the TN currently live in each location in the
747 ;; SB, or NIL if the location is unused. This is used during load-tn pack.
748 (live-tns '#() :type simple-vector)
749 ;; the number of blocks for which the ALWAYS-LIVE and CONFLICTS
750 ;; might not be virgin, and thus must be reinitialized when PACK
751 ;; starts. Less then the length of those vectors when not all of the
752 ;; length was used on the previously packed component.
753 (last-block-count 0 :type index))
754 (proclaim '(freeze-type sb finite-sb))
756 ;;; During make-host-1 the length of *FINITE-SBS* is unknown.
757 #+sb-xc-host
758 (defmacro finite-sb-index (sb) `(fsb-%index ,sb))
759 ;;; The target compiler can be more efficient by eliding the bounds check.
760 #-sb-xc-host
761 (defmacro finite-sb-index (sb)
762 ;; Using #. instead of ",(length *backend-sbs*)" because the cross-compiler
763 ;; has not seen *BACKEND-SBS* yet, but the host compiler has!
764 `(truly-the (mod #.(length *backend-sbs*)) (fsb-%index ,sb)))
766 ;;; Give this a toplevel value so that it can be declaimed ALWAYS-BOUND.
767 ;;; The compiler will never look at the toplevel value though.
768 (defvar *finite-sbs* #-sb-xc-host (make-array #.(length *backend-sbs*)))
769 #-sb-xc-host (declaim (type (simple-vector #.(length *backend-sbs*))
770 *finite-sbs*)
771 (always-bound *finite-sbs*))
772 ;;; These two are not SETFable
773 (declaim (inline finite-sb-size-increment finite-sb-size-alignment))
774 (defun finite-sb-size-increment (sb) (fsb-size-increment sb))
775 (defun finite-sb-size-alignment (sb) (fsb-size-alignment sb))
776 ;;; All these are SETFable
777 (defmacro finite-sb-current-size (sb)
778 `(fsb-current-size (svref *finite-sbs* (finite-sb-index ,sb))))
779 (defmacro finite-sb-last-offset (sb)
780 `(fsb-last-offset (svref *finite-sbs* (finite-sb-index ,sb))))
781 (defmacro finite-sb-conflicts (sb)
782 `(fsb-conflicts (svref *finite-sbs* (finite-sb-index ,sb))))
783 (defmacro finite-sb-always-live (sb)
784 `(fsb-always-live (svref *finite-sbs* (finite-sb-index ,sb))))
785 (defmacro finite-sb-always-live-count (sb)
786 `(fsb-always-live-count (svref *finite-sbs* (finite-sb-index ,sb))))
787 (defmacro finite-sb-live-tns (sb)
788 `(fsb-live-tns (svref *finite-sbs* (finite-sb-index ,sb))))
789 (defmacro finite-sb-last-block-count (sb)
790 `(fsb-last-block-count (svref *finite-sbs* (finite-sb-index ,sb))))
792 ;;; the SC structure holds the storage base that storage is allocated
793 ;;; in and information used to select locations within the SB
794 (def!struct (sc (:copier nil))
795 ;; name, for printing and reference
796 (name nil :type symbol)
797 ;; the number used to index SC cost vectors
798 (number 0 :type sc-number)
799 ;; the storage base that this SC allocates storage from
800 (sb nil :type (or sb null))
801 ;; the size of elements in this SC, in units of locations in the SB
802 (element-size 0 :type index)
803 ;; if our SB is finite, a vector of the locations in this SC
804 (locations (missing-arg) :type sc-locations :read-only t)
805 ;; a list of the alternate (save) SCs for this SC
806 (alternate-scs nil :type list)
807 ;; a list of the constant SCs that can me moved into this SC
808 (constant-scs nil :type list)
809 ;; true if the values in this SC needs to be saved across calls
810 (save-p nil :type boolean)
811 ;; vectors mapping from SC numbers to information about how to load
812 ;; from the index SC to this one. MOVE-FUNS holds the names of
813 ;; the functions used to do loading, and LOAD-COSTS holds the cost
814 ;; of the corresponding move functions. If loading is impossible,
815 ;; then the entries are NIL. LOAD-COSTS is initialized to have a 0
816 ;; for this SC.
817 (move-funs (make-array sc-number-limit :initial-element nil)
818 :type sc-vector)
819 (load-costs (make-array sc-number-limit :initial-element nil)
820 :type sc-vector)
821 ;; a vector mapping from SC numbers to possibly
822 ;; representation-specific move and coerce VOPs. Each entry is a
823 ;; list of VOP-INFOs for VOPs that move/coerce an object in the
824 ;; index SC's representation into this SC's representation. This
825 ;; vector is filled out with entries for all SCs that can somehow be
826 ;; coerced into this SC, not just those VOPs defined to directly
827 ;; move into this SC (i.e. it allows for operand loading on the move
828 ;; VOP's operands.)
830 ;; When there are multiple applicable VOPs, the template arg and
831 ;; result type restrictions are used to determine which one to use.
832 ;; The list is sorted by increasing cost, so the first applicable
833 ;; VOP should be used.
835 ;; Move (or move-arg) VOPs with descriptor results shouldn't have
836 ;; TNs wired in the standard argument registers, since there may
837 ;; already be live TNs wired in those locations holding the values
838 ;; that we are setting up for unknown-values return.
839 (move-vops (make-array sc-number-limit :initial-element nil)
840 :type sc-vector)
841 ;; the costs corresponding to the MOVE-VOPS. Separate because this
842 ;; info is needed at meta-compile time, while the MOVE-VOPs don't
843 ;; exist till load time. If no move is defined, then the entry is
844 ;; NIL.
845 (move-costs (make-array sc-number-limit :initial-element nil)
846 :type sc-vector)
847 ;; similar to Move-VOPs, except that we only ever use the entries
848 ;; for this SC and its alternates, since we never combine complex
849 ;; representation conversion with argument passing.
850 (move-arg-vops (make-array sc-number-limit :initial-element nil)
851 :type sc-vector)
852 ;; true if this SC or one of its alternates in in the NUMBER-STACK SB.
853 (number-stack-p nil :type boolean)
854 ;; alignment restriction. The offset must be an even multiple of this.
855 ;; this must be a power of two.
856 (alignment 1 :type (and index (integer 1)))
857 ;; a vector of locations that we avoid packing in during normal
858 ;; register allocation to ensure that these locations will be free
859 ;; for operand loading. This prevents load-TN packing from thrashing
860 ;; by spilling a lot.
861 (reserve-locations (missing-arg) :type sc-locations :read-only t))
862 (defprinter (sc)
863 name)
865 ;;;; TNs
867 (def!struct (tn (:include sset-element)
868 (:constructor make-random-tn)
869 (:constructor make-tn (number kind primitive-type sc))
870 (:copier nil))
871 ;; The kind of TN this is:
873 ;; :NORMAL
874 ;; A normal, non-constant TN, representing a variable or temporary.
875 ;; Lifetime information is computed so that packing can be done.
877 ;; :ENVIRONMENT
878 ;; A TN that has hidden references (debugger or NLX), and thus must be
879 ;; allocated for the duration of the environment it is referenced in.
881 ;; :DEBUG-ENVIRONMENT
882 ;; Like :ENVIRONMENT, but is used for TNs that we want to be able to
883 ;; target to/from and that don't absolutely have to be live
884 ;; everywhere. These TNs are live in all blocks in the environment
885 ;; that don't reference this TN.
887 ;; :COMPONENT
888 ;; A TN that implicitly conflicts with all other TNs. No conflict
889 ;; info is computed.
891 ;; :SAVE
892 ;; :SAVE-ONCE
893 ;; A TN used for saving a :NORMAL TN across function calls. The
894 ;; lifetime information slots are unitialized: get the original
895 ;; TN out of the SAVE-TN slot and use it for conflicts. SAVE-ONCE
896 ;; is like :SAVE, except that it is only save once at the single
897 ;; writer of the original TN.
899 ;; :SPECIFIED-SAVE
900 ;; A TN that was explicitly specified as the save TN for another TN.
901 ;; When we actually get around to doing the saving, this will be
902 ;; changed to :SAVE or :SAVE-ONCE.
904 ;; :LOAD
905 ;; A load-TN used to compute an argument or result that is
906 ;; restricted to some finite SB. Load TNs don't have any conflict
907 ;; information. Load TN pack uses a special local conflict
908 ;; determination method.
910 ;; :CONSTANT
911 ;; Represents a constant, with TN-LEAF a CONSTANT leaf. Lifetime
912 ;; information isn't computed, since the value isn't allocated by
913 ;; pack, but is instead generated as a load at each use. Since
914 ;; lifetime analysis isn't done on :CONSTANT TNs, they don't have
915 ;; LOCAL-NUMBERs and similar stuff.
917 ;; :ALIAS
918 ;; A special kind of TN used to represent initialization of local
919 ;; call arguments in the caller. It provides another name for the
920 ;; argument TN so that lifetime analysis doesn't get confused by
921 ;; self-recursive calls. Lifetime analysis treats this the same
922 ;; as :NORMAL, but then at the end merges the conflict info into
923 ;; the original TN and replaces all uses of the alias with the
924 ;; original TN. SAVE-TN holds the aliased TN.
925 ;; :UNUSED
926 ;; Unused result
927 (kind (missing-arg)
928 :type (member :normal :environment :debug-environment
929 :save :save-once :load :constant
930 :component :alias :unused
931 #!-fp-and-pc-standard-save :specified-save))
932 ;; the primitive-type for this TN's value. Null in restricted or
933 ;; wired TNs.
934 (primitive-type nil :type (or primitive-type null))
935 ;; If this TN represents a variable or constant, then this is the
936 ;; corresponding LEAF.
937 (leaf nil :type (or leaf null))
938 ;; thread that links TNs together so that we can find them
939 (next nil :type (or tn null))
940 ;; head of TN-REF lists for reads and writes of this TN
941 (reads nil :type (or tn-ref null))
942 (writes nil :type (or tn-ref null))
943 ;; a link we use when building various temporary TN lists
944 (next* nil :type (or tn null))
945 ;; some block that contains a reference to this TN, or NIL if we
946 ;; haven't seen any reference yet. If the TN is local, then this is
947 ;; the block it is local to.
948 (local nil :type (or ir2-block null))
949 ;; If a local TN, the block relative number for this TN. Global TNs
950 ;; whose liveness changes within a block are also assigned a local
951 ;; number during the conflicts analysis of that block. If the TN has
952 ;; no local number within the block, then this is NIL.
953 (local-number nil :type (or local-tn-number null))
954 ;; If this object is a local TN, this slot is a bit-vector with 1
955 ;; for the local-number of every TN that we conflict with.
956 (local-conflicts (make-array local-tn-limit
957 :element-type 'bit
958 :initial-element 0)
959 :type local-tn-bit-vector)
960 ;; head of the list of GLOBAL-CONFLICTS structures for a global TN.
961 ;; This list is sorted by block number (i.e. reverse DFO), allowing
962 ;; the intersection between the lifetimes for two global TNs to be
963 ;; easily found. If null, then this TN is a local TN.
964 ;; KLUDGE: The defstructs for TN and GLOBAL-CONFLICTS are mutually
965 ;; referential, and absent a block-compilation feature, one or the other
966 ;; of the structures can't inline type checks for its referent.
967 ;; Stating this type as (OR NULL GLOBAL-CONFLICTS) instead of the reverse
968 ;; avoids a forward-reference that would crash cold-init.
969 ;; But since TYPEP short-circuits, the constructor is happy with NIL.
970 ;; [See the comments in LAYOUT-OF for further detail]
971 (global-conflicts nil :type (or null global-conflicts))
972 ;; During lifetime analysis, this is used as a pointer into the
973 ;; conflicts chain, for scanning through blocks in reverse DFO.
974 (current-conflict nil)
975 ;; In a :SAVE TN, this is the TN saved. In a :NORMAL or :ENVIRONMENT
976 ;; TN, this is the associated save TN. In TNs with no save TN, this
977 ;; is null.
978 (save-tn nil :type (or tn null))
979 ;; After pack, the SC we packed into. Beforehand, the SC we want to
980 ;; pack into, or null if we don't know.
981 (sc nil :type (or sc null))
982 ;; the offset within the SB that this TN is packed into. This is what
983 ;; indicates that the TN is packed
984 (offset nil :type (or index null))
985 ;; some kind of info about how important this TN is
986 (cost 0 :type fixnum)
987 ;; If a :ENVIRONMENT or :DEBUG-ENVIRONMENT TN, this is the
988 ;; physical environment that the TN is live throughout.
989 (physenv nil :type (or physenv null))
990 ;; The depth of the deepest loop that this TN is used in.
991 (loop-depth 0 :type fixnum))
992 (declaim (freeze-type tn))
993 (defmethod print-object ((tn tn) stream)
994 (cond ((not (boundp 'sb!c::*compiler-ir-obj-map*))
995 (print-unreadable-object (tn stream :type t :identity t)))
997 (print-unreadable-object (tn stream :type t)
998 ;; KLUDGE: The distinction between PRINT-TN and PRINT-OBJECT on TN is
999 ;; not very mnemonic. -- WHN 20000124
1000 (print-tn-guts tn stream)))))
1002 ;;; The GLOBAL-CONFLICTS structure represents the conflicts for global
1003 ;;; TNs. Each global TN has a list of these structures, one for each
1004 ;;; block that it is live in. In addition to representing the result of
1005 ;;; lifetime analysis, the global conflicts structure is used during
1006 ;;; lifetime analysis to represent the set of TNs live at the start of
1007 ;;; the IR2 block.
1008 (def!struct (global-conflicts
1009 (:constructor make-global-conflicts (kind tn block number))
1010 (:copier nil))
1011 ;; the IR2-BLOCK that this structure represents the conflicts for
1012 (block (missing-arg) :type ir2-block)
1013 ;; thread running through all the GLOBAL-CONFLICTSs for BLOCK. This
1014 ;; thread is sorted by TN number
1015 (next-blockwise nil :type (or global-conflicts null))
1016 ;; the way that TN is used by BLOCK
1018 ;; :READ
1019 ;; The TN is read before it is written. It starts the block live,
1020 ;; but is written within the block.
1022 ;; :WRITE
1023 ;; The TN is written before any read. It starts the block dead,
1024 ;; and need not have a read within the block.
1026 ;; :READ-ONLY
1027 ;; The TN is read, but never written. It starts the block live,
1028 ;; and is not killed by the block. Lifetime analysis will promote
1029 ;; :READ-ONLY TNs to :LIVE if they are live at the block end.
1031 ;; :LIVE
1032 ;; The TN is not referenced. It is live everywhere in the block.
1033 (kind :read-only :type (member :read :write :read-only :live))
1034 ;; a local conflicts vector representing conflicts with TNs live in
1035 ;; BLOCK. The index for the local TN number of each TN we conflict
1036 ;; with in this block is 1. To find the full conflict set, the :LIVE
1037 ;; TNs for BLOCK must also be included. This slot is not meaningful
1038 ;; when KIND is :LIVE.
1039 (conflicts (make-array local-tn-limit
1040 :element-type 'bit
1041 :initial-element 0)
1042 :type local-tn-bit-vector)
1043 ;; the TN we are recording conflicts for.
1044 (tn (missing-arg) :type tn)
1045 ;; thread through all the GLOBAL-CONFLICTSs for TN
1046 (next-tnwise nil :type (or global-conflicts null))
1047 ;; TN's local TN number in BLOCK. :LIVE TNs don't have local numbers.
1048 (number nil :type (or local-tn-number null)))
1049 (defprinter (global-conflicts)
1051 block
1052 kind
1053 (number :test number))