@@ -109,26 +109,42 @@ namespace irgen {
109
109
NecessaryBindings bindings;
110
110
SmallVector<ArgumentInfo, 4 > argumentInfos;
111
111
112
+ unsigned getErrorIndex () { return (unsigned )FixedIndex::Error; }
113
+ unsigned getFirstIndirectReturnIndex () {
114
+ return getErrorIndex () + getErrorCount ();
115
+ }
116
+ unsigned getLocalContextIndex () {
117
+ assert (hasLocalContext ());
118
+ return getFirstIndirectReturnIndex () + getIndirectReturnCount ();
119
+ }
120
+ unsigned getIndexAfterLocalContext () {
121
+ return getFirstIndirectReturnIndex () + getIndirectReturnCount () +
122
+ (hasLocalContext () ? 1 : 0 );
123
+ }
124
+ unsigned getBindingsIndex () {
125
+ assert (hasBindings ());
126
+ return getIndexAfterLocalContext ();
127
+ }
128
+ unsigned getFirstArgumentIndex () {
129
+ return getIndexAfterLocalContext () + (hasBindings () ? 1 : 0 );
130
+ }
131
+ unsigned getIndexAfterArguments () {
132
+ return getFirstArgumentIndex () + getArgumentCount ();
133
+ }
134
+ unsigned getFirstDirectReturnIndex () { return getIndexAfterArguments (); }
135
+
112
136
public:
113
137
bool canHaveError () { return canHaveValidError; }
114
- unsigned getErrorIndex () { return (unsigned )FixedIndex::Error; }
115
138
ElementLayout getErrorLayout () { return getElement (getErrorIndex ()); }
116
139
unsigned getErrorCount () { return (unsigned )FixedCount::Error; }
117
140
SILType getErrorType () { return errorType; }
118
141
119
- unsigned getFirstIndirectReturnIndex () {
120
- return getErrorIndex () + getErrorCount ();
121
- }
122
142
ElementLayout getIndirectReturnLayout (unsigned index) {
123
143
return getElement (getFirstIndirectReturnIndex () + index);
124
144
}
125
145
unsigned getIndirectReturnCount () { return indirectReturnInfos.size (); }
126
146
127
147
bool hasLocalContext () { return (bool )localContextInfo; }
128
- unsigned getLocalContextIndex () {
129
- assert (hasLocalContext ());
130
- return getFirstIndirectReturnIndex () + getIndirectReturnCount ();
131
- }
132
148
ElementLayout getLocalContextLayout () {
133
149
assert (hasLocalContext ());
134
150
return getElement (getLocalContextIndex ());
@@ -141,48 +157,30 @@ namespace irgen {
141
157
assert (hasLocalContext ());
142
158
return localContextInfo->type ;
143
159
}
144
- unsigned getIndexAfterLocalContext () {
145
- return getFirstIndirectReturnIndex () + getIndirectReturnCount () +
146
- (hasLocalContext () ? 1 : 0 );
147
- }
148
160
149
161
bool hasBindings () const { return !bindings.empty (); }
150
- unsigned getBindingsIndex () {
151
- assert (hasBindings ());
152
- return getIndexAfterLocalContext ();
153
- }
154
162
ElementLayout getBindingsLayout () {
155
163
assert (hasBindings ());
156
164
return getElement (getBindingsIndex ());
157
165
}
158
- ParameterConvention getBindingsConvention () {
159
- return ParameterConvention::Direct_Unowned;
160
- }
161
166
const NecessaryBindings &getBindings () const { return bindings; }
162
167
163
- unsigned getFirstArgumentIndex () {
164
- return getIndexAfterLocalContext () + (hasBindings () ? 1 : 0 );
165
- }
166
168
ElementLayout getArgumentLayout (unsigned index) {
167
169
return getElement (getFirstArgumentIndex () + index);
168
170
}
169
- ParameterConvention getArgumentConvention (unsigned index) {
170
- return argumentInfos[index].convention ;
171
- }
172
171
SILType getArgumentType (unsigned index) {
173
172
return argumentInfos[index].type ;
174
173
}
174
+ // Returns the type of a parameter of the substituted function using the
175
+ // indexing of the function parameters, *not* the indexing of
176
+ // AsyncContextLayout.
175
177
SILType getParameterType (unsigned index) {
176
178
SILFunctionConventions origConv (substitutedType, IGF.getSILModule ());
177
179
return origConv.getSILArgumentType (
178
180
index, IGF.IGM .getMaximalTypeExpansionContext ());
179
181
}
180
182
unsigned getArgumentCount () { return argumentInfos.size (); }
181
- unsigned getIndexAfterArguments () {
182
- return getFirstArgumentIndex () + getArgumentCount ();
183
- }
184
183
185
- unsigned getFirstDirectReturnIndex () { return getIndexAfterArguments (); }
186
184
unsigned getDirectReturnCount () { return directReturnInfos.size (); }
187
185
ElementLayout getDirectReturnLayout (unsigned index) {
188
186
return getElement (getFirstDirectReturnIndex () + index);
0 commit comments