2
2
//
3
3
// This source file is part of the Swift.org open source project
4
4
//
5
- // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5
+ // Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
6
6
// Licensed under Apache License v2.0 with Runtime Library Exception
7
7
//
8
8
// See https://swift.org/LICENSE.txt for license information
16
16
// / supports changing how macros expand by #defining an auxillary variable
17
17
// / before including SILNodes.def as summarized in the chart below:
18
18
// /
19
- // / | #define | Operation |
20
- // / |--------------------+---------------------------------------------------------|
21
- // / | N/A | Visit single value insts as insts |
22
- // / | VALUE | Visit single value insts as values |
23
- // / | ABSTRACT_VALUE | Visit abstract single value insts as values |
24
- // / | APPLYSITE_INST | Visit full and partial apply site insts as apply sites. |
25
- // / | FULLAPPLYSITE_INST | Visit full apply site insts as apply sites. |
26
- // / | DYNAMICCAST_INST | Visit dynamic casts as dynamic casts. |
19
+ // / | #define | Operation |
20
+ // / |--------------------+-----------------------------------------------------|
21
+ // / | N/A | Visit single value insts as insts |
22
+ // / | VALUE | Visit single value insts as values |
23
+ // / | ABSTRACT_VALUE | Visit abstract single value insts as values |
24
+ // / | DYNAMICCAST_INST | Visit dynamic casts as dynamic casts. |
27
25
// /
28
26
// / We describe the triggering variables below:
29
27
// /
37
35
// / If defined this will cause ABSTRACT_SINGLE_VALUE_INST to expand to
38
36
// / ABSTRACT_VALUE INSTEAD OF ABSTRACT_INST.
39
37
// /
40
- // / 3. FULLAPPLYSITE_INST(ID, PARENT).
41
- // /
42
- // / If defined this will cause:
43
- // /
44
- // / * FULLAPPLYSITE_SINGLE_VALUE_INST,
45
- // / * FULLAPPLYSITE_MULTIPLE_VALUE_INST,
46
- // / * FULLAPPLYSITE_TERMINATOR_INST,
47
- // /
48
- // / To expand to FULLAPPLYSITE_INST(ID, PARENT) instead of SINGLE_VALUE_INST,
49
- // / MULTIPLE_VALUE_INST, or TERMINATOR_INST.
50
- // /
51
- // / 4. APPLYSITE_INST(ID, PARENT)
52
- // /
53
- // / If defined this will cause:
54
- // /
55
- // / * APPLYSITE_SINGLE_VALUE_INST
56
- // / * APPLYSITE_MULTIPLE_VALUE_INST
57
- // / * APPLYSITE_TERMINATOR_INST
58
- // /
59
- // / to expand to APPLYSITE_INST(ID, PARENT) instead of delegating to
60
- // / SINGLE_VALUE_INST.
61
- // /
62
- // / 5. DYNAMICCAST_INST(ID, PARENT)
38
+ // / 3. DYNAMICCAST_INST(ID, PARENT)
63
39
// /
64
40
// / If defined this will cause:
65
41
// /
72
48
// /
73
49
// ===----------------------------------------------------------------------===//
74
50
75
- #ifdef APPLYSITE_INST
76
- #ifdef FULLAPPLYSITE_INST
77
- #error "Can not query for apply site and full apply site in one include"
78
- #endif
79
- #endif
80
-
81
51
// / NODE(ID, PARENT)
82
52
// /
83
53
// / A concrete subclass of SILNode. ID is the name of the class as well
121
91
#endif
122
92
#endif
123
93
124
- // / APPLYSITE_SINGLE_VALUE_INST(ID, TEXTUALNAME, PARENT, MEMBEHAVIOR,
125
- // / MAYRELEASE)
126
- // /
127
- // / A SINGLE_VALUE_INST that is a partial or full apply site. ID is a member
128
- // / of ApplySiteKind.
129
- #ifndef APPLYSITE_SINGLE_VALUE_INST
130
- #ifdef APPLYSITE_INST
131
- #define APPLYSITE_SINGLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
132
- APPLYSITE_INST (ID, PARENT)
133
- #else
134
- #define APPLYSITE_SINGLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
135
- BRIDGED_SINGLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE)
136
- #endif
137
- #endif
138
-
139
- // / FULLAPPLYSITE_SINGLE_VALUE_INST(ID, TEXTUALNAME, PARENT, MEMBEHAVIOR,
140
- // / MAYRELEASE)
141
- // /
142
- // / A SINGLE_VALUE_INST that is a full apply site. ID is a member of
143
- // / FullApplySiteKind and ApplySiteKind.
144
- #ifndef FULLAPPLYSITE_SINGLE_VALUE_INST
145
- #ifdef FULLAPPLYSITE_INST
146
- #define FULLAPPLYSITE_SINGLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
147
- FULLAPPLYSITE_INST (ID, PARENT)
148
- #else
149
- #define FULLAPPLYSITE_SINGLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
150
- APPLYSITE_SINGLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE)
151
- #endif
152
- #endif
153
-
154
94
// / MULTIPLE_VALUE_INST(Id, TextualName, Parent, MemBehavior, MayRelease)
155
95
// /
156
96
// / A concrete subclass of MultipleValueInstruction. ID is a member of
161
101
FULL_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE)
162
102
#endif
163
103
164
- // / APPLYSITE_MULTIPLE_VALUE_INST(ID, TEXTUALNAME, PARENT, MEMBEHAVIOR,
165
- // / MAYRELEASE)
166
- // /
167
- // / A MULTIPLE_VALUE_INST that is additionally either a partial or full apply
168
- // / site. ID is a member of ApplySiteKind.
169
- #ifndef APPLYSITE_MULTIPLE_VALUE_INST
170
- #ifdef APPLYSITE_INST
171
- #define APPLYSITE_MULTIPLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
172
- APPLYSITE_INST (ID, PARENT)
173
- #else
174
- #define APPLYSITE_MULTIPLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
175
- MULTIPLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE)
176
- #endif
177
- #endif
178
-
179
- // / FULLAPPLYSITE_MULTIPLE_VALUE_INST(ID, TEXTUALNAME, PARENT, MEMBEHAVIOR,
180
- // / MAYRELEASE)
181
- // /
182
- // / A MULTIPLE_VALUE_INST that is additionally a full apply site. ID is a
183
- // / member of FullApplySiteKind and ApplySiteKind.
184
- #ifndef FULLAPPLYSITE_MULTIPLE_VALUE_INST
185
- #ifdef FULLAPPLYSITE_INST
186
- #define FULLAPPLYSITE_MULTIPLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
187
- FULLAPPLYSITE_INST (ID, PARENT)
188
- #else
189
- #define FULLAPPLYSITE_MULTIPLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
190
- APPLYSITE_MULTIPLE_VALUE_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE)
191
- #endif
192
- #endif
193
-
194
104
// / MULTIPLE_VALUE_INST_RESULT(ID, PARENT)
195
105
// /
196
106
// / A concrete subclass of MultipleValueInstructionResult. ID is a member of
286
196
#endif
287
197
#endif
288
198
289
- // / APPLYSITE_TERMINATOR_INST(ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE)
290
- // /
291
- // / ID is a member of ApplySiteKind, TerminatorKind, and ApplySiteKind and name
292
- // / of a subclass of TermInst.
293
- #ifndef APPLYSITE_TERMINATOR_INST
294
- #ifdef APPLYSITE_INST
295
- #define APPLYSITE_TERMINATOR_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
296
- APPLYSITE_INST (ID, NAME)
297
- #else
298
- #define APPLYSITE_TERMINATOR_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
299
- TERMINATOR (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE)
300
- #endif
301
- #endif
302
-
303
- // / FULLAPPLYSITE_TERMINATOR(ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE)
304
- // /
305
- // / ID is a member of FullApplySiteKind, TerminatorKind, and ApplySiteKind and
306
- // / name of a subclass of TermInst.
307
- #ifndef FULLAPPLYSITE_TERMINATOR_INST
308
- #ifdef FULLAPPLYSITE_INST
309
- #define FULLAPPLYSITE_TERMINATOR_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
310
- FULLAPPLYSITE_INST (ID, PARENT)
311
- #else
312
- #define FULLAPPLYSITE_TERMINATOR_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE ) \
313
- APPLYSITE_TERMINATOR_INST (ID, NAME, PARENT, MEMBEHAVIOR, MAYRELEASE)
314
- #endif
315
- #endif
316
-
317
199
// / ABSTRACT_NODE(ID, PARENT)
318
200
// /
319
201
// / An abstract class in the SILNode hierarchy. It does not have an
@@ -640,12 +522,12 @@ ABSTRACT_VALUE_AND_INST(SingleValueInstruction, ValueBase, SILInstruction)
640
522
SingleValueInstruction, None, DoesNotRelease)
641
523
642
524
// Function Application
643
- FULLAPPLYSITE_SINGLE_VALUE_INST (ApplyInst, apply,
644
- SingleValueInstruction, MayHaveSideEffects, MayRelease)
525
+ BRIDGED_SINGLE_VALUE_INST (ApplyInst, apply,
526
+ SingleValueInstruction, MayHaveSideEffects, MayRelease)
645
527
BRIDGED_SINGLE_VALUE_INST(BuiltinInst, builtin,
646
528
SingleValueInstruction, MayHaveSideEffects, MayRelease)
647
- APPLYSITE_SINGLE_VALUE_INST (PartialApplyInst, partial_apply,
648
- SingleValueInstruction, MayHaveSideEffects, DoesNotRelease)
529
+ BRIDGED_SINGLE_VALUE_INST (PartialApplyInst, partial_apply,
530
+ SingleValueInstruction, MayHaveSideEffects, DoesNotRelease)
649
531
650
532
// Metatypes
651
533
SINGLE_VALUE_INST(MetatypeInst, metatype,
@@ -780,8 +662,8 @@ ABSTRACT_INST(TermInst, SILInstruction)
780
662
TermInst, MayHaveSideEffects, MayRelease)
781
663
TERMINATOR(UnwindInst, unwind,
782
664
TermInst, None, DoesNotRelease)
783
- FULLAPPLYSITE_TERMINATOR_INST (TryApplyInst, try_apply,
784
- TermInst, MayHaveSideEffects, MayRelease)
665
+ TERMINATOR (TryApplyInst, try_apply,
666
+ TermInst, MayHaveSideEffects, MayRelease)
785
667
TERMINATOR(BranchInst, br,
786
668
TermInst, None, DoesNotRelease)
787
669
TERMINATOR(CondBranchInst, cond_br,
@@ -923,8 +805,8 @@ BRIDGED_NON_VALUE_INST(CondFailInst, cond_fail,
923
805
NODE_RANGE(NonValueInstruction, UnreachableInst, CondFailInst)
924
806
925
807
ABSTRACT_INST(MultipleValueInstruction, SILInstruction)
926
- FULLAPPLYSITE_MULTIPLE_VALUE_INST (BeginApplyInst, begin_apply,
927
- MultipleValueInstruction, MayHaveSideEffects, MayRelease)
808
+ MULTIPLE_VALUE_INST (BeginApplyInst, begin_apply,
809
+ MultipleValueInstruction, MayHaveSideEffects, MayRelease)
928
810
929
811
// begin_cow_mutation is defined to have side effects, because it has
930
812
// dependencies with instructions which retain the buffer operand. This prevents
@@ -952,19 +834,13 @@ NODE_RANGE(SILNode, SILPhiArgument, DestructureTupleInst)
952
834
#undef ABSTRACT_VALUE
953
835
#undef ABSTRACT_NODE
954
836
#undef ABSTRACT_VALUE_AND_INST
955
- #undef FULLAPPLYSITE_TERMINATOR_INST
956
- #undef APPLYSITE_TERMINATOR_INST
957
837
#undef DYNAMICCAST_TERMINATOR
958
838
#undef TERMINATOR
959
839
#undef NON_VALUE_INST
960
840
#undef BRIDGED_NON_VALUE_INST
961
841
#undef DYNAMICCAST_NON_VALUE_INST
962
842
#undef MULTIPLE_VALUE_INST_RESULT
963
- #undef FULLAPPLYSITE_MULTIPLE_VALUE_INST
964
- #undef APPLYSITE_MULTIPLE_VALUE_INST
965
843
#undef MULTIPLE_VALUE_INST
966
- #undef FULLAPPLYSITE_SINGLE_VALUE_INST
967
- #undef APPLYSITE_SINGLE_VALUE_INST
968
844
#undef DYNAMICCAST_SINGLE_VALUE_INST
969
845
#undef DYNAMICCAST_INST
970
846
#undef SINGLE_VALUE_INST
@@ -974,5 +850,3 @@ NODE_RANGE(SILNode, SILPhiArgument, DestructureTupleInst)
974
850
#undef ARGUMENT
975
851
#undef VALUE
976
852
#undef NODE
977
- #undef APPLYSITE_INST
978
- #undef FULLAPPLYSITE_INST
0 commit comments