Lines Matching full:cgf
34 CodeGenFunction &CGF;
58 return CGF.CreateAggTemp(T, "agg.tmp.ensured");
62 Dest = CGF.CreateAggTemp(T, "agg.tmp.ensured");
66 AggExprEmitter(CodeGenFunction &cgf, AggValueSlot Dest, bool IsResultUnused)
67 : CGF(cgf), Builder(CGF.Builder), Dest(Dest),
91 if (CGF.getLangOpts().getGC() && TypeRequiresGCollection(T))
103 ApplyDebugLocation DL(CGF, E);
108 CGF.ErrorUnsupported(S, "aggregate expression");
129 = CGF.tryEmitAsConstant(E)) {
130 EmitFinalDestCopy(E->getType(), result.getReferenceLValue(CGF, E));
173 CodeGenFunction::CXXDefaultInitExprScope Scope(CGF);
189 LValue LV = CGF.EmitPseudoObjectLValue(E);
193 CGF.EmitPseudoObjectRValue(E, EnsureSlot(E->getType()));
201 void VisitCXXThrowExpr(const CXXThrowExpr *E) { CGF.EmitCXXThrowExpr(E); }
203 RValue Res = CGF.EmitAtomicExpr(E);
217 LValue LV = CGF.EmitLValue(E);
220 if (LV.getType()->isAtomicType() || CGF.LValueIsSuitableForInlineAtomic(LV)) {
221 CGF.EmitAtomicLoad(LV, E->getExprLoc(), Dest);
271 LValue srcLV = CGF.MakeAddrLValue(src.getAggregateAddress(), type);
297 CharUnits sz = CGF.getContext().getTypeSizeInChars(type);
298 llvm::Value *size = llvm::ConstantInt::get(CGF.SizeTy, sz.getQuantity());
299 CGF.CGM.getObjCRuntime().EmitGCMemmoveCollectable(CGF,
309 CGF.EmitAggregateCopy(dest.getAddress(), src.getAddress(), type,
319 ASTContext &Ctx = CGF.getContext();
320 LValue Array = CGF.EmitLValue(E->getSubExpr());
332 CGF.ErrorUnsupported(E, "weird std::initializer_list");
340 CGF.ErrorUnsupported(E, "weird std::initializer_list");
345 LValue DestLV = CGF.MakeAddrLValue(Dest.getAddress(), E->getType());
346 LValue Start = CGF.EmitLValueForFieldInitialization(DestLV, *Field);
347 llvm::Value *Zero = llvm::ConstantInt::get(CGF.PtrDiffTy, 0);
351 CGF.EmitStoreThroughLValue(RValue::get(ArrayStart), Start);
355 CGF.ErrorUnsupported(E, "weird std::initializer_list");
360 LValue EndOrLength = CGF.EmitLValueForFieldInitialization(DestLV, *Field);
368 CGF.EmitStoreThroughLValue(RValue::get(ArrayEnd), EndOrLength);
371 CGF.EmitStoreThroughLValue(RValue::get(Size), EndOrLength);
373 CGF.ErrorUnsupported(E, "weird std::initializer_list");
411 llvm::Value *zero = llvm::ConstantInt::get(CGF.SizeTy, 0);
416 CharUnits elementSize = CGF.getContext().getTypeSizeInChars(elementType);
427 if (CGF.needsEHCleanup(dtorKind)) {
432 endOfInit = CGF.CreateTempAlloca(begin->getType(), CGF.getPointerAlign(),
435 CGF.pushIrregularPartialArrayCleanup(begin, endOfInit, elementType,
437 CGF.getDestroyer(dtorKind));
438 cleanup = CGF.EHStack.stable_begin();
445 llvm::Value *one = llvm::ConstantInt::get(CGF.SizeTy, 1);
467 CGF.MakeAddrLValue(Address(element, elementAlign), elementType);
480 CGF.getTypes().isZeroInitializable(elementType))) {
493 llvm::ConstantInt::get(CGF.SizeTy, NumArrayElements),
497 llvm::BasicBlock *bodyBB = CGF.createBasicBlock("arrayinit.body");
500 CGF.EmitBlock(bodyBB);
507 CGF.MakeAddrLValue(Address(currentElement, elementAlign), elementType);
523 llvm::BasicBlock *endBB = CGF.createBasicBlock("arrayinit.end");
527 CGF.EmitBlock(endBB);
531 if (dtorKind) CGF.DeactivateCleanupBlock(cleanup, cleanupDominator);
543 EmitFinalDestCopy(e->getType(), CGF.getOpaqueLValueMapping(e));
549 E->getType().isPODType(CGF.getContext())) {
557 CGF.EmitAggExpr(E->getInitializer(), Slot);
577 CGF.CGM.EmitExplicitCastExprType(ECE, &CGF);
582 LValue LV = CGF.EmitCheckedLValue(E->getSubExpr(),
586 CGF.EmitDynamicCast(LV.getAddress(), cast<CXXDynamicCastExpr>(E));
588 CGF.CGM.ErrorUnsupported(E, "non-simple lvalue dynamic_cast");
591 CGF.CGM.ErrorUnsupported(E, "lvalue dynamic_cast with a destination");
598 CGF.EmitAnyExpr(E->getSubExpr(), AggValueSlot::ignored(),
606 Builder.CreateElementBitCast(Dest.getAddress(), CGF.ConvertType(Ty));
608 CGF.MakeAddrLValue(CastPtr, Ty));
629 assert(CGF.getContext().hasSameUnqualifiedType(valueType,
634 if (Dest.isIgnored() || !CGF.CGM.isPaddedAtomicType(atomicType)) {
643 assert(CGF.getContext().hasSameUnqualifiedType(op->getType(),
653 if (!valueDest.isIgnored() && CGF.CGM.isPaddedAtomicType(atomicType)) {
657 CGF.EmitNullInitialization(Dest.getAddress(), atomicType);
661 CGF.Builder.CreateStructGEP(valueDest.getAddress(), 0,
671 CGF.EmitAggExpr(E->getSubExpr(), valueDest);
678 CGF.CreateAggTemp(atomicType, "atomic-to-nonatomic.temp");
679 CGF.EmitAggExpr(E->getSubExpr(), atomicSlot);
700 assert(CGF.getContext().hasSameUnqualifiedType(E->getSubExpr()->getType(),
758 if (E->getCallReturnType(CGF.getContext())->isReferenceType()) {
763 RValue RV = CGF.EmitCallExpr(E, getReturnValueSlot());
768 RValue RV = CGF.EmitObjCMessageExpr(E, getReturnValueSlot());
773 CGF.EmitIgnoredExpr(E->getLHS());
778 CodeGenFunction::StmtExprEvaluation eval(CGF);
779 CGF.EmitCompoundStmt(*E->getSubStmt(), true, Dest);
786 CGF.ErrorUnsupported(E, "aggregate binary expression");
791 LValue LV = CGF.EmitPointerToDataMemberBinaryExpr(E);
864 assert(CGF.getContext().hasSameUnqualifiedType(E->getLHS()->getType(),
873 E->getRHS()->HasSideEffects(CGF.getContext())) {
879 LValue LHS = CGF.EmitCheckedLValue(E->getLHS(), CodeGenFunction::TCK_Store);
883 CGF.LValueIsSuitableForInlineAtomic(LHS)) {
884 CGF.EmitAtomicStore(Dest.asRValue(), LHS, /*isInit*/ false);
896 LValue LHS = CGF.EmitLValue(E->getLHS());
901 CGF.LValueIsSuitableForInlineAtomic(LHS)) {
904 CGF.EmitAtomicStore(Dest.asRValue(), LHS, /*isInit*/ false);
915 CGF.hasVolatileMember(E->getLHS()->getType()))
918 CGF.EmitAggExpr(E->getRHS(), LHSSlot);
926 llvm::BasicBlock *LHSBlock = CGF.createBasicBlock("cond.true");
927 llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("cond.false");
928 llvm::BasicBlock *ContBlock = CGF.createBasicBlock("cond.end");
931 CodeGenFunction::OpaqueValueMapping binding(CGF, E);
933 CodeGenFunction::ConditionalEvaluation eval(CGF);
934 CGF.EmitBranchOnBoolExpr(E->getCond(), LHSBlock, RHSBlock,
935 CGF.getProfileCount(E));
940 eval.begin(CGF);
941 CGF.EmitBlock(LHSBlock);
942 CGF.incrementProfileCounter(E);
944 eval.end(CGF);
946 assert(CGF.HaveInsertPoint() && "expression evaluation ended with no IP!");
947 CGF.Builder.CreateBr(ContBlock);
955 eval.begin(CGF);
956 CGF.EmitBlock(RHSBlock);
958 eval.end(CGF);
960 CGF.EmitBlock(ContBlock);
969 Address ArgPtr = CGF.EmitVAArg(VE, ArgValue);
973 CGF.ErrorUnsupported(VE, "aggregate va_arg expression");
977 EmitFinalDestCopy(VE->getType(), CGF.MakeAddrLValue(ArgPtr, VE->getType()));
993 CGF.EmitCXXTemporary(E->getTemporary(), E->getType(), Dest.getAddress());
999 CGF.EmitCXXConstructExpr(E, Slot);
1005 CGF.EmitInheritedCXXConstructorCall(
1013 CGF.EmitLambdaExpr(E, Slot);
1017 CGF.enterFullExpression(E);
1018 CodeGenFunction::RunCleanupsScope cleanups(CGF);
1025 EmitNullInitializationToLValue(CGF.MakeAddrLValue(Slot.getAddress(), T));
1031 EmitNullInitializationToLValue(CGF.MakeAddrLValue(Slot.getAddress(), T));
1037 static bool isSimpleZero(const Expr *E, CodeGenFunction &CGF) {
1048 CGF.getTypes().isZeroInitializable(E->getType()))
1067 if (Dest.isZeroed() && isSimpleZero(E, CGF)) {
1076 RValue RV = CGF.EmitReferenceBindingToExpr(E);
1077 return CGF.EmitStoreThroughLValue(RV, LV);
1080 switch (CGF.getEvaluationKind(type)) {
1082 CGF.EmitComplexExprIntoLValue(E, LV, /*isInit*/ true);
1085 CGF.EmitAggExpr(E, AggValueSlot::forLValue(LV,
1093 CGF.EmitScalarInit(E, /*D=*/nullptr, LV, /*Captured=*/false);
1095 CGF.EmitStoreThroughLValue(RValue::get(CGF.EmitScalarExpr(E)), LV);
1107 if (Dest.isZeroed() && CGF.getTypes().isZeroInitializable(type))
1110 if (CGF.hasScalarEvaluationKind(type)) {
1112 llvm::Value *null = CGF.CGM.EmitNullConstant(type);
1116 CGF.EmitStoreThroughBitfieldLValue(RValue::get(null), lv);
1119 CGF.EmitStoreOfScalar(null, lv, /* isInitialization */ true);
1125 CGF.EmitNullInitialization(lv.getAddress(), lv.getType());
1136 if (llvm::Constant* C = CGF.CGM.EmitConstantExpr(E, E->getType(), &CGF)) {
1138 new llvm::GlobalVariable(CGF.CGM.getModule(), C->getType(), true,
1140 EmitFinalDestCopy(E->getType(), CGF.MakeAddrLValue(GV, E->getType()));
1145 CGF.ErrorUnsupported(E, "GNU array range designator extension");
1149 LValue DestLV = CGF.MakeAddrLValue(Dest.getAddress(), E->getType());
1157 CGF.getContext().getAsArrayType(E->getType())->getElementType();
1168 CGF.getContext().hasSameUnqualifiedType(E->getInit(0)->getType(),
1197 Address V = CGF.GetAddressOfDirectBaseInCompleteClass(
1205 CGF.EmitAggExpr(E->getInit(curInitIndex++), AggSlot);
1209 CGF.pushDestroy(dtorKind, V, Base.getType());
1210 cleanups.push_back(CGF.EHStack.stable_begin());
1216 CodeGenFunction::FieldConstructionScope FCS(CGF, Dest.getAddress());
1236 LValue FieldLoc = CGF.EmitLValueForFieldInitialization(DestLV, Field);
1263 CGF.getTypes().isZeroInitializable(E->getType()))
1267 LValue LV = CGF.EmitLValueForFieldInitialization(DestLV, field);
1286 if (CGF.needsEHCleanup(dtorKind)) {
1288 cleanupDominator = CGF.Builder.CreateAlignedLoad(
1289 CGF.Int8Ty,
1290 llvm::Constant::getNullValue(CGF.Int8PtrTy),
1293 CGF.pushDestroy(EHCleanup, LV.getAddress(), field->getType(),
1294 CGF.getDestroyer(dtorKind), false);
1295 cleanups.push_back(CGF.EHStack.stable_begin());
1312 CGF.DeactivateCleanupBlock(cleanups[i-1], cleanupDominator);
1322 LValue DestLV = CGF.MakeAddrLValue(Dest.getAddress(), E->getType());
1334 static CharUnits GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF) {
1338 if (isSimpleZero(E, CGF)) return CharUnits::Zero();
1343 if (!ILE || !CGF.getTypes().isZeroInitializable(ILE->getType()))
1344 return CGF.getContext().getTypeSizeInChars(E->getType());
1358 GetNumNonZeroBytesInInit(ILE->getInit(ILEElement++), CGF);
1372 NumNonZeroBytes += CGF.getContext().toCharUnitsFromBits(
1373 CGF.getTarget().getPointerWidth(0));
1375 NumNonZeroBytes += GetNumNonZeroBytesInInit(E, CGF);
1385 NumNonZeroBytes += GetNumNonZeroBytesInInit(ILE->getInit(i), CGF);
1393 CodeGenFunction &CGF) {
1400 if (CGF.getLangOpts().CPlusPlus)
1401 if (const RecordType *RT = CGF.getContext()
1409 CharUnits Size = CGF.getContext().getTypeSizeInChars(E->getType());
1415 CharUnits NumNonZeroBytes = GetNumNonZeroBytesInInit(E, CGF);
1420 llvm::Constant *SizeVal = CGF.Builder.getInt64(Size.getQuantity());
1423 Loc = CGF.Builder.CreateElementBitCast(Loc, CGF.Int8Ty);
1424 CGF.Builder.CreateMemSet(Loc, CGF.Builder.getInt8(0), SizeVal, false);