Lines Matching refs:CGF
113 ApplyNonVirtualAndVirtualOffset(CodeGenFunction &CGF, llvm::Value *ptr, in ApplyNonVirtualAndVirtualOffset() argument
122 baseOffset = llvm::ConstantInt::get(CGF.PtrDiffTy, in ApplyNonVirtualAndVirtualOffset()
125 baseOffset = CGF.Builder.CreateAdd(virtualOffset, baseOffset); in ApplyNonVirtualAndVirtualOffset()
132 ptr = CGF.Builder.CreateBitCast(ptr, CGF.Int8PtrTy); in ApplyNonVirtualAndVirtualOffset()
133 ptr = CGF.Builder.CreateInBoundsGEP(ptr, baseOffset, "add.ptr"); in ApplyNonVirtualAndVirtualOffset()
345 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
347 cast<CXXMethodDecl>(CGF.CurCodeDecl)->getParent(); in Emit()
351 CGF.GetAddressOfDirectBaseInCompleteClass(CGF.LoadCXXThis(), in Emit()
354 CGF.EmitCXXDestructorCall(D, Dtor_Base, BaseIsVirtual, in Emit()
383 static void EmitBaseInitializer(CodeGenFunction &CGF, in EmitBaseInitializer() argument
390 llvm::Value *ThisPtr = CGF.LoadCXXThis(); in EmitBaseInitializer()
405 if (BaseInitializerUsesThis(CGF.getContext(), BaseInit->getInit())) in EmitBaseInitializer()
406 CGF.InitializeVTablePointers(ClassDecl); in EmitBaseInitializer()
411 CGF.GetAddressOfDirectBaseInCompleteClass(ThisPtr, ClassDecl, in EmitBaseInitializer()
414 CharUnits Alignment = CGF.getContext().getTypeAlignInChars(BaseType); in EmitBaseInitializer()
421 CGF.EmitAggExpr(BaseInit->getInit(), AggSlot); in EmitBaseInitializer()
423 if (CGF.CGM.getLangOpts().Exceptions && in EmitBaseInitializer()
425 CGF.EHStack.pushCleanup<CallBaseDtor>(EHCleanup, BaseClassDecl, in EmitBaseInitializer()
429 static void EmitAggMemberInitializer(CodeGenFunction &CGF, in EmitAggMemberInitializer() argument
443 llvm::Value *ArrayIndex = CGF.Builder.CreateLoad(ArrayIndexVar); in EmitAggMemberInitializer()
444 Dest = CGF.Builder.CreateInBoundsGEP(Dest, ArrayIndex, "destaddress"); in EmitAggMemberInitializer()
446 Next = CGF.Builder.CreateAdd(ArrayIndex, Next, "inc"); in EmitAggMemberInitializer()
447 CGF.Builder.CreateStore(Next, ArrayIndexVar); in EmitAggMemberInitializer()
451 CharUnits Align = CGF.getContext().getTypeAlignInChars(T); in EmitAggMemberInitializer()
455 switch (CGF.getEvaluationKind(T)) { in EmitAggMemberInitializer()
457 CGF.EmitScalarInit(Init, /*decl*/ nullptr, LV, false); in EmitAggMemberInitializer()
460 CGF.EmitComplexExprIntoLValue(Init, LV, /*isInit*/ true); in EmitAggMemberInitializer()
469 CGF.EmitAggExpr(Init, Slot); in EmitAggMemberInitializer()
477 const ConstantArrayType *Array = CGF.getContext().getAsConstantArrayType(T); in EmitAggMemberInitializer()
480 = CGF.GetAddrOfLocalVar(ArrayIndexes[Index]); in EmitAggMemberInitializer()
486 CGF.ConvertType(CGF.getContext().getSizeType())); in EmitAggMemberInitializer()
487 CGF.Builder.CreateStore(Zero, IndexVar); in EmitAggMemberInitializer()
490 llvm::BasicBlock *CondBlock = CGF.createBasicBlock("for.cond"); in EmitAggMemberInitializer()
491 llvm::BasicBlock *AfterFor = CGF.createBasicBlock("for.end"); in EmitAggMemberInitializer()
493 CGF.EmitBlock(CondBlock); in EmitAggMemberInitializer()
495 llvm::BasicBlock *ForBody = CGF.createBasicBlock("for.body"); in EmitAggMemberInitializer()
499 llvm::Value *Counter = CGF.Builder.CreateLoad(IndexVar); in EmitAggMemberInitializer()
502 llvm::Value *IsLess = CGF.Builder.CreateICmpULT(Counter, NumElementsPtr, in EmitAggMemberInitializer()
506 CGF.Builder.CreateCondBr(IsLess, ForBody, AfterFor); in EmitAggMemberInitializer()
508 CGF.EmitBlock(ForBody); in EmitAggMemberInitializer()
509 llvm::BasicBlock *ContinueBlock = CGF.createBasicBlock("for.inc"); in EmitAggMemberInitializer()
513 EmitAggMemberInitializer(CGF, LHS, Init, ArrayIndexVar, in EmitAggMemberInitializer()
516 CGF.EmitBlock(ContinueBlock); in EmitAggMemberInitializer()
520 Counter = CGF.Builder.CreateLoad(IndexVar); in EmitAggMemberInitializer()
521 NextVal = CGF.Builder.CreateAdd(Counter, NextVal, "inc"); in EmitAggMemberInitializer()
522 CGF.Builder.CreateStore(NextVal, IndexVar); in EmitAggMemberInitializer()
525 CGF.EmitBranch(CondBlock); in EmitAggMemberInitializer()
528 CGF.EmitBlock(AfterFor, true); in EmitAggMemberInitializer()
531 static void EmitMemberInitializer(CodeGenFunction &CGF, in EmitMemberInitializer() argument
544 llvm::Value *ThisPtr = CGF.LoadCXXThis(); in EmitMemberInitializer()
545 QualType RecordTy = CGF.getContext().getTypeDeclType(ClassDecl); in EmitMemberInitializer()
546 LValue LHS = CGF.MakeNaturalAlignAddrLValue(ThisPtr, RecordTy); in EmitMemberInitializer()
553 LHS = CGF.EmitLValueForFieldInitialization(LHS, cast<FieldDecl>(I)); in EmitMemberInitializer()
556 LHS = CGF.EmitLValueForFieldInitialization(LHS, Field); in EmitMemberInitializer()
565 = CGF.getContext().getAsConstantArrayType(FieldType); in EmitMemberInitializer()
568 QualType BaseElementTy = CGF.getContext().getBaseElementType(Array); in EmitMemberInitializer()
570 if (BaseElementTy.isPODType(CGF.getContext()) || in EmitMemberInitializer()
576 = CGF.Builder.CreateLoad(CGF.GetAddrOfLocalVar(Args[SrcArgIndex])); in EmitMemberInitializer()
577 LValue ThisRHSLV = CGF.MakeNaturalAlignAddrLValue(SrcPtr, RecordTy); in EmitMemberInitializer()
578 LValue Src = CGF.EmitLValueForFieldInitialization(ThisRHSLV, Field); in EmitMemberInitializer()
581 CGF.EmitAggregateCopy(LHS.getAddress(), Src.getAddress(), FieldType, in EmitMemberInitializer()
590 CGF.EmitInitializerForField(Field, LHS, MemberInit->getInit(), ArrayIndexes); in EmitMemberInitializer()
757 explicit CopyingValueRepresentation(CodeGenFunction &CGF) in CopyingValueRepresentation() argument
758 : CGF(CGF), SO(*CGF.SanOpts), OldSanOpts(CGF.SanOpts) { in CopyingValueRepresentation()
761 CGF.SanOpts = &SO; in CopyingValueRepresentation()
764 CGF.SanOpts = OldSanOpts; in ~CopyingValueRepresentation()
767 CodeGenFunction &CGF; member in __anon20b1ce770211::CopyingValueRepresentation
776 FieldMemcpyizer(CodeGenFunction &CGF, const CXXRecordDecl *ClassDecl, in FieldMemcpyizer() argument
778 : CGF(CGF), ClassDecl(ClassDecl), SrcRec(SrcRec), in FieldMemcpyizer()
779 RecLayout(CGF.getContext().getASTRecordLayout(ClassDecl)), in FieldMemcpyizer()
800 LastField->getBitWidthValue(CGF.getContext()) : in getMemcpySize()
801 CGF.getContext().getTypeSize(LastField->getType()); in getMemcpySize()
804 CGF.getContext().getCharWidth() - 1; in getMemcpySize()
806 CGF.getContext().toCharUnitsFromBits(MemcpySizeBits); in getMemcpySize()
821 CGF.getTypes().getCGRecordLayout(FirstField->getParent()); in emitMemcpy()
825 Alignment = CGF.getContext().getDeclAlign(FirstField); in emitMemcpy()
828 assert((CGF.getContext().toCharUnitsFromBits(FirstFieldOffset) % in emitMemcpy()
832 QualType RecordTy = CGF.getContext().getTypeDeclType(ClassDecl); in emitMemcpy()
833 llvm::Value *ThisPtr = CGF.LoadCXXThis(); in emitMemcpy()
834 LValue DestLV = CGF.MakeNaturalAlignAddrLValue(ThisPtr, RecordTy); in emitMemcpy()
835 LValue Dest = CGF.EmitLValueForFieldInitialization(DestLV, FirstField); in emitMemcpy()
836 llvm::Value *SrcPtr = CGF.Builder.CreateLoad(CGF.GetAddrOfLocalVar(SrcRec)); in emitMemcpy()
837 LValue SrcLV = CGF.MakeNaturalAlignAddrLValue(SrcPtr, RecordTy); in emitMemcpy()
838 LValue Src = CGF.EmitLValueForFieldInitialization(SrcLV, FirstField); in emitMemcpy()
851 CodeGenFunction &CGF; member in __anon20b1ce770311::FieldMemcpyizer
860 llvm::Type::getInt8PtrTy(CGF.getLLVMContext(), DPT->getAddressSpace()); in emitMemcpyIR()
861 DestPtr = CGF.Builder.CreateBitCast(DestPtr, DBP); in emitMemcpyIR()
865 llvm::Type::getInt8PtrTy(CGF.getLLVMContext(), SPT->getAddressSpace()); in emitMemcpyIR()
866 SrcPtr = CGF.Builder.CreateBitCast(SrcPtr, SBP); in emitMemcpyIR()
868 CGF.Builder.CreateMemCpy(DestPtr, SrcPtr, Size.getQuantity(), in emitMemcpyIR()
935 !(FieldType.isTriviallyCopyableType(CGF.getContext()) || in isMemberInitMemcpyable()
948 ConstructorMemcpyizer(CodeGenFunction &CGF, const CXXConstructorDecl *CD, in ConstructorMemcpyizer() argument
950 : FieldMemcpyizer(CGF, CD->getParent(), getTrivialCopySource(CD, Args)), in ConstructorMemcpyizer()
954 CGF.getLangOpts().getGC() == LangOptions::NonGC), in ConstructorMemcpyizer()
963 EmitMemberInitializer(CGF, ConstructorDecl->getParent(), MemberInit, in addMemberInitializer()
973 CopyingValueRepresentation CVR(CGF); in emitAggregatedInits()
974 EmitMemberInitializer(CGF, ConstructorDecl->getParent(), in emitAggregatedInits()
987 llvm::Value *ThisPtr = CGF.LoadCXXThis(); in pushEHDestructors()
988 QualType RecordTy = CGF.getContext().getTypeDeclType(ClassDecl); in pushEHDestructors()
989 LValue LHS = CGF.MakeNaturalAlignAddrLValue(ThisPtr, RecordTy); in pushEHDestructors()
994 if (CGF.needsEHCleanup(dtorKind)) in pushEHDestructors()
995 CGF.pushEHDestroy(dtorKind, LHS.getAddress(), FieldType); in pushEHDestructors()
1089 AssignmentMemcpyizer(CodeGenFunction &CGF, const CXXMethodDecl *AD, in AssignmentMemcpyizer() argument
1091 : FieldMemcpyizer(CGF, AD->getParent(), Args[Args.size() - 1]), in AssignmentMemcpyizer()
1092 AssignmentsMemcpyable(CGF.getLangOpts().getGC() == LangOptions::NonGC) { in AssignmentMemcpyizer()
1103 CGF.EmitStmt(S); in emitAssignment()
1110 CopyingValueRepresentation CVR(CGF); in emitAggregatedStmts()
1111 CGF.EmitStmt(AggregatedStmts[0]); in emitAggregatedStmts()
1364 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
1365 const CXXDestructorDecl *Dtor = cast<CXXDestructorDecl>(CGF.CurCodeDecl); in Emit()
1367 CGF.EmitDeleteCall(Dtor->getOperatorDelete(), CGF.LoadCXXThis(), in Emit()
1368 CGF.getContext().getTagDeclType(ClassDecl)); in Emit()
1380 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
1381 llvm::BasicBlock *callDeleteBB = CGF.createBasicBlock("dtor.call_delete"); in Emit()
1382 llvm::BasicBlock *continueBB = CGF.createBasicBlock("dtor.continue"); in Emit()
1384 = CGF.Builder.CreateIsNull(ShouldDeleteCondition); in Emit()
1385 CGF.Builder.CreateCondBr(ShouldCallDelete, continueBB, callDeleteBB); in Emit()
1387 CGF.EmitBlock(callDeleteBB); in Emit()
1388 const CXXDestructorDecl *Dtor = cast<CXXDestructorDecl>(CGF.CurCodeDecl); in Emit()
1390 CGF.EmitDeleteCall(Dtor->getOperatorDelete(), CGF.LoadCXXThis(), in Emit()
1391 CGF.getContext().getTagDeclType(ClassDecl)); in Emit()
1392 CGF.Builder.CreateBr(continueBB); in Emit()
1394 CGF.EmitBlock(continueBB); in Emit()
1409 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit() argument
1411 llvm::Value *thisValue = CGF.LoadCXXThis(); in Emit()
1412 QualType RecordTy = CGF.getContext().getTagDeclType(field->getParent()); in Emit()
1413 LValue ThisLV = CGF.MakeAddrLValue(thisValue, RecordTy); in Emit()
1414 LValue LV = CGF.EmitLValueForField(ThisLV, field); in Emit()
1417 CGF.emitDestroy(LV.getAddress(), field->getType(), destroyer, in Emit()
1632 void CodeGenFunction::destroyCXXObject(CodeGenFunction &CGF, in destroyCXXObject() argument
1639 CGF.EmitCXXDestructorCall(dtor, Dtor_Complete, /*for vbase*/ false, in destroyCXXObject()
1784 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
1785 CGF.EmitCXXDestructorCall(Dtor, Type, /*ForVirtualBase=*/false, in Emit()
1836 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
1837 CGF.EmitCXXDestructorCall(Dtor, Dtor_Complete, in Emit()