@@ -56,14 +56,6 @@ extension ForwardingInstruction {
56
56
public var preservesReferenceCounts : Bool {
57
57
bridged. ForwardingInst_preservesOwnership ( )
58
58
}
59
-
60
- // Most forwarding instructions can forward owned and guaranteed values.
61
- // Therefore define a default implementation of `true`.
62
- public var canForwardGuaranteedValues : Bool { true }
63
-
64
- // Most forwarding instructions can forward owned and guaranteed values.
65
- // Therefore define a default implementation of `true`.
66
- public var canForwardOwnedValues : Bool { true }
67
59
}
68
60
69
61
// An instruction that forwards a single value to a single result.
@@ -112,52 +104,6 @@ extension ConversionInstruction {
112
104
public var singleForwardedOperand : Operand ? { operand }
113
105
}
114
106
115
- extension EnumInst {
116
- public var singleForwardedOperand : Operand ? {
117
- return operand // nil for an enum with no payload
118
- }
119
- }
120
-
121
- // -----------------------------------------------------------------------------
122
- // Instructions with multiple forwarded operands have nil singleForwardedOperand.
123
-
124
- extension StructInst {
125
- public var singleForwardedOperand : Operand ? { nil }
126
- }
127
-
128
- extension TupleInst {
129
- public var singleForwardedOperand : Operand ? { nil }
130
- }
131
-
132
- extension LinearFunctionInst {
133
- public var singleForwardedOperand : Operand ? { nil }
134
- }
135
-
136
- extension DifferentiableFunctionInst {
137
- public var singleForwardedOperand : Operand ? { nil }
138
- }
139
-
140
- // -----------------------------------------------------------------------------
141
- // Instructions with a singleForwardedOperand and additional operands.
142
-
143
- extension MarkDependenceInst {
144
- public var singleForwardedOperand : Operand ? {
145
- return valueOperand
146
- }
147
- }
148
-
149
- extension RefToBridgeObjectInst {
150
- public var singleForwardedOperand : Operand ? {
151
- return convertedOperand
152
- }
153
- }
154
-
155
- extension TuplePackExtractInst {
156
- public var singleForwardedOperand : Operand ? {
157
- return tupleOperand
158
- }
159
- }
160
-
161
107
//===----------------------------------------------------------------------===//
162
108
// forwardedResults
163
109
//===----------------------------------------------------------------------===//
@@ -214,75 +160,243 @@ public struct ForwardedResults : Collection {
214
160
}
215
161
216
162
//===----------------------------------------------------------------------===//
217
- // preservesRepresentation
163
+ // conforming instructions
218
164
//===----------------------------------------------------------------------===//
219
165
220
- extension ForwardingInstruction {
221
- // Conservatively assume that a conversion changes representation.
222
- // Operations can be added as needed to participate in SIL opaque values.
223
- // See ForwardingOperation::hasSameRepresentation().
224
- public var preservesRepresentation : Bool { false }
166
+ // -----------------------------------------------------------------------------
167
+ // Instructions with multiple forwarded operands have nil singleForwardedOperand.
168
+
169
+ extension StructInst : ForwardingInstruction {
170
+ public var singleForwardedOperand : Operand ? { nil }
171
+
172
+ public var preservesRepresentation : Bool { true }
173
+ public var canForwardGuaranteedValues : Bool { true }
174
+ public var canForwardOwnedValues : Bool { true }
175
+ }
176
+
177
+ extension TupleInst : ForwardingInstruction {
178
+ public var singleForwardedOperand : Operand ? { nil }
179
+
180
+ public var preservesRepresentation : Bool { true }
181
+ public var canForwardGuaranteedValues : Bool { true }
182
+ public var canForwardOwnedValues : Bool { true }
183
+ }
184
+
185
+ extension LinearFunctionInst : ForwardingInstruction {
186
+ public var singleForwardedOperand : Operand ? { nil }
187
+
188
+ public var preservesRepresentation : Bool { true }
189
+ public var canForwardGuaranteedValues : Bool { true }
190
+ public var canForwardOwnedValues : Bool { true }
191
+ }
192
+
193
+ extension DifferentiableFunctionInst : ForwardingInstruction {
194
+ public var singleForwardedOperand : Operand ? { nil }
195
+
196
+ public var preservesRepresentation : Bool { true }
197
+ public var canForwardGuaranteedValues : Bool { true }
198
+ public var canForwardOwnedValues : Bool { true }
199
+ }
200
+
201
+ // -----------------------------------------------------------------------------
202
+ // Instructions with a singleForwardedOperand and additional operands.
203
+
204
+ extension MarkDependenceInst : ForwardingInstruction {
205
+ public var singleForwardedOperand : Operand ? {
206
+ return valueOperand
207
+ }
208
+
209
+ public var preservesRepresentation : Bool { true }
210
+ public var canForwardGuaranteedValues : Bool { true }
211
+ public var canForwardOwnedValues : Bool { true }
212
+ }
213
+
214
+ extension RefToBridgeObjectInst : ForwardingInstruction {
215
+ public var singleForwardedOperand : Operand ? {
216
+ return convertedOperand
217
+ }
218
+
219
+ public var preservesRepresentation : Bool { true }
220
+ public var canForwardGuaranteedValues : Bool { true }
221
+ public var canForwardOwnedValues : Bool { true }
222
+ }
223
+
224
+ extension TuplePackExtractInst : ForwardingInstruction {
225
+ public var singleForwardedOperand : Operand ? { return tupleOperand }
226
+
227
+ public var preservesRepresentation : Bool { true }
228
+ public var canForwardGuaranteedValues : Bool { true }
229
+ public var canForwardOwnedValues : Bool { false }
225
230
}
226
231
227
- extension ConvertFunctionInst {
232
+ // -----------------------------------------------------------------------------
233
+ // conversion instructions
234
+
235
+ extension MarkUnresolvedNonCopyableValueInst : ConversionInstruction {
228
236
public var preservesRepresentation : Bool { true }
237
+ public var canForwardGuaranteedValues : Bool { true }
238
+ public var canForwardOwnedValues : Bool { true }
229
239
}
230
240
231
- extension DestructureTupleInst {
241
+ extension MarkUninitializedInst : ConversionInstruction {
232
242
public var preservesRepresentation : Bool { true }
243
+ public var canForwardGuaranteedValues : Bool { false }
244
+ public var canForwardOwnedValues : Bool { true }
233
245
}
234
246
235
- extension DestructureStructInst {
247
+ extension ConvertFunctionInst : ConversionInstruction {
236
248
public var preservesRepresentation : Bool { true }
249
+ public var canForwardGuaranteedValues : Bool { true }
250
+ public var canForwardOwnedValues : Bool { true }
237
251
}
238
252
239
- extension InitExistentialRefInst {
253
+ extension ThinToThickFunctionInst : ConversionInstruction {
240
254
public var preservesRepresentation : Bool { true }
255
+ public var canForwardGuaranteedValues : Bool { true }
256
+ public var canForwardOwnedValues : Bool { true }
241
257
}
242
258
243
- extension ObjectInst {
259
+ extension CopyableToMoveOnlyWrapperValueInst : ConversionInstruction {
244
260
public var preservesRepresentation : Bool { true }
261
+ public var canForwardGuaranteedValues : Bool { true }
262
+ public var canForwardOwnedValues : Bool { true }
245
263
}
246
264
247
- extension OpenExistentialBoxValueInst {
265
+ extension MoveOnlyWrapperToCopyableValueInst : ConversionInstruction {
248
266
public var preservesRepresentation : Bool { true }
267
+ public var canForwardGuaranteedValues : Bool { true }
268
+ public var canForwardOwnedValues : Bool { true }
249
269
}
250
270
251
- extension OpenExistentialRefInst {
271
+ extension UpcastInst : ConversionInstruction {
252
272
public var preservesRepresentation : Bool { true }
273
+ public var canForwardGuaranteedValues : Bool { true }
274
+ public var canForwardOwnedValues : Bool { true }
253
275
}
254
276
255
- extension OpenExistentialValueInst {
277
+ extension UncheckedRefCastInst : ConversionInstruction {
256
278
public var preservesRepresentation : Bool { true }
279
+ public var canForwardGuaranteedValues : Bool { true }
280
+ public var canForwardOwnedValues : Bool { true }
257
281
}
258
282
259
- extension MarkUnresolvedNonCopyableValueInst {
283
+ extension UnconditionalCheckedCastInst : ConversionInstruction {
260
284
public var preservesRepresentation : Bool { true }
285
+ public var canForwardGuaranteedValues : Bool { true }
286
+ public var canForwardOwnedValues : Bool { true }
261
287
}
262
288
263
- extension MarkUninitializedInst {
289
+ extension BridgeObjectToRefInst : ConversionInstruction {
264
290
public var preservesRepresentation : Bool { true }
291
+ public var canForwardGuaranteedValues : Bool { true }
292
+ public var canForwardOwnedValues : Bool { true }
265
293
}
266
294
267
- extension StructExtractInst {
295
+ extension UncheckedValueCastInst : ConversionInstruction {
268
296
public var preservesRepresentation : Bool { true }
297
+ public var canForwardGuaranteedValues : Bool { true }
298
+ public var canForwardOwnedValues : Bool { true }
299
+ }
300
+
301
+ // -----------------------------------------------------------------------------
302
+ // other forwarding instructions
303
+
304
+ extension EnumInst : ForwardingInstruction {
305
+ public var singleForwardedOperand : Operand ? {
306
+ return operand // nil for an enum with no payload
307
+ }
308
+
309
+ public var preservesRepresentation : Bool { true }
310
+ public var canForwardGuaranteedValues : Bool { true }
311
+ public var canForwardOwnedValues : Bool { true }
312
+ }
313
+
314
+ extension DestructureTupleInst : ForwardingInstruction {
315
+ public var preservesRepresentation : Bool { true }
316
+ public var canForwardGuaranteedValues : Bool { true }
317
+ public var canForwardOwnedValues : Bool { true }
318
+ }
319
+
320
+ extension DestructureStructInst : ForwardingInstruction {
321
+ public var preservesRepresentation : Bool { true }
322
+ public var canForwardGuaranteedValues : Bool { true }
323
+ public var canForwardOwnedValues : Bool { true }
324
+ }
325
+
326
+ extension InitExistentialRefInst : ForwardingInstruction {
327
+ public var preservesRepresentation : Bool { true }
328
+ public var canForwardGuaranteedValues : Bool { true }
329
+ public var canForwardOwnedValues : Bool { true }
330
+ }
331
+
332
+ extension OpenExistentialRefInst : ForwardingInstruction {
333
+ public var preservesRepresentation : Bool { true }
334
+ public var canForwardGuaranteedValues : Bool { true }
335
+ public var canForwardOwnedValues : Bool { true }
336
+ }
337
+
338
+ extension OpenExistentialValueInst : ForwardingInstruction {
339
+ public var preservesRepresentation : Bool { true }
340
+ public var canForwardGuaranteedValues : Bool { true }
341
+ public var canForwardOwnedValues : Bool { true }
342
+ }
343
+
344
+ extension OpenExistentialBoxValueInst : ForwardingInstruction {
345
+ public var preservesRepresentation : Bool { true }
346
+ public var canForwardGuaranteedValues : Bool { true }
347
+ public var canForwardOwnedValues : Bool { true }
348
+ }
349
+
350
+ extension StructExtractInst : ForwardingInstruction {
351
+ public var preservesRepresentation : Bool { true }
352
+ public var canForwardGuaranteedValues : Bool { true }
353
+ public var canForwardOwnedValues : Bool { false }
354
+ }
355
+
356
+ extension TupleExtractInst : ForwardingInstruction {
357
+ public var preservesRepresentation : Bool { true }
358
+ public var canForwardGuaranteedValues : Bool { true }
269
359
public var canForwardOwnedValues : Bool { false }
270
360
}
271
361
272
- extension TupleExtractInst {
362
+ extension DifferentiableFunctionExtractInst : ForwardingInstruction {
273
363
public var preservesRepresentation : Bool { true }
364
+ public var canForwardGuaranteedValues : Bool { true }
274
365
public var canForwardOwnedValues : Bool { false }
275
366
}
276
367
277
- extension CopyableToMoveOnlyWrapperValueInst {
368
+ extension CheckedCastBranchInst : ForwardingInstruction {
369
+ public var preservesRepresentation : Bool { true }
370
+ public var canForwardGuaranteedValues : Bool { true }
371
+ public var canForwardOwnedValues : Bool { true }
372
+ }
373
+
374
+ extension UncheckedEnumDataInst : ForwardingInstruction {
278
375
public var preservesRepresentation : Bool { true }
376
+ public var canForwardGuaranteedValues : Bool { true }
377
+ public var canForwardOwnedValues : Bool { true }
279
378
}
280
379
281
- extension MoveOnlyWrapperToCopyableValueInst {
380
+ extension SwitchEnumInst : ForwardingInstruction {
282
381
public var preservesRepresentation : Bool { true }
382
+ public var canForwardGuaranteedValues : Bool { true }
383
+ public var canForwardOwnedValues : Bool { true }
283
384
}
284
385
285
- extension TuplePackExtractInst {
386
+ extension MarkUnresolvedReferenceBindingInst : ForwardingInstruction {
286
387
public var preservesRepresentation : Bool { true }
287
- public var canForwardOwnedValues : Bool { false }
388
+ public var canForwardGuaranteedValues : Bool { true }
389
+ public var canForwardOwnedValues : Bool { true }
390
+ }
391
+
392
+ extension MoveOnlyWrapperToCopyableBoxInst : ForwardingInstruction {
393
+ public var preservesRepresentation : Bool { true }
394
+ public var canForwardGuaranteedValues : Bool { true }
395
+ public var canForwardOwnedValues : Bool { true }
396
+ }
397
+
398
+ extension LinearFunctionExtractInst : ForwardingInstruction {
399
+ public var preservesRepresentation : Bool { true }
400
+ public var canForwardGuaranteedValues : Bool { true }
401
+ public var canForwardOwnedValues : Bool { true }
288
402
}
0 commit comments