|
1
|
+;; Boot file to increase the max alignment value from 3 to 4.
|
|
2
|
+;;
|
|
3
|
+;; This takes care of everything for the bootstrap, but when new-assem
|
|
4
|
+;; is loaded. you'll get a warning. Select the CLOBBER-IT restart to
|
|
5
|
+;; continue.
|
|
6
|
+
|
|
7
|
+(in-package :new-assem)
|
|
8
|
+
|
|
9
|
+(handler-bind
|
|
10
|
+ ((error (lambda (c)
|
|
11
|
+ (declare (ignore c))
|
|
12
|
+ (invoke-restart 'continue))))
|
|
13
|
+ (defconstant max-alignment 4))
|
|
14
|
+
|
|
15
|
+(ext:without-package-locks
|
|
16
|
+(deftype alignment ()
|
|
17
|
+ `(integer 0 ,max-alignment))
|
|
18
|
+)
|
|
19
|
+
|
|
20
|
+(ext:without-package-locks
|
|
21
|
+(handler-bind ((error (lambda (c)
|
|
22
|
+ (declare (ignore c))
|
|
23
|
+ (invoke-restart 'kernel::clobber-it))))
|
|
24
|
+ (defstruct (segment
|
|
25
|
+ (:print-function %print-segment)
|
|
26
|
+ (:constructor make-segment (&key name run-scheduler inst-hook)))
|
|
27
|
+ ;;
|
|
28
|
+ ;; The name of this segment. Only using in trace files.
|
|
29
|
+ (name "Unnamed" :type simple-base-string)
|
|
30
|
+ ;;
|
|
31
|
+ ;; Whether or not run the scheduler. Note: if the instruction defintions
|
|
32
|
+ ;; were not compiled with the scheduler turned on, this has no effect.
|
|
33
|
+ (run-scheduler nil)
|
|
34
|
+ ;;
|
|
35
|
+ ;; If a function, then it is funcalled for each inst emitted with the
|
|
36
|
+ ;; segment, the VOP, the name of the inst (as a string), and the inst
|
|
37
|
+ ;; arguments.
|
|
38
|
+ (inst-hook nil :type (or function null))
|
|
39
|
+ ;;
|
|
40
|
+ ;; Where to deposit the next byte.
|
|
41
|
+ (fill-pointer (system:int-sap 0) :type system:system-area-pointer)
|
|
42
|
+ ;;
|
|
43
|
+ ;; Where the current output block ends. If fill-pointer is ever sap= to
|
|
44
|
+ ;; this, don't deposit a byte. Move the fill pointer into a new block.
|
|
45
|
+ (block-end (system:int-sap 0) :type system:system-area-pointer)
|
|
46
|
+ ;;
|
|
47
|
+ ;; What position does this correspond to. Initially, positions and indexes
|
|
48
|
+ ;; are the same, but after we start collapsing choosers, positions can change
|
|
49
|
+ ;; while indexes stay the same.
|
|
50
|
+ (current-posn 0 :type posn)
|
|
51
|
+ ;;
|
|
52
|
+ ;; Were in the output blocks are we currently outputing.
|
|
53
|
+ (current-index 0 :type index)
|
|
54
|
+ ;;
|
|
55
|
+ ;; A vector of the output blocks.
|
|
56
|
+ (output-blocks (make-array 4 :initial-element nil) :type simple-vector)
|
|
57
|
+ ;;
|
|
58
|
+ ;; A list of all the annotations that have been output to this segment.
|
|
59
|
+ (annotations nil :type list)
|
|
60
|
+ ;;
|
|
61
|
+ ;; A pointer to the last cons cell in the annotations list. This is
|
|
62
|
+ ;; so we can quickly add things to the end of the annotations list.
|
|
63
|
+ (last-annotation nil :type list)
|
|
64
|
+ ;;
|
|
65
|
+ ;; The number of bits of alignment at the last time we synchronized.
|
|
66
|
+ (alignment max-alignment :type alignment)
|
|
67
|
+ ;;
|
|
68
|
+ ;; The position the last time we synchronized.
|
|
69
|
+ (sync-posn 0 :type posn)
|
|
70
|
+ ;;
|
|
71
|
+ ;; The posn and index everything ends at. This is not maintained while the
|
|
72
|
+ ;; data is being generated, but is filled in after. Basically, we copy
|
|
73
|
+ ;; current-posn and current-index so that we can trash them while processing
|
|
74
|
+ ;; choosers and back-patches.
|
|
75
|
+ (final-posn 0 :type posn)
|
|
76
|
+ (final-index 0 :type index)
|
|
77
|
+ ;;
|
|
78
|
+ ;; *** State used by the scheduler during instruction queueing.
|
|
79
|
+ ;;
|
|
80
|
+ ;; List of postit's. These are accumulated between instructions.
|
|
81
|
+ (postits nil :type list)
|
|
82
|
+ ;;
|
|
83
|
+ ;; ``Number'' for last instruction queued. Used only to supply insts
|
|
84
|
+ ;; with unique sset-element-number's.
|
|
85
|
+ (inst-number 0 :type index)
|
|
86
|
+ ;;
|
|
87
|
+ ;; Simple-Vectors mapping locations to the instruction that reads them and
|
|
88
|
+ ;; instructions that write them.
|
|
89
|
+ (readers (make-array (assem-params-max-locations
|
|
90
|
+ (c:backend-assembler-params c:*backend*))
|
|
91
|
+ :initial-element nil)
|
|
92
|
+ :type simple-vector)
|
|
93
|
+ (writers (make-array (assem-params-max-locations
|
|
94
|
+ (c:backend-assembler-params c:*backend*))
|
|
95
|
+ :initial-element nil)
|
|
96
|
+ :type simple-vector)
|
|
97
|
+ ;;
|
|
98
|
+ ;; The number of additional cycles before the next control transfer, or NIL
|
|
99
|
+ ;; if a control transfer hasn't been queued. When a delayed branch is
|
|
100
|
+ ;; queued, this slot is set to the delay count.
|
|
101
|
+ (branch-countdown nil :type (or null (and fixnum unsigned-byte)))
|
|
102
|
+ ;;
|
|
103
|
+ ;; *** These two slots are used both by the queuing noise and the
|
|
104
|
+ ;; scheduling noise.
|
|
105
|
+ ;;
|
|
106
|
+ ;; All the instructions that are pending and don't have any unresolved
|
|
107
|
+ ;; dependents. We don't list branches here even if they would otherwise
|
|
108
|
+ ;; qualify. They are listed above.
|
|
109
|
+ ;;
|
|
110
|
+ (emittable-insts-sset (make-sset) :type sset)
|
|
111
|
+ ;;
|
|
112
|
+ ;; List of queued branches. We handle these specially, because they have to
|
|
113
|
+ ;; be emitted at a specific place (e.g. one slot before the end of the
|
|
114
|
+ ;; block).
|
|
115
|
+ (queued-branches nil :type list)
|
|
116
|
+ ;;
|
|
117
|
+ ;; *** State used by the scheduler duing instruction scheduling.
|
|
118
|
+ ;;
|
|
119
|
+ ;; The instructions who would have had a read dependent removed if it were
|
|
120
|
+ ;; not for a delay slot. This is a list of lists. Each element in the
|
|
121
|
+ ;; top level list corresponds to yet another cycle of delay. Each element
|
|
122
|
+ ;; in the second level lists is a dotted pair, holding the dependency
|
|
123
|
+ ;; instruction and the dependent to remove.
|
|
124
|
+ (delayed nil :type list)
|
|
125
|
+ ;;
|
|
126
|
+ ;; The emittable insts again, except this time as a list sorted by depth.
|
|
127
|
+ (emittable-insts-queue nil :type list)
|
|
128
|
+ ;;
|
|
129
|
+ ;; Whether or not to collect dynamic statistics. This is just the same as
|
|
130
|
+ ;; *collect-dynamic-statistics* but is faster to reference.
|
|
131
|
+ (collect-dynamic-statistics nil))))
|
|
132
|
+
|