@@ -1104,14 +1104,9 @@ bool ByteCodeExprGen<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1104
1104
if (!this ->visit (Init))
1105
1105
return false ;
1106
1106
1107
- if (FieldToInit->isBitField ()) {
1108
- if (!this ->emitInitBitField (T, FieldToInit, E))
1109
- return false ;
1110
- } else {
1111
- if (!this ->emitInitField (T, FieldToInit->Offset , E))
1112
- return false ;
1113
- }
1114
- return this ->emitPopPtr (E);
1107
+ if (FieldToInit->isBitField ())
1108
+ return this ->emitInitBitField (T, FieldToInit, E);
1109
+ return this ->emitInitField (T, FieldToInit->Offset , E);
1115
1110
};
1116
1111
1117
1112
auto initCompositeField = [=](const Record::Field *FieldToInit,
@@ -1147,9 +1142,6 @@ bool ByteCodeExprGen<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1147
1142
else
1148
1143
FToInit = cast<CXXParenListInitExpr>(E)->getInitializedFieldInUnion ();
1149
1144
1150
- if (!this ->emitDupPtr (E))
1151
- return false ;
1152
-
1153
1145
const Record::Field *FieldToInit = R->getField (FToInit);
1154
1146
if (std::optional<PrimType> T = classify (Init)) {
1155
1147
if (!initPrimitiveField (FieldToInit, Init, *T))
@@ -1169,8 +1161,6 @@ bool ByteCodeExprGen<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1169
1161
while (InitIndex < R->getNumFields () &&
1170
1162
R->getField (InitIndex)->Decl ->isUnnamedBitField ())
1171
1163
++InitIndex;
1172
- if (!this ->emitDupPtr (E))
1173
- return false ;
1174
1164
1175
1165
if (std::optional<PrimType> T = classify (Init)) {
1176
1166
const Record::Field *FieldToInit = R->getField (InitIndex);
@@ -1180,7 +1170,7 @@ bool ByteCodeExprGen<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1180
1170
} else {
1181
1171
// Initializer for a direct base class.
1182
1172
if (const Record::Base *B = R->getBase (Init->getType ())) {
1183
- if (!this ->emitGetPtrBasePop (B->Offset , Init))
1173
+ if (!this ->emitGetPtrBase (B->Offset , Init))
1184
1174
return false ;
1185
1175
1186
1176
if (!this ->visitInitializer (Init))
@@ -1513,7 +1503,7 @@ bool ByteCodeExprGen<Emitter>::VisitMemberExpr(const MemberExpr *E) {
1513
1503
// Leave a pointer to the field on the stack.
1514
1504
if (F->Decl ->getType ()->isReferenceType ())
1515
1505
return this ->emitGetFieldPop (PT_Ptr, F->Offset , E) && maybeLoadValue ();
1516
- return this ->emitGetPtrField (F->Offset , E) && maybeLoadValue ();
1506
+ return this ->emitGetPtrFieldPop (F->Offset , E) && maybeLoadValue ();
1517
1507
}
1518
1508
1519
1509
return false ;
@@ -2147,9 +2137,6 @@ bool ByteCodeExprGen<Emitter>::VisitLambdaExpr(const LambdaExpr *E) {
2147
2137
if (!this ->emitInitField (*T, F.Offset , E))
2148
2138
return false ;
2149
2139
} else {
2150
- if (!this ->emitDupPtr (E))
2151
- return false ;
2152
-
2153
2140
if (!this ->emitGetPtrField (F.Offset , E))
2154
2141
return false ;
2155
2142
@@ -2846,9 +2833,6 @@ bool ByteCodeExprGen<Emitter>::visitZeroRecordInitializer(const Record *R,
2846
2833
continue ;
2847
2834
}
2848
2835
2849
- // TODO: Add GetPtrFieldPop and get rid of this dup.
2850
- if (!this ->emitDupPtr (E))
2851
- return false ;
2852
2836
if (!this ->emitGetPtrField (Field.Offset , E))
2853
2837
return false ;
2854
2838
@@ -3258,8 +3242,6 @@ bool ByteCodeExprGen<Emitter>::visitAPValueInitializer(const APValue &Val,
3258
3242
PrimType ElemT = classifyPrim (ArrType->getElementType ());
3259
3243
assert (ArrType);
3260
3244
3261
- if (!this ->emitDupPtr (E))
3262
- return false ;
3263
3245
if (!this ->emitGetPtrField (RF->Offset , E))
3264
3246
return false ;
3265
3247
@@ -3273,8 +3255,6 @@ bool ByteCodeExprGen<Emitter>::visitAPValueInitializer(const APValue &Val,
3273
3255
if (!this ->emitPopPtr (E))
3274
3256
return false ;
3275
3257
} else if (F.isStruct () || F.isUnion ()) {
3276
- if (!this ->emitDupPtr (E))
3277
- return false ;
3278
3258
if (!this ->emitGetPtrField (RF->Offset , E))
3279
3259
return false ;
3280
3260
if (!this ->visitAPValueInitializer (F, E))
@@ -4201,8 +4181,6 @@ bool ByteCodeExprGen<Emitter>::emitRecordDestruction(const Record *R) {
4201
4181
for (const Record::Field &Field : llvm::reverse (R->fields ())) {
4202
4182
const Descriptor *D = Field.Desc ;
4203
4183
if (!D->isPrimitive () && !D->isPrimitiveArray ()) {
4204
- if (!this ->emitDupPtr (SourceInfo{}))
4205
- return false ;
4206
4184
if (!this ->emitGetPtrField (Field.Offset , SourceInfo{}))
4207
4185
return false ;
4208
4186
if (!this ->emitDestruction (D))
0 commit comments