@@ -928,10 +928,9 @@ static bool canEmitInitWithFewStoresAfterBZero(llvm::Constant *Init,
928
928
929
929
// / For inits that canEmitInitWithFewStoresAfterBZero returned true for, emit
930
930
// / the scalar stores that would be required.
931
- static void emitStoresForInitAfterBZero (CodeGenModule &CGM,
932
- llvm::Constant *Init, Address Loc,
933
- bool isVolatile, CGBuilderTy &Builder,
934
- bool IsAutoInit) {
931
+ void CodeGenFunction::emitStoresForInitAfterBZero (llvm::Constant *Init,
932
+ Address Loc, bool isVolatile,
933
+ bool IsAutoInit) {
935
934
assert (!Init->isNullValue () && !isa<llvm::UndefValue>(Init) &&
936
935
" called emitStoresForInitAfterBZero for zero or undef value." );
937
936
@@ -952,8 +951,8 @@ static void emitStoresForInitAfterBZero(CodeGenModule &CGM,
952
951
// If necessary, get a pointer to the element and emit it.
953
952
if (!Elt->isNullValue () && !isa<llvm::UndefValue>(Elt))
954
953
emitStoresForInitAfterBZero (
955
- CGM, Elt, Builder.CreateConstInBoundsGEP2_32 (Loc, 0 , i), isVolatile,
956
- Builder, IsAutoInit);
954
+ Elt, Builder.CreateConstInBoundsGEP2_32 (Loc, 0 , i), isVolatile,
955
+ IsAutoInit);
957
956
}
958
957
return ;
959
958
}
@@ -966,9 +965,9 @@ static void emitStoresForInitAfterBZero(CodeGenModule &CGM,
966
965
967
966
// If necessary, get a pointer to the element and emit it.
968
967
if (!Elt->isNullValue () && !isa<llvm::UndefValue>(Elt))
969
- emitStoresForInitAfterBZero (CGM, Elt,
968
+ emitStoresForInitAfterBZero (Elt,
970
969
Builder.CreateConstInBoundsGEP2_32 (Loc, 0 , i),
971
- isVolatile, Builder, IsAutoInit);
970
+ isVolatile, IsAutoInit);
972
971
}
973
972
}
974
973
@@ -1169,10 +1168,10 @@ static Address createUnnamedGlobalForMemcpyFrom(CodeGenModule &CGM,
1169
1168
return SrcPtr.withElementType (CGM.Int8Ty );
1170
1169
}
1171
1170
1172
- static void emitStoresForConstant (CodeGenModule &CGM, const VarDecl &D,
1173
- Address Loc, bool isVolatile,
1174
- CGBuilderTy &Builder ,
1175
- llvm::Constant *constant, bool IsAutoInit) {
1171
+ void CodeGenFunction:: emitStoresForConstant (const VarDecl &D, Address Loc ,
1172
+ bool isVolatile,
1173
+ llvm::Constant *constant ,
1174
+ bool IsAutoInit) {
1176
1175
auto *Ty = constant->getType ();
1177
1176
uint64_t ConstantSize = CGM.getDataLayout ().getTypeAllocSize (Ty);
1178
1177
if (!ConstantSize)
@@ -1201,8 +1200,7 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
1201
1200
constant->isNullValue () || isa<llvm::UndefValue>(constant);
1202
1201
if (!valueAlreadyCorrect) {
1203
1202
Loc = Loc.withElementType (Ty);
1204
- emitStoresForInitAfterBZero (CGM, constant, Loc, isVolatile, Builder,
1205
- IsAutoInit);
1203
+ emitStoresForInitAfterBZero (constant, Loc, isVolatile, IsAutoInit);
1206
1204
}
1207
1205
return ;
1208
1206
}
@@ -1240,7 +1238,7 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
1240
1238
CharUnits::fromQuantity (Layout->getElementOffset (i));
1241
1239
Address EltPtr = Builder.CreateConstInBoundsByteGEP (
1242
1240
Loc.withElementType (CGM.Int8Ty ), CurOff);
1243
- emitStoresForConstant (CGM, D, EltPtr, isVolatile, Builder ,
1241
+ emitStoresForConstant (D, EltPtr, isVolatile,
1244
1242
constant->getAggregateElement (i), IsAutoInit);
1245
1243
}
1246
1244
return ;
@@ -1251,7 +1249,7 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
1251
1249
for (unsigned i = 0 ; i != ATy->getNumElements (); i++) {
1252
1250
Address EltPtr = Builder.CreateConstGEP (
1253
1251
Loc.withElementType (ATy->getElementType ()), i);
1254
- emitStoresForConstant (CGM, D, EltPtr, isVolatile, Builder ,
1252
+ emitStoresForConstant (D, EltPtr, isVolatile,
1255
1253
constant->getAggregateElement (i), IsAutoInit);
1256
1254
}
1257
1255
return ;
@@ -1269,24 +1267,22 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
1269
1267
I->addAnnotationMetadata (" auto-init" );
1270
1268
}
1271
1269
1272
- static void emitStoresForZeroInit (CodeGenModule &CGM, const VarDecl &D,
1273
- Address Loc, bool isVolatile,
1274
- CGBuilderTy &Builder) {
1270
+ void CodeGenFunction::emitStoresForZeroInit (const VarDecl &D, Address Loc,
1271
+ bool isVolatile) {
1275
1272
llvm::Type *ElTy = Loc.getElementType ();
1276
1273
llvm::Constant *constant =
1277
1274
constWithPadding (CGM, IsPattern::No, llvm::Constant::getNullValue (ElTy));
1278
- emitStoresForConstant (CGM, D, Loc, isVolatile, Builder , constant,
1275
+ emitStoresForConstant (D, Loc, isVolatile, constant,
1279
1276
/* IsAutoInit=*/ true );
1280
1277
}
1281
1278
1282
- static void emitStoresForPatternInit (CodeGenModule &CGM, const VarDecl &D,
1283
- Address Loc, bool isVolatile,
1284
- CGBuilderTy &Builder) {
1279
+ void CodeGenFunction::emitStoresForPatternInit (const VarDecl &D, Address Loc,
1280
+ bool isVolatile) {
1285
1281
llvm::Type *ElTy = Loc.getElementType ();
1286
1282
llvm::Constant *constant = constWithPadding (
1287
1283
CGM, IsPattern::Yes, initializationPatternFor (CGM, ElTy));
1288
1284
assert (!isa<llvm::UndefValue>(constant));
1289
- emitStoresForConstant (CGM, D, Loc, isVolatile, Builder , constant,
1285
+ emitStoresForConstant (D, Loc, isVolatile, constant,
1290
1286
/* IsAutoInit=*/ true );
1291
1287
}
1292
1288
@@ -1829,15 +1825,15 @@ void CodeGenFunction::emitZeroOrPatternForAutoVarInit(QualType type,
1829
1825
if (trivialAutoVarInitMaxSize > 0 &&
1830
1826
allocSize > trivialAutoVarInitMaxSize)
1831
1827
return ;
1832
- emitStoresForZeroInit (CGM, D, Loc, isVolatile, Builder );
1828
+ emitStoresForZeroInit (D, Loc, isVolatile);
1833
1829
break ;
1834
1830
case LangOptions::TrivialAutoVarInitKind::Pattern:
1835
1831
if (CGM.stopAutoInit ())
1836
1832
return ;
1837
1833
if (trivialAutoVarInitMaxSize > 0 &&
1838
1834
allocSize > trivialAutoVarInitMaxSize)
1839
1835
return ;
1840
- emitStoresForPatternInit (CGM, D, Loc, isVolatile, Builder );
1836
+ emitStoresForPatternInit (D, Loc, isVolatile);
1841
1837
break ;
1842
1838
}
1843
1839
return ;
@@ -2052,8 +2048,8 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) {
2052
2048
return EmitStoreThroughLValue (RValue::get (constant), lv, true );
2053
2049
}
2054
2050
2055
- emitStoresForConstant (CGM, D, Loc.withElementType (CGM.Int8Ty ),
2056
- type.isVolatileQualified (), Builder, constant,
2051
+ emitStoresForConstant (D, Loc.withElementType (CGM.Int8Ty ),
2052
+ type.isVolatileQualified (), constant,
2057
2053
/* IsAutoInit=*/ false );
2058
2054
}
2059
2055
0 commit comments