Lines Matching refs:CGF
28 CodeGenFunction &CGF, const CXXMethodDecl *MD, llvm::Value *Callee, in commonEmitCXXMemberOrOperatorCall() argument
42 CGF.EmitTypeCheck( in commonEmitCXXMemberOrOperatorCall()
45 CallLoc, This, CGF.getContext().getRecordType(MD->getParent())); in commonEmitCXXMemberOrOperatorCall()
48 Args.add(RValue::get(This), MD->getThisType(CGF.getContext())); in commonEmitCXXMemberOrOperatorCall()
62 CGF.EmitCallArgs(Args, FPT, drop_begin(CE->arguments(), ArgsToSkip), in commonEmitCXXMemberOrOperatorCall()
350 static void EmitNullBaseClassInitialization(CodeGenFunction &CGF, in EmitNullBaseClassInitialization() argument
356 DestPtr = CGF.Builder.CreateElementBitCast(DestPtr, CGF.Int8Ty); in EmitNullBaseClassInitialization()
358 const ASTRecordLayout &Layout = CGF.getContext().getASTRecordLayout(Base); in EmitNullBaseClassInitialization()
368 CharUnits VBPtrWidth = CGF.getPointerSize(); in EmitNullBaseClassInitialization()
370 CGF.CGM.getCXXABI().getVBPtrOffsets(Base); in EmitNullBaseClassInitialization()
395 llvm::Constant *NullConstantForBase = CGF.CGM.EmitNullConstantForBase(Base); in EmitNullBaseClassInitialization()
398 CGF.CGM.getModule(), NullConstantForBase->getType(), in EmitNullBaseClassInitialization()
406 Address SrcPtr = Address(CGF.EmitCastToVoidPtr(NullVariable), Align); in EmitNullBaseClassInitialization()
412 llvm::Value *StoreSizeVal = CGF.CGM.getSize(StoreSize); in EmitNullBaseClassInitialization()
413 CGF.Builder.CreateMemCpy( in EmitNullBaseClassInitialization()
414 CGF.Builder.CreateConstInBoundsByteGEP(DestPtr, StoreOffset), in EmitNullBaseClassInitialization()
415 CGF.Builder.CreateConstInBoundsByteGEP(SrcPtr, StoreOffset), in EmitNullBaseClassInitialization()
426 llvm::Value *StoreSizeVal = CGF.CGM.getSize(StoreSize); in EmitNullBaseClassInitialization()
427 CGF.Builder.CreateMemSet( in EmitNullBaseClassInitialization()
428 CGF.Builder.CreateConstInBoundsByteGEP(DestPtr, StoreOffset), in EmitNullBaseClassInitialization()
429 CGF.Builder.getInt8(0), StoreSizeVal); in EmitNullBaseClassInitialization()
529 static CharUnits CalculateCookiePadding(CodeGenFunction &CGF, in CalculateCookiePadding() argument
539 return CGF.CGM.getCXXABI().GetArrayCookieSize(E); in CalculateCookiePadding()
542 static llvm::Value *EmitCXXNewAllocSize(CodeGenFunction &CGF, in EmitCXXNewAllocSize() argument
550 CharUnits typeSize = CGF.getContext().getTypeSizeInChars(type); in EmitCXXNewAllocSize()
552 = llvm::ConstantInt::get(CGF.SizeTy, typeSize.getQuantity()); in EmitCXXNewAllocSize()
557 unsigned sizeWidth = CGF.SizeTy->getBitWidth(); in EmitCXXNewAllocSize()
561 CalculateCookiePadding(CGF, e).getQuantity()); in EmitCXXNewAllocSize()
566 numElements = CGF.EmitScalarExpr(e->getArraySize()); in EmitCXXNewAllocSize()
584 = CGF.getContext().getAsConstantArrayType(type)) { in EmitCXXNewAllocSize()
589 CharUnits typeSize = CGF.getContext().getTypeSizeInChars(type); in EmitCXXNewAllocSize()
626 numElements = llvm::ConstantInt::get(CGF.SizeTy, in EmitCXXNewAllocSize()
639 sizeWithoutCookie = llvm::ConstantInt::get(CGF.SizeTy, allocationSize); in EmitCXXNewAllocSize()
647 size = llvm::Constant::getAllOnesValue(CGF.SizeTy); in EmitCXXNewAllocSize()
649 size = llvm::ConstantInt::get(CGF.SizeTy, allocationSize); in EmitCXXNewAllocSize()
679 hasOverflow = CGF.Builder.CreateICmpUGE(numElements, thresholdV); in EmitCXXNewAllocSize()
680 numElements = CGF.Builder.CreateTrunc(numElements, CGF.SizeTy); in EmitCXXNewAllocSize()
685 numElements = CGF.Builder.CreateSExt(numElements, CGF.SizeTy); in EmitCXXNewAllocSize()
693 hasOverflow = CGF.Builder.CreateICmpSLT(numElements, in EmitCXXNewAllocSize()
694 llvm::ConstantInt::get(CGF.SizeTy, minElements)); in EmitCXXNewAllocSize()
698 numElements = CGF.Builder.CreateZExt(numElements, CGF.SizeTy); in EmitCXXNewAllocSize()
701 assert(numElements->getType() == CGF.SizeTy); in EmitCXXNewAllocSize()
706 hasOverflow = CGF.Builder.CreateICmpULT(numElements, in EmitCXXNewAllocSize()
707 llvm::ConstantInt::get(CGF.SizeTy, minElements)); in EmitCXXNewAllocSize()
712 hasOverflow = CGF.Builder.CreateOr(hasOverflow, in EmitCXXNewAllocSize()
713 CGF.Builder.CreateICmpULT(numElements, in EmitCXXNewAllocSize()
714 llvm::ConstantInt::get(CGF.SizeTy, minElements))); in EmitCXXNewAllocSize()
729 = CGF.CGM.getIntrinsic(llvm::Intrinsic::umul_with_overflow, CGF.SizeTy); in EmitCXXNewAllocSize()
732 llvm::ConstantInt::get(CGF.SizeTy, typeSizeMultiplier); in EmitCXXNewAllocSize()
734 CGF.Builder.CreateCall(umul_with_overflow, {size, tsmV}); in EmitCXXNewAllocSize()
736 llvm::Value *overflowed = CGF.Builder.CreateExtractValue(result, 1); in EmitCXXNewAllocSize()
738 hasOverflow = CGF.Builder.CreateOr(hasOverflow, overflowed); in EmitCXXNewAllocSize()
742 size = CGF.Builder.CreateExtractValue(result, 0); in EmitCXXNewAllocSize()
755 llvm::ConstantInt::get(CGF.SizeTy, arraySizeMultiplier); in EmitCXXNewAllocSize()
756 numElements = CGF.Builder.CreateMul(numElements, asmV); in EmitCXXNewAllocSize()
769 = CGF.CGM.getIntrinsic(llvm::Intrinsic::uadd_with_overflow, CGF.SizeTy); in EmitCXXNewAllocSize()
771 llvm::Value *cookieSizeV = llvm::ConstantInt::get(CGF.SizeTy, cookieSize); in EmitCXXNewAllocSize()
773 CGF.Builder.CreateCall(uadd_with_overflow, {size, cookieSizeV}); in EmitCXXNewAllocSize()
775 llvm::Value *overflowed = CGF.Builder.CreateExtractValue(result, 1); in EmitCXXNewAllocSize()
777 hasOverflow = CGF.Builder.CreateOr(hasOverflow, overflowed); in EmitCXXNewAllocSize()
781 size = CGF.Builder.CreateExtractValue(result, 0); in EmitCXXNewAllocSize()
788 size = CGF.Builder.CreateSelect(hasOverflow, in EmitCXXNewAllocSize()
789 llvm::Constant::getAllOnesValue(CGF.SizeTy), in EmitCXXNewAllocSize()
801 static void StoreAnyExprIntoOneUnit(CodeGenFunction &CGF, const Expr *Init, in StoreAnyExprIntoOneUnit() argument
804 switch (CGF.getEvaluationKind(AllocType)) { in StoreAnyExprIntoOneUnit()
806 CGF.EmitScalarInit(Init, nullptr, in StoreAnyExprIntoOneUnit()
807 CGF.MakeAddrLValue(NewPtr, AllocType), false); in StoreAnyExprIntoOneUnit()
810 CGF.EmitComplexExprIntoLValue(Init, CGF.MakeAddrLValue(NewPtr, AllocType), in StoreAnyExprIntoOneUnit()
819 CGF.EmitAggExpr(Init, Slot); in StoreAnyExprIntoOneUnit()
1090 static void EmitNewInitializer(CodeGenFunction &CGF, const CXXNewExpr *E, in EmitNewInitializer() argument
1094 ApplyDebugLocation DL(CGF, E); in EmitNewInitializer()
1096 CGF.EmitNewArrayInitializer(E, ElementType, ElementTy, NewPtr, NumElements, in EmitNewInitializer()
1099 StoreAnyExprIntoOneUnit(CGF, Init, E->getAllocatedType(), NewPtr); in EmitNewInitializer()
1104 static RValue EmitNewDeleteCall(CodeGenFunction &CGF, in EmitNewDeleteCall() argument
1109 llvm::Value *CalleeAddr = CGF.CGM.GetAddrOfFunction(Callee); in EmitNewDeleteCall()
1111 CGF.EmitCall(CGF.CGM.getTypes().arrangeFreeFunctionCall( in EmitNewDeleteCall()
1182 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit() argument
1203 EmitNewDeleteCall(CGF, OperatorDelete, FPT, DeleteArgs); in Emit()
1237 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit() argument
1247 DeleteArgs.add(Ptr.restore(CGF), *AI++); in Emit()
1251 RValue RV = AllocSize.restore(CGF); in Emit()
1257 RValue RV = getPlacementArgs()[I].restore(CGF); in Emit()
1262 EmitNewDeleteCall(CGF, OperatorDelete, FPT, DeleteArgs); in Emit()
1269 static void EnterNewDeleteCleanup(CodeGenFunction &CGF, in EnterNewDeleteCleanup() argument
1276 if (!CGF.isInConditionalBranch()) { in EnterNewDeleteCleanup()
1277 CallDeleteDuringNew *Cleanup = CGF.EHStack in EnterNewDeleteCleanup()
1291 DominatingValue<RValue>::save(CGF, RValue::get(NewPtr.getPointer())); in EnterNewDeleteCleanup()
1293 DominatingValue<RValue>::save(CGF, RValue::get(AllocSize)); in EnterNewDeleteCleanup()
1295 CallDeleteDuringConditionalNew *Cleanup = CGF.EHStack in EnterNewDeleteCleanup()
1303 DominatingValue<RValue>::save(CGF, NewArgs[I+1].RV)); in EnterNewDeleteCleanup()
1305 CGF.initFullExprCleanup(); in EnterNewDeleteCleanup()
1522 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
1523 CGF.EmitDeleteCall(OperatorDelete, Ptr, ElementType); in Emit()
1537 static void EmitObjectDelete(CodeGenFunction &CGF, in EmitObjectDelete() argument
1550 CGF.CGM.getCXXABI().emitVirtualObjectDelete(CGF, DE, Ptr, ElementType, in EmitObjectDelete()
1561 CGF.EHStack.pushCleanup<CallObjectDelete>(NormalAndEHCleanup, in EmitObjectDelete()
1566 CGF.EmitCXXDestructorCall(Dtor, Dtor_Complete, in EmitObjectDelete()
1578 CGF.EmitARCDestroyStrong(Ptr, ARCPreciseLifetime); in EmitObjectDelete()
1582 CGF.EmitARCDestroyWeak(Ptr); in EmitObjectDelete()
1587 CGF.PopCleanupBlock(); in EmitObjectDelete()
1607 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
1617 = CGF.Builder.CreateBitCast(Ptr, CGF.ConvertType(VoidPtrTy)); in Emit()
1624 = cast<llvm::IntegerType>(CGF.ConvertType(size_t)); in Emit()
1627 CGF.CGM.getContext().getTypeSizeInChars(ElementType); in Emit()
1633 Size = CGF.Builder.CreateMul(Size, NumElements); in Emit()
1639 Size = CGF.Builder.CreateAdd(Size, CookieSizeV); in Emit()
1646 EmitNewDeleteCall(CGF, OperatorDelete, DeleteFTy, Args); in Emit()
1652 static void EmitArrayDelete(CodeGenFunction &CGF, in EmitArrayDelete() argument
1659 CGF.CGM.getCXXABI().ReadArrayCookie(CGF, deletedPtr, E, elementType, in EmitArrayDelete()
1666 CGF.EHStack.pushCleanup<CallArrayDelete>(NormalAndEHCleanup, in EmitArrayDelete()
1675 CharUnits elementSize = CGF.getContext().getTypeSizeInChars(elementType); in EmitArrayDelete()
1681 CGF.Builder.CreateInBoundsGEP(arrayBegin, numElements, "delete.end"); in EmitArrayDelete()
1686 CGF.emitArrayDestroy(arrayBegin, arrayEnd, elementType, elementAlign, in EmitArrayDelete()
1687 CGF.getDestroyer(dtorKind), in EmitArrayDelete()
1689 CGF.needsEHCleanup(dtorKind)); in EmitArrayDelete()
1693 CGF.PopCleanupBlock(); in EmitArrayDelete()
1776 static llvm::Value *EmitTypeidFromVTable(CodeGenFunction &CGF, const Expr *E, in EmitTypeidFromVTable() argument
1779 Address ThisPtr = CGF.EmitLValue(E).getAddress(); in EmitTypeidFromVTable()
1790 if (CGF.CGM.getCXXABI().shouldTypeidBeNullChecked( in EmitTypeidFromVTable()
1793 CGF.createBasicBlock("typeid.bad_typeid"); in EmitTypeidFromVTable()
1794 llvm::BasicBlock *EndBlock = CGF.createBasicBlock("typeid.end"); in EmitTypeidFromVTable()
1796 llvm::Value *IsNull = CGF.Builder.CreateIsNull(ThisPtr.getPointer()); in EmitTypeidFromVTable()
1797 CGF.Builder.CreateCondBr(IsNull, BadTypeidBlock, EndBlock); in EmitTypeidFromVTable()
1799 CGF.EmitBlock(BadTypeidBlock); in EmitTypeidFromVTable()
1800 CGF.CGM.getCXXABI().EmitBadTypeidCall(CGF); in EmitTypeidFromVTable()
1801 CGF.EmitBlock(EndBlock); in EmitTypeidFromVTable()
1804 return CGF.CGM.getCXXABI().EmitTypeid(CGF, SrcRecordTy, ThisPtr, in EmitTypeidFromVTable()
1832 static llvm::Value *EmitDynamicCastToNull(CodeGenFunction &CGF, in EmitDynamicCastToNull() argument
1834 llvm::Type *DestLTy = CGF.ConvertType(DestTy); in EmitDynamicCastToNull()
1840 if (!CGF.CGM.getCXXABI().EmitBadCastCall(CGF)) in EmitDynamicCastToNull()
1843 CGF.EmitBlock(CGF.createBasicBlock("dynamic_cast.end")); in EmitDynamicCastToNull()