@@ -79,16 +79,16 @@ class EmitBBArguments : public CanTypeVisitor<EmitBBArguments,
79
79
/* RetTy*/ ManagedValue>
80
80
{
81
81
public:
82
- SILGenFunction &gen ;
82
+ SILGenFunction &SGF ;
83
83
SILBasicBlock *parent;
84
84
SILLocation loc;
85
85
bool functionArgs;
86
86
ArrayRef<SILParameterInfo> ¶meters;
87
87
88
- EmitBBArguments (SILGenFunction &gen , SILBasicBlock *parent,
88
+ EmitBBArguments (SILGenFunction &sgf , SILBasicBlock *parent,
89
89
SILLocation l, bool functionArgs,
90
90
ArrayRef<SILParameterInfo> ¶meters)
91
- : gen(gen ), parent(parent), loc(l), functionArgs(functionArgs),
91
+ : SGF(sgf ), parent(parent), loc(l), functionArgs(functionArgs),
92
92
parameters (parameters) {}
93
93
94
94
ManagedValue getManagedValue (SILValue arg, CanType t,
@@ -105,7 +105,7 @@ class EmitBBArguments : public CanTypeVisitor<EmitBBArguments,
105
105
// An unowned parameter is passed at +0, like guaranteed, but it isn't
106
106
// kept alive by the caller, so we need to retain and manage it
107
107
// regardless.
108
- return gen .emitManagedRetain (loc, arg);
108
+ return SGF .emitManagedRetain (loc, arg);
109
109
110
110
case ParameterConvention::Indirect_Inout:
111
111
case ParameterConvention::Indirect_InoutAliasable:
@@ -117,20 +117,20 @@ class EmitBBArguments : public CanTypeVisitor<EmitBBArguments,
117
117
case ParameterConvention::Indirect_In_Constant:
118
118
// An owned or 'in' parameter is passed in at +1. We can claim ownership
119
119
// of the parameter and clean it up when it goes out of scope.
120
- return gen .emitManagedRValueWithCleanup (arg);
120
+ return SGF .emitManagedRValueWithCleanup (arg);
121
121
}
122
122
llvm_unreachable (" bad parameter convention" );
123
123
}
124
124
125
125
ManagedValue visitType (CanType t) {
126
- auto argType = gen .getLoweredType (t);
126
+ auto argType = SGF .getLoweredType (t);
127
127
// Pop the next parameter info.
128
128
auto parameterInfo = parameters.front ();
129
129
parameters = parameters.slice (1 );
130
130
assert (
131
131
argType
132
132
== parent->getParent ()->mapTypeIntoContext (
133
- gen .getSILType (parameterInfo))
133
+ SGF .getSILType (parameterInfo))
134
134
&& " argument does not have same type as specified by parameter info" );
135
135
136
136
SILValue arg =
@@ -148,16 +148,16 @@ class EmitBBArguments : public CanTypeVisitor<EmitBBArguments,
148
148
&& isa<FunctionType>(objectType)
149
149
&& cast<FunctionType>(objectType)->getRepresentation ()
150
150
== FunctionType::Representation::Block) {
151
- SILValue blockCopy = gen .B .createCopyBlock (loc, mv.getValue ());
152
- mv = gen .emitManagedRValueWithCleanup (blockCopy);
151
+ SILValue blockCopy = SGF .B .createCopyBlock (loc, mv.getValue ());
152
+ mv = SGF .emitManagedRValueWithCleanup (blockCopy);
153
153
}
154
154
return mv;
155
155
}
156
156
157
157
ManagedValue visitTupleType (CanTupleType t) {
158
158
SmallVector<ManagedValue, 4 > elements;
159
159
160
- auto &tl = gen .getTypeLowering (t);
160
+ auto &tl = SGF .getTypeLowering (t);
161
161
bool canBeGuaranteed = tl.isLoadable ();
162
162
163
163
// Collect the exploded elements.
@@ -170,7 +170,7 @@ class EmitBBArguments : public CanTypeVisitor<EmitBBArguments,
170
170
elements.push_back (elt);
171
171
}
172
172
173
- if (tl.isLoadable () || !gen .silConv .useLoweredAddresses ()) {
173
+ if (tl.isLoadable () || !SGF .silConv .useLoweredAddresses ()) {
174
174
SmallVector<SILValue, 4 > elementValues;
175
175
if (canBeGuaranteed) {
176
176
// If all of the elements were guaranteed, we can form a guaranteed tuple.
@@ -180,32 +180,32 @@ class EmitBBArguments : public CanTypeVisitor<EmitBBArguments,
180
180
// Otherwise, we need to move or copy values into a +1 tuple.
181
181
for (auto element : elements) {
182
182
SILValue value = element.hasCleanup ()
183
- ? element.forward (gen )
184
- : element.copyUnmanaged (gen , loc).forward (gen );
183
+ ? element.forward (SGF )
184
+ : element.copyUnmanaged (SGF , loc).forward (SGF );
185
185
elementValues.push_back (value);
186
186
}
187
187
}
188
- auto tupleValue = gen .B .createTuple (loc, tl.getLoweredType (),
188
+ auto tupleValue = SGF .B .createTuple (loc, tl.getLoweredType (),
189
189
elementValues);
190
190
return canBeGuaranteed
191
191
? ManagedValue::forUnmanaged (tupleValue)
192
- : gen .emitManagedRValueWithCleanup (tupleValue);
192
+ : SGF .emitManagedRValueWithCleanup (tupleValue);
193
193
} else {
194
194
// If the type is address-only, we need to move or copy the elements into
195
195
// a tuple in memory.
196
196
// TODO: It would be a bit more efficient to use a preallocated buffer
197
197
// in this case.
198
- auto buffer = gen .emitTemporaryAllocation (loc, tl.getLoweredType ());
198
+ auto buffer = SGF .emitTemporaryAllocation (loc, tl.getLoweredType ());
199
199
for (auto i : indices (elements)) {
200
200
auto element = elements[i];
201
- auto elementBuffer = gen .B .createTupleElementAddr (loc, buffer,
201
+ auto elementBuffer = SGF .B .createTupleElementAddr (loc, buffer,
202
202
i, element.getType ().getAddressType ());
203
203
if (element.hasCleanup ())
204
- element.forwardInto (gen , loc, elementBuffer);
204
+ element.forwardInto (SGF , loc, elementBuffer);
205
205
else
206
- element.copyInto (gen , elementBuffer, loc);
206
+ element.copyInto (SGF , elementBuffer, loc);
207
207
}
208
- return gen .emitManagedRValueWithCleanup (buffer);
208
+ return SGF .emitManagedRValueWithCleanup (buffer);
209
209
}
210
210
}
211
211
};
0 commit comments