(in-package "SB!C")
-(file-comment
- "$Header$")
-
-(eval-when (:compile-toplevel :load-toplevel :execute)
- ;; the largest number of TNs whose liveness changes that we can have in any
- ;; block
- (defconstant local-tn-limit 64))
+;;; the largest number of TNs whose liveness changes that we can have
+;;; in any block
+(defconstant local-tn-limit 64)
(deftype local-tn-number () `(integer 0 (,local-tn-limit)))
(deftype local-tn-count () `(integer 0 ,local-tn-limit))
(deftype local-tn-vector () `(simple-vector ,local-tn-limit))
(deftype local-tn-bit-vector () `(simple-bit-vector ,local-tn-limit))
-;;; Type of an SC number.
+;;; type of an SC number
(deftype sc-number () `(integer 0 (,sc-number-limit)))
-;;; Types for vectors indexed by SC numbers.
+;;; types for vectors indexed by SC numbers
(deftype sc-vector () `(simple-vector ,sc-number-limit))
(deftype sc-bit-vector () `(simple-bit-vector ,sc-number-limit))
-;;; The different policies we can use to determine the coding strategy.
-(deftype policies ()
+;;; the different policies we can use to determine the coding strategy
+(deftype ltn-policy ()
'(member :safe :small :fast :fast-safe))
\f
;;;; PRIMITIVE-TYPEs
-;;; The primitive type is used to represent the aspects of type interesting
-;;; to the VM. Selection of IR2 translation templates is done on the basis of
-;;; the primitive types of the operands, and the primitive type of a value
-;;; is used to constrain the possible representations of that value.
-(defstruct primitive-type
- ;; The name of this primitive-type.
+;;; A PRIMITIVE-TYPE is used to represent the aspects of type
+;;; interesting to the VM. Selection of IR2 translation templates is
+;;; done on the basis of the primitive types of the operands, and the
+;;; primitive type of a value is used to constrain the possible
+;;; representations of that value.
+(defstruct (primitive-type (:copier nil))
+ ;; the name of this PRIMITIVE-TYPE
(name nil :type symbol)
- ;; A list the SC numbers for all the SCs that a TN of this type can be
- ;; allocated in.
+ ;; a list of the SC numbers for all the SCs that a TN of this type
+ ;; can be allocated in
(scs nil :type list)
- ;; The Lisp type equivalent to this type. If this type could never be
- ;; returned by Primitive-Type, then this is the NIL (or empty) type.
+ ;; the Lisp type equivalent to this type. If this type could never be
+ ;; returned by PRIMITIVE-TYPE, then this is the NIL (or empty) type
(type (required-argument) :type ctype)
- ;; The template used to check that an object is of this type. This is a
+ ;; the template used to check that an object is of this type. This is a
;; template of one argument and one result, both of primitive-type T. If
;; the argument is of the correct type, then it is delivered into the
;; result. If the type is incorrect, then an error is signalled.
;;;; IR1 annotations used for IR2 conversion
;;; Block-Info
-;;; Holds the IR2-Block structure. If there are overflow blocks, then this
-;;; points to the first IR2-Block. The Block-Info of the dummy component
-;;; head and tail are dummy IR2 blocks that begin and end the emission order
-;;; thread.
+;;; Holds the IR2-Block structure. If there are overflow blocks,
+;;; then this points to the first IR2-Block. The Block-Info of the
+;;; dummy component head and tail are dummy IR2 blocks that begin
+;;; and end the emission order thread.
;;;
;;; Component-Info
;;; Holds the IR2-Component structure.
;;;
;;; Continuation-Info
-;;; Holds the IR2-Continuation structure. Continuations whose values aren't
-;;; used won't have any.
+;;; Holds the IR2-Continuation structure. Continuations whose
+;;; values aren't used won't have any.
;;;
;;; Cleanup-Info
-;;; If non-null, then a TN in which the affected dynamic environment pointer
-;;; should be saved after the binding is instantiated.
+;;; If non-null, then a TN in which the affected dynamic
+;;; environment pointer should be saved after the binding is
+;;; instantiated.
;;;
;;; Environment-Info
;;; Holds the IR2-Environment structure.
;;; Holds the IR2-NLX-Info structure.
;;;
;;; Leaf-Info
-;;; If a non-set lexical variable, the TN that holds the value in the home
-;;; environment. If a constant, then the corresponding constant TN.
-;;; If an XEP lambda, then the corresponding Entry-Info structure.
+;;; If a non-set lexical variable, the TN that holds the value in
+;;; the home environment. If a constant, then the corresponding
+;;; constant TN. If an XEP lambda, then the corresponding
+;;; Entry-Info structure.
;;;
;;; Basic-Combination-Info
;;; The template chosen by LTN, or
;;; After LTN analysis, this is true only in combination nodes that are
;;; truly tail recursive.
-;;; The IR2-Block structure holds information about a block that is used during
-;;; and after IR2 conversion. It is stored in the Block-Info slot for the
-;;; associated block.
+;;; An IR2-BLOCK holds information about a block that is used during
+;;; and after IR2 conversion. It is stored in the BLOCK-INFO slot for
+;;; the associated block.
(defstruct (ir2-block (:include block-annotation)
- (:constructor make-ir2-block (block)))
- ;; The IR2-Block's number, which differs from Block's Block-Number if any
- ;; blocks are split. This is assigned by lifetime analysis.
+ (:constructor make-ir2-block (block))
+ (:copier nil))
+ ;; the IR2-Block's number, which differs from Block's Block-Number
+ ;; if any blocks are split. This is assigned by lifetime analysis.
(number nil :type (or index null))
- ;; Information about unknown-values continuations that is used by stack
- ;; analysis to do stack simulation. A unknown-values continuation is Pushed
- ;; if its Dest is in another block. Similarly, a continuation is Popped if
- ;; its Dest is in this block but has its uses elsewhere. The continuations
- ;; are in the order that are pushed/popped in the block. Note that the args
- ;; to a single MV-Combination appear reversed in Popped, since we must
- ;; effectively pop the last argument first. All pops must come before all
- ;; pushes (although internal MV uses may be interleaved.) Popped is computed
- ;; by LTN, and Pushed is computed by stack analysis.
+ ;; information about unknown-values continuations that is used by
+ ;; stack analysis to do stack simulation. An UNKNOWN-VALUES
+ ;; continuation is PUSHED if its DEST is in another block.
+ ;; Similarly, a continuation is POPPED if its DEST is in this block
+ ;; but has its uses elsewhere. The continuations are in the order
+ ;; that are pushed/popped in the block. Note that the args to a
+ ;; single MV-Combination appear reversed in POPPED, since we must
+ ;; effectively pop the last argument first. All pops must come
+ ;; before all pushes (although internal MV uses may be interleaved.)
+ ;; POPPED is computed by LTN, and PUSHED is computed by stack
+ ;; analysis.
(pushed () :type list)
(popped () :type list)
- ;; The result of stack analysis: lists of all the unknown-values
+ ;; the result of stack analysis: lists of all the unknown-values
;; continuations on the stack at the block start and end, topmost
;; continuation first.
(start-stack () :type list)
(end-stack () :type list)
- ;; The first and last VOP in this block. If there are none, both slots are
- ;; null.
+ ;; the first and last VOP in this block. If there are none, both
+ ;; slots are null.
(start-vop nil :type (or vop null))
(last-vop nil :type (or vop null))
- ;; Number of local TNs actually allocated.
+ ;; the number of local TNs actually allocated
(local-tn-count 0 :type local-tn-count)
- ;; A vector that maps local TN numbers to TNs. Some entries may be NIL,
- ;; indicating that that number is unused. (This allows us to delete local
- ;; conflict information without compressing the LTN numbers.)
- ;;
- ;; If an entry is :More, then this block contains only a single VOP. This
- ;; VOP has so many more arguments and/or results that they cannot all be
- ;; assigned distinct LTN numbers. In this case, we assign all the more args
- ;; one LTN number, and all the more results another LTN number. We can do
- ;; this, since more operands are referenced simultaneously as far as conflict
- ;; analysis is concerned. Note that all these :More TNs will be global TNs.
+ ;; a vector that maps local TN numbers to TNs. Some entries may be
+ ;; NIL, indicating that that number is unused. (This allows us to
+ ;; delete local conflict information without compressing the LTN
+ ;; numbers.)
+ ;;
+ ;; If an entry is :MORE, then this block contains only a single VOP.
+ ;; This VOP has so many more arguments and/or results that they
+ ;; cannot all be assigned distinct LTN numbers. In this case, we
+ ;; assign all the more args one LTN number, and all the more results
+ ;; another LTN number. We can do this, since more operands are
+ ;; referenced simultaneously as far as conflict analysis is
+ ;; concerned. Note that all these :More TNs will be global TNs.
(local-tns (make-array local-tn-limit) :type local-tn-vector)
- ;; Bit-vectors used during lifetime analysis to keep track of references to
- ;; local TNs. When indexed by the LTN number, the index for a TN is non-zero
- ;; in Written if it is ever written in the block, and in Live-Out if
- ;; the first reference is a read.
+ ;; Bit-vectors used during lifetime analysis to keep track of
+ ;; references to local TNs. When indexed by the LTN number, the
+ ;; index for a TN is non-zero in Written if it is ever written in
+ ;; the block, and in Live-Out if the first reference is a read.
(written (make-array local-tn-limit :element-type 'bit
:initial-element 0)
:type local-tn-bit-vector)
(live-out (make-array local-tn-limit :element-type 'bit)
:type local-tn-bit-vector)
- ;; Similar to the above, but is updated by lifetime flow analysis to have a 1
- ;; for LTN numbers of TNs live at the end of the block. This takes into
- ;; account all TNs that aren't :Live.
+ ;; This is similar to the above, but is updated by lifetime flow
+ ;; analysis to have a 1 for LTN numbers of TNs live at the end of
+ ;; the block. This takes into account all TNs that aren't :Live.
(live-in (make-array local-tn-limit :element-type 'bit
:initial-element 0)
:type local-tn-bit-vector)
- ;; A thread running through the global-conflicts structures for this block,
- ;; sorted by TN number.
+ ;; a thread running through the global-conflicts structures for this
+ ;; block, sorted by TN number
(global-tns nil :type (or global-conflicts null))
- ;; The assembler label that points to the beginning of the code for this
- ;; block. Null when we haven't assigned a label yet.
+ ;; the assembler label that points to the beginning of the code for
+ ;; this block, or NIL when we haven't assigned a label yet
(%label nil)
- ;; List of Location-Info structures describing all the interesting (to the
- ;; debugger) locations in this block.
+ ;; list of Location-Info structures describing all the interesting
+ ;; (to the debugger) locations in this block
(locations nil :type list))
(defprinter (ir2-block)
(local-tn-count :test (not (zerop local-tn-count)))
(%label :test %label))
-;;; The IR2-Continuation structure is used to annotate continuations that are
-;;; used as a function result continuation or that receive MVs.
+;;; An IR2-CONTINUATION structure is used to annotate continuations
+;;; that are used as a function result continuation or that receive MVs.
(defstruct (ir2-continuation
- (:constructor make-ir2-continuation (primitive-type)))
- ;; If this is :Delayed, then this is a single value continuation for which
- ;; the evaluation of the use is to be postponed until the evaluation of
- ;; destination. This can be done for ref nodes or predicates whose
- ;; destination is an IF.
- ;;
- ;; If this is :Fixed, then this continuation has a fixed number of values,
- ;; with the TNs in Locs.
- ;;
- ;; If this is :Unknown, then this is an unknown-values continuation, using
- ;; the passing locations in Locs.
- ;;
- ;; If this is :Unused, then this continuation should never actually be used
- ;; as the destination of a value: it is only used tail-recursively.
+ (:constructor make-ir2-continuation (primitive-type))
+ (:copier nil))
+ ;; If this is :DELAYED, then this is a single value continuation for
+ ;; which the evaluation of the use is to be postponed until the
+ ;; evaluation of destination. This can be done for ref nodes or
+ ;; predicates whose destination is an IF.
+ ;;
+ ;; If this is :FIXED, then this continuation has a fixed number of
+ ;; values, with the TNs in LOCS.
+ ;;
+ ;; If this is :UNKNOWN, then this is an unknown-values continuation,
+ ;; using the passing locations in LOCS.
+ ;;
+ ;; If this is :UNUSED, then this continuation should never actually
+ ;; be used as the destination of a value: it is only used
+ ;; tail-recursively.
(kind :fixed :type (member :delayed :fixed :unknown :unused))
- ;; The primitive-type of the first value of this continuation. This is
- ;; primarily for internal use during LTN, but it also records the type
- ;; restriction on delayed references. In multiple-value contexts, this is
- ;; null to indicate that it is meaningless. This is always (primitive-type
- ;; (continuation-type cont)), which may be more restrictive than the
- ;; tn-primitive-type of the value TN. This is becase the value TN must hold
- ;; any possible type that could be computed (before type checking.)
+ ;; The primitive-type of the first value of this continuation. This
+ ;; is primarily for internal use during LTN, but it also records the
+ ;; type restriction on delayed references. In multiple-value
+ ;; contexts, this is null to indicate that it is meaningless. This
+ ;; is always (primitive-type (continuation-type cont)), which may be
+ ;; more restrictive than the tn-primitive-type of the value TN. This
+ ;; is becase the value TN must hold any possible type that could be
+ ;; computed (before type checking.)
(primitive-type nil :type (or primitive-type null))
- ;; Locations used to hold the values of the continuation. If the number
- ;; of values if fixed, then there is one TN per value. If the number of
- ;; values is unknown, then this is a two-list of TNs holding the start of the
- ;; values glob and the number of values. Note that since type checking is
- ;; the responsibility of the values receiver, these TNs primitive type is
- ;; only based on the proven type information.
+ ;; Locations used to hold the values of the continuation. If the
+ ;; number of values if fixed, then there is one TN per value. If the
+ ;; number of values is unknown, then this is a two-list of TNs
+ ;; holding the start of the values glob and the number of values.
+ ;; Note that since type checking is the responsibility of the values
+ ;; receiver, these TNs primitive type is only based on the proven
+ ;; type information.
(locs nil :type list))
(defprinter (ir2-continuation)
primitive-type
locs)
-;;; The IR2-Component serves mostly to accumulate non-code information about
-;;; the component being compiled.
-(defstruct ir2-component
- ;; The counter used to allocate global TN numbers.
+;;; An IR2-COMPONENT serves mostly to accumulate non-code information
+;;; about the component being compiled.
+(defstruct (ir2-component (:copier nil))
+ ;; the counter used to allocate global TN numbers
(global-tn-counter 0 :type index)
- ;; Normal-TNs is the head of the list of all the normal TNs that need to be
- ;; packed, linked through the Next slot. We place TNs on this list when we
- ;; allocate them so that Pack can find them.
+ ;; NORMAL-TNS is the head of the list of all the normal TNs that
+ ;; need to be packed, linked through the Next slot. We place TNs on
+ ;; this list when we allocate them so that Pack can find them.
;;
- ;; Restricted-TNs are TNs that must be packed within a finite SC. We pack
- ;; these TNs first to ensure that the restrictions will be satisfied (if
- ;; possible).
+ ;; RESTRICTED-TNS are TNs that must be packed within a finite SC. We
+ ;; pack these TNs first to ensure that the restrictions will be
+ ;; satisfied (if possible).
;;
- ;; Wired-TNs are TNs that must be packed at a specific location. The SC
- ;; and Offset are already filled in.
+ ;; WIRED-TNs are TNs that must be packed at a specific location. The
+ ;; SC and OFFSET are already filled in.
;;
- ;; Constant-TNs are non-packed TNs that represent constants. :Constant TNs
- ;; may eventually be converted to :Cached-Constant normal TNs.
+ ;; CONSTANT-TNs are non-packed TNs that represent constants.
+ ;; :CONSTANT TNs may eventually be converted to :CACHED-CONSTANT
+ ;; normal TNs.
(normal-tns nil :type (or tn null))
(restricted-tns nil :type (or tn null))
(wired-tns nil :type (or tn null))
(constant-tns nil :type (or tn null))
- ;; A list of all the :COMPONENT TNs (live throughout the component.) These
- ;; TNs will also appear in the {NORMAL,RESTRICTED,WIRED} TNs as appropriate
- ;; to their location.
+ ;; a list of all the :COMPONENT TNs (live throughout the component).
+ ;; These TNs will also appear in the {NORMAL,RESTRICTED,WIRED} TNs
+ ;; as appropriate to their location.
(component-tns () :type list)
;; If this component has a NFP, then this is it.
(nfp nil :type (or tn null))
- ;; A list of the explicitly specified save TNs (kind :SPECIFIED-SAVE). These
- ;; TNs will also appear in the {NORMAL,RESTRICTED,WIRED} TNs as appropriate
- ;; to their location.
+ ;; a list of the explicitly specified save TNs (kind
+ ;; :SPECIFIED-SAVE). These TNs will also appear in the
+ ;; {NORMAL,RESTRICTED,WIRED} TNs as appropriate to their location.
(specified-save-tns () :type list)
- ;; Values-Receivers is a list of all the blocks whose ir2-block has a
- ;; non-null value for Popped. This slot is initialized by LTN-Analyze as an
- ;; input to Stack-Analyze.
+ ;; a list of all the blocks whose IR2-BLOCK has a non-null value for
+ ;; POPPED. This slot is initialized by LTN-ANALYZE as an input to
+ ;; STACK-ANALYZE.
(values-receivers nil :type list)
- ;; An adjustable vector that records all the constants in the constant pool.
- ;; A non-immediate :Constant TN with offset 0 refers to the constant in
- ;; element 0, etc. Normal constants are represented by the placing the
- ;; Constant leaf in this vector. A load-time constant is distinguished by
- ;; being a cons (Kind . What). Kind is a keyword indicating how the constant
- ;; is computed, and What is some context.
+ ;; an adjustable vector that records all the constants in the
+ ;; constant pool. A non-immediate :CONSTANT TN with offset 0 refers
+ ;; to the constant in element 0, etc. Normal constants are
+ ;; represented by the placing the CONSTANT leaf in this vector. A
+ ;; load-time constant is distinguished by being a cons (KIND .
+ ;; WHAT). KIND is a keyword indicating how the constant is computed,
+ ;; and WHAT is some context.
;;
;; These load-time constants are recognized:
;;
;; (:entry . <function>)
- ;; Is replaced by the code pointer for the specified function. This is
- ;; how compiled code (including DEFUN) gets its hands on a function.
- ;; <function> is the XEP lambda for the called function; its Leaf-Info
- ;; should be an Entry-Info structure.
+ ;; Is replaced by the code pointer for the specified function.
+ ;; This is how compiled code (including DEFUN) gets its hands on
+ ;; a function. <function> is the XEP lambda for the called
+ ;; function; its LEAF-INFO should be an ENTRY-INFO structure.
;;
;; (:label . <label>)
- ;; Is replaced with the byte offset of that label from the start of the
- ;; code vector (including the header length.)
+ ;; Is replaced with the byte offset of that label from the start
+ ;; of the code vector (including the header length.)
;;
- ;; A null entry in this vector is a placeholder for implementation overhead
- ;; that is eventually stuffed in somehow.
+ ;; A null entry in this vector is a placeholder for implementation
+ ;; overhead that is eventually stuffed in somehow.
(constants (make-array 10 :fill-pointer 0 :adjustable t) :type vector)
- ;; Some kind of info about the component's run-time representation. This is
- ;; filled in by the VM supplied Select-Component-Format function.
+ ;; some kind of info about the component's run-time representation.
+ ;; This is filled in by the VM supplied Select-Component-Format function.
format
- ;; A list of the Entry-Info structures describing all of the entries into
- ;; this component. Filled in by entry analysis.
+ ;; a list of the ENTRY-INFO structures describing all of the entries
+ ;; into this component. Filled in by entry analysis.
(entries nil :type list)
;; Head of the list of :ALIAS TNs in this component, threaded by TN-NEXT.
(alias-tns nil :type (or tn null))
- ;; Spilled-VOPs is a hashtable translating from "interesting" VOPs to a list
- ;; of the TNs spilled at that VOP. This is used when computing debug info so
- ;; that we don't consider the TN's value to be valid when it is in fact
- ;; somewhere else. Spilled-TNs has T for every "interesting" TN that is ever
- ;; spilled, providing a representation that is more convenient some places.
+ ;; SPILLED-VOPS is a hashtable translating from "interesting" VOPs
+ ;; to a list of the TNs spilled at that VOP. This is used when
+ ;; computing debug info so that we don't consider the TN's value to
+ ;; be valid when it is in fact somewhere else. SPILLED-TNS has T for
+ ;; every "interesting" TN that is ever spilled, providing a
+ ;; representation that is more convenient some places.
(spilled-vops (make-hash-table :test 'eq) :type hash-table)
(spilled-tns (make-hash-table :test 'eq) :type hash-table)
- ;; Dynamic vop count info. This is needed by both ir2-convert and
+ ;; dynamic vop count info. This is needed by both ir2-convert and
;; setup-dynamic-count-info. (But only if we are generating code to
;; collect dynamic statistics.)
#!+sb-dyncount
(dyncount-info nil :type (or null dyncount-info)))
-;;; The Entry-Info structure condenses all the information that the dumper
-;;; needs to create each XEP's function entry data structure. The Entry-Info
-;;; structures are somtimes created before they are initialized, since ir2
-;;; conversion may need to compile a forward reference. In this case
-;;; the slots aren't actually initialized until entry analysis runs.
-(defstruct entry-info
- ;; True if this function has a non-null closure environment.
+;;; An ENTRY-INFO condenses all the information that the dumper needs
+;;; to create each XEP's function entry data structure. ENTRY-INFO
+;;; structures are somtimes created before they are initialized, since
+;;; IR2 conversion may need to compile a forward reference. In this
+;;; case the slots aren't actually initialized until entry analysis runs.
+(defstruct (entry-info (:copier nil))
+ ;; true if this function has a non-null closure environment
(closure-p nil :type boolean)
- ;; A label pointing to the entry vector for this function. Null until
- ;; ENTRY-ANALYZE runs.
+ ;; a label pointing to the entry vector for this function, or NIL
+ ;; before ENTRY-ANALYZE runs
(offset nil :type (or label null))
- ;; If this function was defined using DEFUN, then this is the name of the
- ;; function, a symbol or (SETF <symbol>). Otherwise, this is some string
- ;; that is intended to be informative.
+ ;; If this function was defined using DEFUN, then this is the name
+ ;; of the function, a symbol or (SETF <symbol>). Otherwise, this is
+ ;; some string that is intended to be informative.
(name "<not computed>" :type (or simple-string list symbol))
- ;; A string representing the argument list that the function was defined
- ;; with.
+ ;; a string representing the argument list that the function was
+ ;; defined with
(arguments nil :type (or simple-string null))
- ;; A function type specifier representing the arguments and results of this
- ;; function.
+ ;; a function type specifier representing the arguments and results
+ ;; of this function
(type 'function :type (or list (member function))))
-;;; An IR2-ENVIRONMENT is used to annotate non-LET lambdas with their passing
-;;; locations. It is stored in the Environment-Info.
-(defstruct ir2-environment
- ;; The TNs that hold the passed environment within the function. This is an
- ;; alist translating from the NLX-Info or lambda-var to the TN that holds
- ;; the corresponding value within this function. This list is in the same
- ;; order as the ENVIRONMENT-CLOSURE.
+;;; An IR2-ENVIRONMENT is used to annotate non-LET lambdas with their
+;;; passing locations. It is stored in the Environment-Info.
+(defstruct (ir2-environment (:copier nil))
+ ;; the TNs that hold the passed environment within the function.
+ ;; This is an alist translating from the NLX-Info or lambda-var to
+ ;; the TN that holds the corresponding value within this function.
+ ;; This list is in the same order as the ENVIRONMENT-CLOSURE.
(environment nil :type list)
- ;; The TNs that hold the Old-Fp and Return-PC within the function. We
- ;; always save these so that the debugger can do a backtrace, even if the
- ;; function has no return (and thus never uses them). Null only temporarily.
+ ;; the TNs that hold the OLD-FP and RETURN-PC within the function.
+ ;; We always save these so that the debugger can do a backtrace,
+ ;; even if the function has no return (and thus never uses them).
+ ;; Null only temporarily.
(old-fp nil :type (or tn null))
(return-pc nil :type (or tn null))
;; The passing location for the Return-PC. The return PC is treated
- ;; differently from the other arguments, since in some implementations we may
- ;; use a call instruction that requires the return PC to be passed in a
- ;; particular place.
+ ;; differently from the other arguments, since in some
+ ;; implementations we may use a call instruction that requires the
+ ;; return PC to be passed in a particular place.
(return-pc-pass (required-argument) :type tn)
- ;; True if this function has a frame on the number stack. This is set by
- ;; representation selection whenever it is possible that some function in
- ;; our tail set will make use of the number stack.
+ ;; True if this function has a frame on the number stack. This is
+ ;; set by representation selection whenever it is possible that some
+ ;; function in our tail set will make use of the number stack.
(number-stack-p nil :type boolean)
- ;; A list of all the :Environment TNs live in this environment.
+ ;; a list of all the :ENVIRONMENT TNs live in this environment
(live-tns nil :type list)
- ;; A list of all the :Debug-Environment TNs live in this environment.
+ ;; a list of all the :DEBUG-ENVIRONMENT TNs live in this environment
(debug-live-tns nil :type list)
- ;; A label that marks the start of elsewhere code for this function. Null
- ;; until this label is assigned by codegen. Used for maintaining the debug
- ;; source map.
+ ;; a label that marks the start of elsewhere code for this function.
+ ;; Null until this label is assigned by codegen. Used for
+ ;; maintaining the debug source map.
(elsewhere-start nil :type (or label null))
- ;; A label that marks the first location in this function at which the
- ;; environment is properly initialized, i.e. arguments moved from their
- ;; passing locations, etc. This is the start of the function as far as the
- ;; debugger is concerned.
+ ;; a label that marks the first location in this function at which
+ ;; the environment is properly initialized, i.e. arguments moved
+ ;; from their passing locations, etc. This is the start of the
+ ;; function as far as the debugger is concerned.
(environment-start nil :type (or label null)))
(defprinter (ir2-environment)
environment
return-pc
return-pc-pass)
-;;; The Return-Info structure is used by GTN to represent the return strategy
-;;; and locations for all the functions in a given Tail-Set. It is stored in
-;;; the Tail-Set-Info.
-(defstruct return-info
+;;; A RETURN-INFO is used by GTN to represent the return strategy and
+;;; locations for all the functions in a given TAIL-SET. It is stored
+;;; in the TAIL-SET-INFO.
+(defstruct (return-info (:copier nil))
;; The return convention used:
- ;; -- If :Unknown, we use the standard return convention.
- ;; -- If :Fixed, we use the known-values convention.
+ ;; -- If :UNKNOWN, we use the standard return convention.
+ ;; -- If :FIXED, we use the known-values convention.
(kind (required-argument) :type (member :fixed :unknown))
- ;; The number of values returned, or :Unknown if we don't know. Count may be
- ;; known when Kind is :Unknown, since we may choose the standard return
- ;; convention for other reasons.
+ ;; the number of values returned, or :UNKNOWN if we don't know.
+ ;; COUNT may be known when KIND is :UNKNOWN, since we may choose the
+ ;; standard return convention for other reasons.
(count (required-argument) :type (or index (member :unknown)))
- ;; If count isn't :Unknown, then this is a list of the primitive-types of
- ;; each value.
+ ;; If count isn't :UNKNOWN, then this is a list of the
+ ;; primitive-types of each value.
(types () :type list)
- ;; If kind is :Fixed, then this is the list of the TNs that we return the
- ;; values in.
+ ;; If kind is :FIXED, then this is the list of the TNs that we
+ ;; return the values in.
(locations () :type list))
(defprinter (return-info)
kind
types
locations)
-(defstruct ir2-nlx-info
- ;; If the kind is :Entry (a lexical exit), then in the home environment, this
- ;; holds a Value-Cell object containing the unwind block pointer. In the
- ;; other cases nobody directly references the unwind-block, so we leave this
- ;; slot null.
+(defstruct (ir2-nlx-info (:copier nil))
+ ;; If the kind is :ENTRY (a lexical exit), then in the home
+ ;; environment, this holds a VALUE-CELL object containing the unwind
+ ;; block pointer. In the other cases nobody directly references the
+ ;; unwind-block, so we leave this slot null.
(home nil :type (or tn null))
;; The saved control stack pointer.
(save-sp (required-argument) :type tn)
home
save-sp
dynamic-state)
-
-;;; FIXME: Delete? (was commented out in CMU CL)
-#|
-;;; The Loop structure holds information about a loop.
-(defstruct (cloop (:conc-name loop-)
- (:predicate loop-p)
- (:constructor make-loop)
- (:copier copy-loop))
- ;; The kind of loop that this is. These values are legal:
- ;;
- ;; :Outer
- ;; This is the outermost loop structure, and represents all the
- ;; code in a component.
- ;;
- ;; :Natural
- ;; A normal loop with only one entry.
- ;;
- ;; :Strange
- ;; A segment of a "strange loop" in a non-reducible flow graph.
- (kind (required-argument) :type (member :outer :natural :strange))
- ;; The first and last blocks in the loop. There may be more than one tail,
- ;; since there may be multiple back branches to the same head.
- (head nil :type (or cblock null))
- (tail nil :type list)
- ;; A list of all the blocks in this loop or its inferiors that have a
- ;; successor outside of the loop.
- (exits nil :type list)
- ;; The loop that this loop is nested within. This is null in the outermost
- ;; loop structure.
- (superior nil :type (or cloop null))
- ;; A list of the loops nested directly within this one.
- (inferiors nil :type list)
- ;; The head of the list of blocks directly within this loop. We must recurse
- ;; on Inferiors to find all the blocks.
- (blocks nil :type (or null cblock)))
-(defprinter (loop)
- kind
- head
- tail
- exits)
-|#
\f
;;;; VOPs and templates
;;; A VOP is a Virtual Operation. It represents an operation and the
;;; operands to the operation.
-(defstruct (vop (:constructor make-vop (block node info args results)))
+(defstruct (vop (:constructor make-vop (block node info args results))
+ (:copier nil))
;; VOP-Info structure containing static info about the operation.
(info nil :type (or vop-info null))
;; The IR2-Block this VOP is in.
;;; A TN-REF object contains information about a particular reference
;;; to a TN. The information in TN-REFs largely determines how TNs are
;;; packed.
-(defstruct (tn-ref (:constructor make-tn-ref (tn write-p)))
+(defstruct (tn-ref (:constructor make-tn-ref (tn write-p))
+ (:copier nil))
;; the TN referenced
(tn (required-argument) :type tn)
;; Is this is a write reference? (as opposed to a read reference)
;;; a known function.
(def!struct (template (:constructor nil)
#-sb-xc-host (:pure t))
- ;; The symbol name of this VOP. This is used when printing the VOP
+ ;; the symbol name of this VOP. This is used when printing the VOP
;; and is also used to provide a handle for definition and
;; translation.
(name nil :type symbol)
- ;; A Function-Type describing the arg/result type restrictions. We
- ;; compute this from the Primitive-Type restrictions to make life
- ;; easier for IR1 phases that need to anticipate LTN's template
- ;; selection.
+ ;; the arg/result type restrictions. We compute this from the
+ ;; PRIMITIVE-TYPE restrictions to make life easier for IR1 phases
+ ;; that need to anticipate LTN's template selection.
(type (required-argument) :type function-type)
- ;; Lists of restrictions on the argument and result types. A
+ ;; lists of restrictions on the argument and result types. A
;; restriction may take several forms:
;; -- The restriction * is no restriction at all.
;; -- A restriction (:OR <primitive-type>*) means that the operand
;; the type tested by the predicate, used when we want to represent
;; the type constraint as a Lisp function type.
;;
- ;; If Result-Types is :Conditional, then this is an IF-xxx style
+ ;; If RESULT-TYPES is :CONDITIONAL, then this is an IF-FOO style
;; conditional that yeilds its result as a control transfer. The
;; emit function takes two info arguments: the target label and a
;; boolean flag indicating whether to negate the sense of the test.
(arg-types nil :type list)
(result-types nil :type (or list (member :conditional)))
- ;; The primitive type restriction applied to each extra argument or
+ ;; the primitive type restriction applied to each extra argument or
;; result following the fixed operands. If NIL, no extra
;; args/results are allowed. Otherwise, either * or a (:OR ...) list
;; as described for the {ARG,RESULT}-TYPES.
;; conditionally compile for different target hardware
;; configuarations (e.g. FP hardware.)
(guard nil :type (or function null))
- ;; The policy under which this template is the best translation.
+ ;; the policy under which this template is the best translation.
;; Note that LTN might use this template under other policies if it
- ;; can't figure our anything better to do.
- (policy (required-argument) :type policies)
- ;; The base cost for this template, given optimistic assumptions
+ ;; can't figure out anything better to do.
+ (ltn-policy (required-argument) :type ltn-policy)
+ ;; the base cost for this template, given optimistic assumptions
;; such as no operand loading, etc.
(cost (required-argument) :type index)
- ;; If true, then a short noun-like phrase describing what this VOP
- ;; "does", i.e. the implementation strategy. This is for use in
- ;; efficiency notes.
+ ;; If true, then this is a short noun-like phrase describing what
+ ;; this VOP "does", i.e. the implementation strategy. This is for
+ ;; use in efficiency notes.
(note nil :type (or string null))
;; The number of trailing arguments to VOP or %PRIMITIVE that we
;; bundle into a list and pass into the emit function. This provides
;; a way to pass uninterpreted stuff directly to the code generator.
(info-arg-count 0 :type index)
- ;; A function that emits the VOPs for this template. Arguments:
+ ;; a function that emits the VOPs for this template. Arguments:
;; 1] Node for source context.
;; 2] IR2-Block that we place the VOP in.
;; 3] This structure.
result-types
(more-args-type :test more-args-type :prin1 more-args-type)
(more-results-type :test more-results-type :prin1 more-results-type)
- policy
+ ltn-policy
cost
(note :test note)
(info-arg-count :test (not (zerop info-arg-count))))
(def!struct (vop-info
(:include template)
(:make-load-form-fun ignore-it))
- ;; Side-effects of this VOP and side-effects that affect the value
- ;; of this VOP.
+ ;; side-effects of this VOP and side-effects that affect the value
+ ;; of this VOP
(effects (required-argument) :type attributes)
(affected (required-argument) :type attributes)
;; If true, causes special casing of TNs live after this VOP that
;; -- If :Compute-Only, just compute the save set, don't do any saving.
;; This is used to get the live variables for debug info.
(save-p nil :type (member t nil :force-to-stack :compute-only))
- ;; Info for automatic emission of move-arg VOPs by representation
+ ;; info for automatic emission of move-arg VOPs by representation
;; selection. If NIL, then do nothing special. If non-null, then
;; there must be a more arg. Each more arg is moved to its passing
;; location using the appropriate representation-specific
;; :KNOWN-RETURN
;; If needed, the old NFP is computed using COMPUTE-OLD-NFP.
(move-args nil :type (member nil :full-call :local-call :known-return))
- ;; A list of sc-vectors representing the loading costs of each fixed
- ;; argument and result.
+ ;; a list of sc-vectors representing the loading costs of each fixed
+ ;; argument and result
(arg-costs nil :type list)
(result-costs nil :type list)
- ;; If true, sc-vectors representing the loading costs for any more
- ;; args and results.
+ ;; if true, SC-VECTORs representing the loading costs for any more
+ ;; args and results
(more-arg-costs nil :type (or sc-vector null))
(more-result-costs nil :type (or sc-vector null))
- ;; Lists of sc-vectors mapping each SC to the SCs that we can load
+ ;; lists of SC-VECTORs mapping each SC to the SCs that we can load
;; into. If a SC is directly acceptable to the VOP, then the entry
;; is T. Otherwise, it is a list of the SC numbers of all the SCs
;; that we can load into. This list will be empty if there is no
;; operand SC restriction.
(arg-load-scs nil :type list)
(result-load-scs nil :type list)
- ;; If true, a function that is called with the VOP to do operand
+ ;; if true, a function that is called with the VOP to do operand
;; targeting. This is done by modifiying the TN-Ref-Target slots in
;; the TN-Refs so that they point to other TN-Refs in the same VOP.
(target-function nil :type (or null function))
- ;; A function that emits assembly code for a use of this VOP when it
+ ;; a function that emits assembly code for a use of this VOP when it
;; is called with the VOP structure. Null if this VOP has no
;; specified generator (i.e. it exists only to be inherited by other
;; VOPs.)
(generator-function nil :type (or function null))
- ;; A list of things that are used to parameterize an inherited
+ ;; a list of things that are used to parameterize an inherited
;; generator. This allows the same generator function to be used for
;; a group of VOPs with similar implementations.
(variant nil :type list)
- ;; The number of arguments and results. Each regular arg/result
+ ;; the number of arguments and results. Each regular arg/result
;; counts as one, and all the more args/results together count as 1.
(num-args 0 :type index)
(num-results 0 :type index)
- ;; Vector of the temporaries the vop needs. See emit-generic-vop in
- ;; vmdef for information on how the temps are encoded.
- ;;
- ;; (The SB-XC-HOST conditionalization on the type is there because
- ;; it's difficult to dump specialized arrays portably, so on the
- ;; cross-compilation host we punt by using unspecialized arrays
- ;; instead.)
+ ;; a vector of the temporaries the vop needs. See EMIT-GENERIC-VOP
+ ;; in vmdef for information on how the temps are encoded.
(temps nil :type (or null (specializable-vector (unsigned-byte 16))))
- ;; The order all the refs for this vop should be put in. Each
+ ;; the order all the refs for this vop should be put in. Each
;; operand is assigned a number in the following ordering: args,
;; more-args, results, more-results, temps This vector represents
;; the order the operands should be put into in the next-ref link.
- ;;
- ;; (The SB-XC-HOST conditionalization on the type is there because
- ;; it's difficult to dump specialized arrays portably, so on the
- ;; cross-compilation host we punt by using unspecialized arrays
- ;; instead.)
(ref-ordering nil :type (or null (specializable-vector (unsigned-byte 8))))
- ;; Array of the various targets that should be done. Each element
+ ;; a vector of the various targets that should be done. Each element
;; encodes the source ref (shifted 8) and the dest ref index.
(targets nil :type (or null (specializable-vector (unsigned-byte 16)))))
\f
;;; the SC structure holds the storage base that storage is allocated
;;; in and information used to select locations within the SB.
-(defstruct sc
+(defstruct (sc (:copier nil))
;; Name, for printing and reference.
(name nil :type symbol)
;; The number used to index SC cost vectors.
(defstruct (tn (:include sset-element)
(:constructor make-random-tn)
- (:constructor make-tn (number kind primitive-type sc)))
+ (:constructor make-tn (number kind primitive-type sc))
+ (:copier nil))
;; The kind of TN this is:
;;
;; :NORMAL
;;; lifetime analysis to represent the set of TNs live at the start of
;;; the IR2 block.
(defstruct (global-conflicts
- (:constructor make-global-conflicts (kind tn block number)))
+ (:constructor make-global-conflicts (kind tn block number))
+ (:copier nil))
;; The IR2-Block that this structure represents the conflicts for.
(block (required-argument) :type ir2-block)
;; Thread running through all the Global-Conflict for Block. This