@@ -56,14 +56,6 @@ extension ForwardingInstruction {
5656 public var preservesReferenceCounts : Bool {
5757 bridged. ForwardingInst_preservesOwnership ( )
5858 }
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 }
6759}
6860
6961// An instruction that forwards a single value to a single result.
@@ -112,52 +104,6 @@ extension ConversionInstruction {
112104 public var singleForwardedOperand : Operand ? { operand }
113105}
114106
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-
161107//===----------------------------------------------------------------------===//
162108// forwardedResults
163109//===----------------------------------------------------------------------===//
@@ -214,75 +160,243 @@ public struct ForwardedResults : Collection {
214160}
215161
216162//===----------------------------------------------------------------------===//
217- // preservesRepresentation
163+ // conforming instructions
218164//===----------------------------------------------------------------------===//
219165
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 }
225230}
226231
227- extension ConvertFunctionInst {
232+ // -----------------------------------------------------------------------------
233+ // conversion instructions
234+
235+ extension MarkUnresolvedNonCopyableValueInst : ConversionInstruction {
228236 public var preservesRepresentation : Bool { true }
237+ public var canForwardGuaranteedValues : Bool { true }
238+ public var canForwardOwnedValues : Bool { true }
229239}
230240
231- extension DestructureTupleInst {
241+ extension MarkUninitializedInst : ConversionInstruction {
232242 public var preservesRepresentation : Bool { true }
243+ public var canForwardGuaranteedValues : Bool { false }
244+ public var canForwardOwnedValues : Bool { true }
233245}
234246
235- extension DestructureStructInst {
247+ extension ConvertFunctionInst : ConversionInstruction {
236248 public var preservesRepresentation : Bool { true }
249+ public var canForwardGuaranteedValues : Bool { true }
250+ public var canForwardOwnedValues : Bool { true }
237251}
238252
239- extension InitExistentialRefInst {
253+ extension ThinToThickFunctionInst : ConversionInstruction {
240254 public var preservesRepresentation : Bool { true }
255+ public var canForwardGuaranteedValues : Bool { true }
256+ public var canForwardOwnedValues : Bool { true }
241257}
242258
243- extension ObjectInst {
259+ extension CopyableToMoveOnlyWrapperValueInst : ConversionInstruction {
244260 public var preservesRepresentation : Bool { true }
261+ public var canForwardGuaranteedValues : Bool { true }
262+ public var canForwardOwnedValues : Bool { true }
245263}
246264
247- extension OpenExistentialBoxValueInst {
265+ extension MoveOnlyWrapperToCopyableValueInst : ConversionInstruction {
248266 public var preservesRepresentation : Bool { true }
267+ public var canForwardGuaranteedValues : Bool { true }
268+ public var canForwardOwnedValues : Bool { true }
249269}
250270
251- extension OpenExistentialRefInst {
271+ extension UpcastInst : ConversionInstruction {
252272 public var preservesRepresentation : Bool { true }
273+ public var canForwardGuaranteedValues : Bool { true }
274+ public var canForwardOwnedValues : Bool { true }
253275}
254276
255- extension OpenExistentialValueInst {
277+ extension UncheckedRefCastInst : ConversionInstruction {
256278 public var preservesRepresentation : Bool { true }
279+ public var canForwardGuaranteedValues : Bool { true }
280+ public var canForwardOwnedValues : Bool { true }
257281}
258282
259- extension MarkUnresolvedNonCopyableValueInst {
283+ extension UnconditionalCheckedCastInst : ConversionInstruction {
260284 public var preservesRepresentation : Bool { true }
285+ public var canForwardGuaranteedValues : Bool { true }
286+ public var canForwardOwnedValues : Bool { true }
261287}
262288
263- extension MarkUninitializedInst {
289+ extension BridgeObjectToRefInst : ConversionInstruction {
264290 public var preservesRepresentation : Bool { true }
291+ public var canForwardGuaranteedValues : Bool { true }
292+ public var canForwardOwnedValues : Bool { true }
265293}
266294
267- extension StructExtractInst {
295+ extension UncheckedValueCastInst : ConversionInstruction {
268296 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 }
269359 public var canForwardOwnedValues : Bool { false }
270360}
271361
272- extension TupleExtractInst {
362+ extension DifferentiableFunctionExtractInst : ForwardingInstruction {
273363 public var preservesRepresentation : Bool { true }
364+ public var canForwardGuaranteedValues : Bool { true }
274365 public var canForwardOwnedValues : Bool { false }
275366}
276367
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 {
278375 public var preservesRepresentation : Bool { true }
376+ public var canForwardGuaranteedValues : Bool { true }
377+ public var canForwardOwnedValues : Bool { true }
279378}
280379
281- extension MoveOnlyWrapperToCopyableValueInst {
380+ extension SwitchEnumInst : ForwardingInstruction {
282381 public var preservesRepresentation : Bool { true }
382+ public var canForwardGuaranteedValues : Bool { true }
383+ public var canForwardOwnedValues : Bool { true }
283384}
284385
285- extension TuplePackExtractInst {
386+ extension MarkUnresolvedReferenceBindingInst : ForwardingInstruction {
286387 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 }
288402}
0 commit comments