Lines Matching refs:CGF
115 void emitVirtualObjectDelete(CodeGenFunction &CGF, const CXXDeleteExpr *DE,
119 void emitRethrow(CodeGenFunction &CGF, bool isNoReturn) override;
120 void emitThrow(CodeGenFunction &CGF, const CXXThrowExpr *E) override;
122 void emitBeginCatch(CodeGenFunction &CGF, const CXXCatchStmt *C) override;
137 void EmitBadTypeidCall(CodeGenFunction &CGF) override;
138 llvm::Value *EmitTypeid(CodeGenFunction &CGF, QualType SrcRecordTy,
145 llvm::Value *EmitDynamicCastCall(CodeGenFunction &CGF, Address Value,
150 llvm::Value *EmitDynamicCastToVoid(CodeGenFunction &CGF, Address Value,
154 bool EmitBadCastCall(CodeGenFunction &CGF) override;
160 GetVirtualBaseClassOffset(CodeGenFunction &CGF, Address This,
165 EmitCtorCompleteObjectHandler(CodeGenFunction &CGF,
168 void initializeHiddenVirtualInheritanceMembers(CodeGenFunction &CGF,
235 adjustThisArgumentForVirtualFunctionCall(CodeGenFunction &CGF, GlobalDecl GD,
239 void addImplicitStructorParams(CodeGenFunction &CGF, QualType &ResTy,
243 CodeGenFunction &CGF, GlobalDecl GD, llvm::Value *This) override;
245 void EmitInstanceFunctionProlog(CodeGenFunction &CGF) override;
247 unsigned addImplicitConstructorArgs(CodeGenFunction &CGF,
253 void EmitDestructorCall(CodeGenFunction &CGF, const CXXDestructorDecl *DD,
263 bool isVirtualOffsetNeededForVTableField(CodeGenFunction &CGF,
277 CodeGenFunction &CGF, const CXXRecordDecl *VTableClass,
287 llvm::Value *getVirtualFunctionPointer(CodeGenFunction &CGF, GlobalDecl GD,
291 llvm::Value *EmitVirtualDestructorCall(CodeGenFunction &CGF,
297 void adjustCallArgsForDestructorThunk(CodeGenFunction &CGF, GlobalDecl GD, in adjustCallArgsForDestructorThunk() argument
301 CallArgs.add(RValue::get(getStructorImplicitParamValue(CGF)), in adjustCallArgsForDestructorThunk()
373 llvm::Value *performThisAdjustment(CodeGenFunction &CGF, Address This,
376 llvm::Value *performReturnAdjustment(CodeGenFunction &CGF, Address Ret,
385 LValue EmitThreadLocalVarDeclLValue(CodeGenFunction &CGF, const VarDecl *VD,
388 void EmitGuardedInit(CodeGenFunction &CGF, const VarDecl &D,
391 void registerGlobalDtor(CodeGenFunction &CGF, const VarDecl &D,
421 Address InitializeArrayCookie(CodeGenFunction &CGF,
426 llvm::Value *readArrayCookieImpl(CodeGenFunction &CGF,
563 llvm::Value *GetVBaseOffsetFromVBPtr(CodeGenFunction &CGF,
569 llvm::Value *GetVBaseOffsetFromVBPtr(CodeGenFunction &CGF, in GetVBaseOffsetFromVBPtr() argument
577 return GetVBaseOffsetFromVBPtr(CGF, Base, VBPOffset, VBTOffset, VBPtr); in GetVBaseOffsetFromVBPtr()
581 performBaseAdjustment(CodeGenFunction &CGF, Address Value,
586 llvm::Value *AdjustVirtualBase(CodeGenFunction &CGF, const Expr *E,
603 void EmitVBPtrStores(CodeGenFunction &CGF, const CXXRecordDecl *RD);
630 llvm::Value *EmitMemberPointerComparison(CodeGenFunction &CGF,
636 llvm::Value *EmitMemberPointerIsNotNull(CodeGenFunction &CGF,
641 EmitMemberDataPointerAddress(CodeGenFunction &CGF, const Expr *E,
651 llvm::Value *EmitMemberPointerConversion(CodeGenFunction &CGF,
664 EmitLoadOfMemberFunctionPointer(CodeGenFunction &CGF, const Expr *E,
851 void MicrosoftCXXABI::emitVirtualObjectDelete(CodeGenFunction &CGF, in emitVirtualObjectDelete() argument
861 EmitVirtualDestructorCall(CGF, Dtor, DtorType, Ptr, /*CE=*/nullptr); in emitVirtualObjectDelete()
863 CGF.EmitDeleteCall(DE->getOperatorDelete(), MDThis, ElementType); in emitVirtualObjectDelete()
866 void MicrosoftCXXABI::emitRethrow(CodeGenFunction &CGF, bool isNoReturn) { in emitRethrow() argument
872 CGF.EmitNoreturnRuntimeCallOrInvoke(Fn, Args); in emitRethrow()
874 CGF.EmitRuntimeCallOrInvoke(Fn, Args); in emitRethrow()
883 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
884 llvm::BasicBlock *BB = CGF.createBasicBlock("catchret.dest"); in Emit()
885 CGF.Builder.CreateCatchRet(CPI, BB); in Emit()
886 CGF.EmitBlock(BB); in Emit()
891 void MicrosoftCXXABI::emitBeginCatch(CodeGenFunction &CGF, in emitBeginCatch() argument
896 llvm::BasicBlock *CatchPadBB = CGF.Builder.GetInsertBlock(); in emitBeginCatch()
899 CGF.CurrentFuncletPad = CPI; in emitBeginCatch()
904 CGF.EHStack.pushCleanup<CatchRetScope>(NormalCleanup, CPI); in emitBeginCatch()
908 CodeGenFunction::AutoVarEmission var = CGF.EmitAutoVarAlloca(*CatchParam); in emitBeginCatch()
909 CPI->setArgOperand(2, var.getObjectAddress(CGF).getPointer()); in emitBeginCatch()
910 CGF.EHStack.pushCleanup<CatchRetScope>(NormalCleanup, CPI); in emitBeginCatch()
911 CGF.EmitAutoVarCleanups(var); in emitBeginCatch()
918 MicrosoftCXXABI::performBaseAdjustment(CodeGenFunction &CGF, Address Value, in performBaseAdjustment() argument
920 Value = CGF.Builder.CreateBitCast(Value, CGF.Int8PtrTy); in performBaseAdjustment()
928 return std::make_pair(Value, llvm::ConstantInt::get(CGF.Int32Ty, 0)); in performBaseAdjustment()
943 GetVirtualBaseClassOffset(CGF, Value, SrcDecl, PolymorphicBase); in performBaseAdjustment()
944 llvm::Value *Ptr = CGF.Builder.CreateInBoundsGEP(Value.getPointer(), Offset); in performBaseAdjustment()
946 CGF.CGM.getVBaseAlignment(Value.getAlignment(), SrcDecl, PolymorphicBase); in performBaseAdjustment()
957 static llvm::CallSite emitRTtypeidCall(CodeGenFunction &CGF, in emitRTtypeidCall() argument
959 llvm::Type *ArgTypes[] = {CGF.Int8PtrTy}; in emitRTtypeidCall()
961 llvm::FunctionType::get(CGF.Int8PtrTy, ArgTypes, false); in emitRTtypeidCall()
963 llvm::Constant *Fn = CGF.CGM.CreateRuntimeFunction(FTy, "__RTtypeid"); in emitRTtypeidCall()
964 return CGF.EmitRuntimeCallOrInvoke(Fn, Args); in emitRTtypeidCall()
967 void MicrosoftCXXABI::EmitBadTypeidCall(CodeGenFunction &CGF) { in EmitBadTypeidCall() argument
969 emitRTtypeidCall(CGF, llvm::Constant::getNullValue(CGM.VoidPtrTy)); in EmitBadTypeidCall()
971 CGF.Builder.CreateUnreachable(); in EmitBadTypeidCall()
974 llvm::Value *MicrosoftCXXABI::EmitTypeid(CodeGenFunction &CGF, in EmitTypeid() argument
979 performBaseAdjustment(CGF, ThisPtr, SrcRecordTy); in EmitTypeid()
980 auto Typeid = emitRTtypeidCall(CGF, ThisPtr.getPointer()).getInstruction(); in EmitTypeid()
981 return CGF.Builder.CreateBitCast(Typeid, StdTypeInfoPtrTy); in EmitTypeid()
992 CodeGenFunction &CGF, Address This, QualType SrcRecordTy, in EmitDynamicCastCall() argument
994 llvm::Type *DestLTy = CGF.ConvertType(DestTy); in EmitDynamicCastCall()
997 CGF.CGM.GetAddrOfRTTIDescriptor(SrcRecordTy.getUnqualifiedType()); in EmitDynamicCastCall()
999 CGF.CGM.GetAddrOfRTTIDescriptor(DestRecordTy.getUnqualifiedType()); in EmitDynamicCastCall()
1002 std::tie(This, Offset) = performBaseAdjustment(CGF, This, SrcRecordTy); in EmitDynamicCastCall()
1004 Offset = CGF.Builder.CreateTrunc(Offset, CGF.Int32Ty); in EmitDynamicCastCall()
1012 llvm::Type *ArgTypes[] = {CGF.Int8PtrTy, CGF.Int32Ty, CGF.Int8PtrTy, in EmitDynamicCastCall()
1013 CGF.Int8PtrTy, CGF.Int32Ty}; in EmitDynamicCastCall()
1014 llvm::Constant *Function = CGF.CGM.CreateRuntimeFunction( in EmitDynamicCastCall()
1015 llvm::FunctionType::get(CGF.Int8PtrTy, ArgTypes, false), in EmitDynamicCastCall()
1019 llvm::ConstantInt::get(CGF.Int32Ty, DestTy->isReferenceType())}; in EmitDynamicCastCall()
1020 ThisPtr = CGF.EmitRuntimeCallOrInvoke(Function, Args).getInstruction(); in EmitDynamicCastCall()
1021 return CGF.Builder.CreateBitCast(ThisPtr, DestLTy); in EmitDynamicCastCall()
1025 MicrosoftCXXABI::EmitDynamicCastToVoid(CodeGenFunction &CGF, Address Value, in EmitDynamicCastToVoid() argument
1028 std::tie(Value, std::ignore) = performBaseAdjustment(CGF, Value, SrcRecordTy); in EmitDynamicCastToVoid()
1032 llvm::Type *ArgTypes[] = {CGF.Int8PtrTy}; in EmitDynamicCastToVoid()
1033 llvm::Constant *Function = CGF.CGM.CreateRuntimeFunction( in EmitDynamicCastToVoid()
1034 llvm::FunctionType::get(CGF.Int8PtrTy, ArgTypes, false), in EmitDynamicCastToVoid()
1037 return CGF.EmitRuntimeCall(Function, Args); in EmitDynamicCastToVoid()
1040 bool MicrosoftCXXABI::EmitBadCastCall(CodeGenFunction &CGF) { in EmitBadCastCall() argument
1045 CodeGenFunction &CGF, Address This, const CXXRecordDecl *ClassDecl, in GetVirtualBaseClassOffset() argument
1059 GetVBaseOffsetFromVBPtr(CGF, This, VBPtrOffset, VBTableOffset); in GetVirtualBaseClassOffset()
1061 CGF.Builder.CreateSExtOrBitCast(VBPtrToNewBase, CGM.PtrDiffTy); in GetVirtualBaseClassOffset()
1062 return CGF.Builder.CreateNSWAdd(VBPtrOffset, VBPtrToNewBase); in GetVirtualBaseClassOffset()
1101 MicrosoftCXXABI::EmitCtorCompleteObjectHandler(CodeGenFunction &CGF, in EmitCtorCompleteObjectHandler() argument
1103 llvm::Value *IsMostDerivedClass = getStructorImplicitParamValue(CGF); in EmitCtorCompleteObjectHandler()
1107 CGF.Builder.CreateIsNotNull(IsMostDerivedClass, "is_complete_object"); in EmitCtorCompleteObjectHandler()
1109 llvm::BasicBlock *CallVbaseCtorsBB = CGF.createBasicBlock("ctor.init_vbases"); in EmitCtorCompleteObjectHandler()
1110 llvm::BasicBlock *SkipVbaseCtorsBB = CGF.createBasicBlock("ctor.skip_vbases"); in EmitCtorCompleteObjectHandler()
1111 CGF.Builder.CreateCondBr(IsCompleteObject, in EmitCtorCompleteObjectHandler()
1114 CGF.EmitBlock(CallVbaseCtorsBB); in EmitCtorCompleteObjectHandler()
1117 EmitVBPtrStores(CGF, RD); in EmitCtorCompleteObjectHandler()
1125 CodeGenFunction &CGF, const CXXRecordDecl *RD) { in initializeHiddenVirtualInheritanceMembers() argument
1142 CGBuilderTy &Builder = CGF.Builder; in initializeHiddenVirtualInheritanceMembers()
1144 unsigned AS = getThisAddress(CGF).getAddressSpace(); in initializeHiddenVirtualInheritanceMembers()
1153 GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, I->first); in initializeHiddenVirtualInheritanceMembers()
1161 VtorDispValue = Builder.CreateTruncOrBitCast(VtorDispValue, CGF.Int32Ty); in initializeHiddenVirtualInheritanceMembers()
1164 Int8This = Builder.CreateBitCast(getThisValue(CGF), in initializeHiddenVirtualInheritanceMembers()
1165 CGF.Int8Ty->getPointerTo(AS)); in initializeHiddenVirtualInheritanceMembers()
1170 VtorDispPtr, CGF.Int32Ty->getPointerTo(AS), "vtordisp.ptr"); in initializeHiddenVirtualInheritanceMembers()
1202 void MicrosoftCXXABI::EmitVBPtrStores(CodeGenFunction &CGF, in EmitVBPtrStores() argument
1204 Address This = getThisAddress(CGF); in EmitVBPtrStores()
1205 This = CGF.Builder.CreateElementBitCast(This, CGM.Int8Ty, "this.int8"); in EmitVBPtrStores()
1219 Address VBPtr = CGF.Builder.CreateConstInBoundsByteGEP(This, Offs); in EmitVBPtrStores()
1221 CGF.Builder.CreateConstInBoundsGEP2_32(GV->getValueType(), GV, 0, 0); in EmitVBPtrStores()
1222 VBPtr = CGF.Builder.CreateElementBitCast(VBPtr, GVPtr->getType(), in EmitVBPtrStores()
1224 CGF.Builder.CreateStore(GVPtr, VBPtr); in EmitVBPtrStores()
1297 CodeGenFunction &CGF, GlobalDecl GD, Address This, in adjustThisArgumentForVirtualFunctionCall() argument
1306 This = CGF.Builder.CreateElementBitCast(This, CGF.Int8Ty); in adjustThisArgumentForVirtualFunctionCall()
1308 return CGF.Builder.CreateConstByteGEP(This, Adjustment); in adjustThisArgumentForVirtualFunctionCall()
1338 Result = CGF.Builder.CreateElementBitCast(Result, CGF.Int8Ty); in adjustThisArgumentForVirtualFunctionCall()
1343 GetVirtualBaseClassOffset(CGF, Result, Derived, VBase); in adjustThisArgumentForVirtualFunctionCall()
1345 CGF.Builder.CreateInBoundsGEP(Result.getPointer(), VBaseOffset); in adjustThisArgumentForVirtualFunctionCall()
1347 CGF.CGM.getVBaseAlignment(Result.getAlignment(), Derived, VBase); in adjustThisArgumentForVirtualFunctionCall()
1352 Result = CGF.Builder.CreateElementBitCast(Result, CGF.Int8Ty); in adjustThisArgumentForVirtualFunctionCall()
1358 Result = CGF.Builder.CreateConstByteGEP(Result, StaticOffset); in adjustThisArgumentForVirtualFunctionCall()
1360 Result = CGF.Builder.CreateConstInBoundsByteGEP(Result, StaticOffset); in adjustThisArgumentForVirtualFunctionCall()
1366 void MicrosoftCXXABI::addImplicitStructorParams(CodeGenFunction &CGF, in addImplicitStructorParams() argument
1370 const CXXMethodDecl *MD = cast<CXXMethodDecl>(CGF.CurGD.getDecl()); in addImplicitStructorParams()
1375 CGF.CurGD.getDecl()->getLocation(), in addImplicitStructorParams()
1385 getStructorImplicitParamDecl(CGF) = IsMostDerived; in addImplicitStructorParams()
1386 } else if (isDeletingDtor(CGF.CurGD)) { in addImplicitStructorParams()
1389 CGF.CurGD.getDecl()->getLocation(), in addImplicitStructorParams()
1393 getStructorImplicitParamDecl(CGF) = ShouldDelete; in addImplicitStructorParams()
1398 CodeGenFunction &CGF, GlobalDecl GD, llvm::Value *This) { in adjustThisParameterInVirtualFunctionPrologue() argument
1409 llvm::Type *charPtrTy = CGF.Int8Ty->getPointerTo(AS), in adjustThisParameterInVirtualFunctionPrologue()
1412 This = CGF.Builder.CreateBitCast(This, charPtrTy); in adjustThisParameterInVirtualFunctionPrologue()
1414 This = CGF.Builder.CreateConstInBoundsGEP1_32(CGF.Int8Ty, This, in adjustThisParameterInVirtualFunctionPrologue()
1416 return CGF.Builder.CreateBitCast(This, thisTy); in adjustThisParameterInVirtualFunctionPrologue()
1419 void MicrosoftCXXABI::EmitInstanceFunctionProlog(CodeGenFunction &CGF) { in EmitInstanceFunctionProlog() argument
1420 EmitThisParam(CGF); in EmitInstanceFunctionProlog()
1430 if (HasThisReturn(CGF.CurGD)) in EmitInstanceFunctionProlog()
1431 CGF.Builder.CreateStore(getThisValue(CGF), CGF.ReturnValue); in EmitInstanceFunctionProlog()
1432 else if (hasMostDerivedReturn(CGF.CurGD)) in EmitInstanceFunctionProlog()
1433 CGF.Builder.CreateStore(CGF.EmitCastToVoidPtr(getThisValue(CGF)), in EmitInstanceFunctionProlog()
1434 CGF.ReturnValue); in EmitInstanceFunctionProlog()
1436 const CXXMethodDecl *MD = cast<CXXMethodDecl>(CGF.CurGD.getDecl()); in EmitInstanceFunctionProlog()
1438 assert(getStructorImplicitParamDecl(CGF) && in EmitInstanceFunctionProlog()
1440 getStructorImplicitParamValue(CGF) in EmitInstanceFunctionProlog()
1441 = CGF.Builder.CreateLoad( in EmitInstanceFunctionProlog()
1442 CGF.GetAddrOfLocalVar(getStructorImplicitParamDecl(CGF)), in EmitInstanceFunctionProlog()
1446 if (isDeletingDtor(CGF.CurGD)) { in EmitInstanceFunctionProlog()
1447 assert(getStructorImplicitParamDecl(CGF) && in EmitInstanceFunctionProlog()
1449 getStructorImplicitParamValue(CGF) in EmitInstanceFunctionProlog()
1450 = CGF.Builder.CreateLoad( in EmitInstanceFunctionProlog()
1451 CGF.GetAddrOfLocalVar(getStructorImplicitParamDecl(CGF)), in EmitInstanceFunctionProlog()
1457 CodeGenFunction &CGF, const CXXConstructorDecl *D, CXXCtorType Type, in addImplicitConstructorArgs() argument
1469 MostDerivedArg = getStructorImplicitParamValue(CGF); in addImplicitConstructorArgs()
1483 void MicrosoftCXXABI::EmitDestructorCall(CodeGenFunction &CGF, in EmitDestructorCall() argument
1492 This = adjustThisArgumentForVirtualFunctionCall(CGF, GlobalDecl(DD, Type), in EmitDestructorCall()
1496 CGF.EmitCXXDestructorCall(DD, Callee, This.getPointer(), in EmitDestructorCall()
1580 CodeGenFunction &CGF, CodeGenFunction::VPtr Vptr) { in isVirtualOffsetNeededForVTableField() argument
1585 CodeGenFunction &CGF, const CXXRecordDecl *VTableClass, BaseSubobject Base, in getVTableAddressPointInStructor() argument
1798 llvm::Value *MicrosoftCXXABI::getVirtualFunctionPointer(CodeGenFunction &CGF, in getVirtualFunctionPointer() argument
1804 CGBuilderTy &Builder = CGF.Builder; in getVirtualFunctionPointer()
1808 adjustThisArgumentForVirtualFunctionCall(CGF, GD, This, true); in getVirtualFunctionPointer()
1811 llvm::Value *VTable = CGF.GetVTablePtr(VPtr, Ty, MethodDecl->getParent()); in getVirtualFunctionPointer()
1816 if (CGF.ShouldEmitVTableTypeCheckedLoad(MethodDecl->getParent())) { in getVirtualFunctionPointer()
1817 return CGF.EmitVTableTypeCheckedLoad( in getVirtualFunctionPointer()
1822 CGF.EmitTypeMetadataCodeForVCall( in getVirtualFunctionPointer()
1827 return Builder.CreateAlignedLoad(VFuncPtr, CGF.getPointerAlign()); in getVirtualFunctionPointer()
1832 CodeGenFunction &CGF, const CXXDestructorDecl *Dtor, CXXDtorType DtorType, in EmitVirtualDestructorCall() argument
1842 llvm::Type *Ty = CGF.CGM.getTypes().GetFunctionType(*FInfo); in EmitVirtualDestructorCall()
1844 CGF, GD, This, Ty, CE ? CE->getLocStart() : SourceLocation()); in EmitVirtualDestructorCall()
1848 llvm::IntegerType::getInt32Ty(CGF.getLLVMContext()), in EmitVirtualDestructorCall()
1851 This = adjustThisArgumentForVirtualFunctionCall(CGF, GD, This, true); in EmitVirtualDestructorCall()
1853 CGF.EmitCXXDestructorCall(Dtor, Callee, This.getPointer(), ImplicitParam, in EmitVirtualDestructorCall()
1927 CodeGenFunction CGF(CGM); in EmitVirtualMemPtrThunk() local
1928 CGF.CurGD = GlobalDecl(MD); in EmitVirtualMemPtrThunk()
1929 CGF.CurFuncIsThunk = true; in EmitVirtualMemPtrThunk()
1934 buildThisParam(CGF, FunctionArgs); in EmitVirtualMemPtrThunk()
1937 CGF.StartFunction(GlobalDecl(), FnInfo.getReturnType(), ThunkFn, FnInfo, in EmitVirtualMemPtrThunk()
1939 EmitThisParam(CGF); in EmitVirtualMemPtrThunk()
1943 llvm::Value *VTable = CGF.GetVTablePtr( in EmitVirtualMemPtrThunk()
1944 getThisAddress(CGF), ThunkTy->getPointerTo()->getPointerTo(), MD->getParent()); in EmitVirtualMemPtrThunk()
1947 CGF.Builder.CreateConstInBoundsGEP1_64(VTable, ML.Index, "vfn"); in EmitVirtualMemPtrThunk()
1949 CGF.Builder.CreateAlignedLoad(VFuncPtr, CGF.getPointerAlign()); in EmitVirtualMemPtrThunk()
1951 CGF.EmitMustTailThunk(MD, getThisValue(CGF), Callee); in EmitVirtualMemPtrThunk()
2043 llvm::Value *MicrosoftCXXABI::performThisAdjustment(CodeGenFunction &CGF, in performThisAdjustment() argument
2049 This = CGF.Builder.CreateElementBitCast(This, CGF.Int8Ty); in performThisAdjustment()
2058 CGF.Builder.CreateConstInBoundsByteGEP(This, in performThisAdjustment()
2060 VtorDispPtr = CGF.Builder.CreateElementBitCast(VtorDispPtr, CGF.Int32Ty); in performThisAdjustment()
2061 llvm::Value *VtorDisp = CGF.Builder.CreateLoad(VtorDispPtr, "vtordisp"); in performThisAdjustment()
2062 V = CGF.Builder.CreateGEP(This.getPointer(), in performThisAdjustment()
2063 CGF.Builder.CreateNeg(VtorDisp)); in performThisAdjustment()
2077 GetVBaseOffsetFromVBPtr(CGF, Address(V, CGF.getPointerAlign()), in performThisAdjustment()
2080 V = CGF.Builder.CreateInBoundsGEP(VBPtr, VBaseOffset); in performThisAdjustment()
2088 V = CGF.Builder.CreateConstGEP1_32(V, TA.NonVirtual); in performThisAdjustment()
2096 MicrosoftCXXABI::performReturnAdjustment(CodeGenFunction &CGF, Address Ret, in performReturnAdjustment() argument
2102 Ret = CGF.Builder.CreateElementBitCast(Ret, CGF.Int8Ty); in performReturnAdjustment()
2107 int32_t IntSize = CGF.getIntSize().getQuantity(); in performReturnAdjustment()
2110 GetVBaseOffsetFromVBPtr(CGF, Ret, RA.Virtual.Microsoft.VBPtrOffset, in performReturnAdjustment()
2112 V = CGF.Builder.CreateInBoundsGEP(VBPtr, VBaseOffset); in performReturnAdjustment()
2116 V = CGF.Builder.CreateConstInBoundsGEP1_32(CGF.Int8Ty, V, RA.NonVirtual); in performReturnAdjustment()
2119 return CGF.Builder.CreateBitCast(V, OrigTy); in performReturnAdjustment()
2143 llvm::Value *MicrosoftCXXABI::readArrayCookieImpl(CodeGenFunction &CGF, in readArrayCookieImpl() argument
2147 CGF.Builder.CreateElementBitCast(allocPtr, CGF.SizeTy); in readArrayCookieImpl()
2148 return CGF.Builder.CreateLoad(numElementsPtr); in readArrayCookieImpl()
2151 Address MicrosoftCXXABI::InitializeArrayCookie(CodeGenFunction &CGF, in InitializeArrayCookie() argument
2166 = CGF.Builder.CreateElementBitCast(cookiePtr, CGF.SizeTy); in InitializeArrayCookie()
2167 CGF.Builder.CreateStore(numElements, numElementsPtr); in InitializeArrayCookie()
2171 return CGF.Builder.CreateConstInBoundsByteGEP(newPtr, cookieSize); in InitializeArrayCookie()
2174 static void emitGlobalDtorWithTLRegDtor(CodeGenFunction &CGF, const VarDecl &VD, in emitGlobalDtorWithTLRegDtor() argument
2178 llvm::Constant *DtorStub = CGF.createAtExitStub(VD, Dtor, Addr); in emitGlobalDtorWithTLRegDtor()
2182 CGF.IntTy, DtorStub->getType(), /*IsVarArg=*/false); in emitGlobalDtorWithTLRegDtor()
2185 CGF.CGM.CreateRuntimeFunction(TLRegDtorTy, "__tlregdtor"); in emitGlobalDtorWithTLRegDtor()
2189 CGF.EmitNounwindRuntimeCall(TLRegDtor, DtorStub); in emitGlobalDtorWithTLRegDtor()
2192 void MicrosoftCXXABI::registerGlobalDtor(CodeGenFunction &CGF, const VarDecl &D, in registerGlobalDtor() argument
2196 return emitGlobalDtorWithTLRegDtor(CGF, D, Dtor, Addr); in registerGlobalDtor()
2199 CGF.registerGlobalDtorWithAtExit(D, Dtor, Addr); in registerGlobalDtor()
2246 LValue MicrosoftCXXABI::EmitThreadLocalVarDeclLValue(CodeGenFunction &CGF, in EmitThreadLocalVarDeclLValue() argument
2249 CGF.CGM.ErrorUnsupported(VD, "thread wrappers"); in EmitThreadLocalVarDeclLValue()
2307 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
2310 CGBuilderTy &Builder = CGF.Builder; in Emit()
2313 llvm::ConstantInt::get(CGF.IntTy, ~(1ULL << GuardNum)); in Emit()
2322 void Emit(CodeGenFunction &CGF, Flags flags) override { in Emit()
2324 CGF.EmitNounwindRuntimeCall(getInitThreadAbortFn(CGF.CGM), Guard); in Emit()
2329 void MicrosoftCXXABI::EmitGuardedInit(CodeGenFunction &CGF, const VarDecl &D, in EmitGuardedInit() argument
2336 llvm::Function *F = CGF.CurFn; in EmitGuardedInit()
2339 CGF.EmitCXXGlobalVarDeclInit(D, GV, PerformInit); in EmitGuardedInit()
2350 CGBuilderTy &Builder = CGF.Builder; in EmitGuardedInit()
2351 llvm::IntegerType *GuardTy = CGF.Int32Ty; in EmitGuardedInit()
2379 ErrorUnsupportedABI(CGF, "more than 32 guarded initializations"); in EmitGuardedInit()
2430 llvm::BasicBlock *InitBlock = CGF.createBasicBlock("init"); in EmitGuardedInit()
2431 llvm::BasicBlock *EndBlock = CGF.createBasicBlock("init.end"); in EmitGuardedInit()
2436 CGF.EmitBlock(InitBlock); in EmitGuardedInit()
2438 CGF.EHStack.pushCleanup<ResetGuardBit>(EHCleanup, GuardAddr, GuardNum); in EmitGuardedInit()
2439 CGF.EmitCXXGlobalVarDeclInit(D, GV, PerformInit); in EmitGuardedInit()
2440 CGF.PopCleanupBlock(); in EmitGuardedInit()
2444 CGF.EmitBlock(EndBlock); in EmitGuardedInit()
2465 llvm::BasicBlock *AttemptInitBlock = CGF.createBasicBlock("init.attempt"); in EmitGuardedInit()
2466 llvm::BasicBlock *EndBlock = CGF.createBasicBlock("init.end"); in EmitGuardedInit()
2471 CGF.EmitBlock(AttemptInitBlock); in EmitGuardedInit()
2472 CGF.EmitNounwindRuntimeCall(getInitThreadHeaderFn(CGM), in EmitGuardedInit()
2478 llvm::BasicBlock *InitBlock = CGF.createBasicBlock("init"); in EmitGuardedInit()
2482 CGF.EmitBlock(InitBlock); in EmitGuardedInit()
2483 CGF.EHStack.pushCleanup<CallInitThreadAbort>(EHCleanup, GuardAddr); in EmitGuardedInit()
2484 CGF.EmitCXXGlobalVarDeclInit(D, GV, PerformInit); in EmitGuardedInit()
2485 CGF.PopCleanupBlock(); in EmitGuardedInit()
2486 CGF.EmitNounwindRuntimeCall(getInitThreadFooterFn(CGM), in EmitGuardedInit()
2490 CGF.EmitBlock(EndBlock); in EmitGuardedInit()
2719 MicrosoftCXXABI::EmitMemberPointerComparison(CodeGenFunction &CGF, in EmitMemberPointerComparison() argument
2724 CGBuilderTy &Builder = CGF.Builder; in EmitMemberPointerComparison()
2779 MicrosoftCXXABI::EmitMemberPointerIsNotNull(CodeGenFunction &CGF, in EmitMemberPointerIsNotNull() argument
2782 CGBuilderTy &Builder = CGF.Builder; in EmitMemberPointerIsNotNull()
2841 MicrosoftCXXABI::GetVBaseOffsetFromVBPtr(CodeGenFunction &CGF, in GetVBaseOffsetFromVBPtr() argument
2846 CGBuilderTy &Builder = CGF.Builder; in GetVBaseOffsetFromVBPtr()
2860 VBPtrAlign = CGF.getPointerAlign(); in GetVBaseOffsetFromVBPtr()
2880 CodeGenFunction &CGF, const Expr *E, const CXXRecordDecl *RD, in AdjustVirtualBase() argument
2882 CGBuilderTy &Builder = CGF.Builder; in AdjustVirtualBase()
2894 VBaseAdjustBB = CGF.createBasicBlock("memptr.vadjust"); in AdjustVirtualBase()
2895 SkipAdjustBB = CGF.createBasicBlock("memptr.skip_vadjust"); in AdjustVirtualBase()
2900 CGF.EmitBlock(VBaseAdjustBB); in AdjustVirtualBase()
2908 DiagnosticsEngine &Diags = CGF.CGM.getDiags(); in AdjustVirtualBase()
2920 GetVBaseOffsetFromVBPtr(CGF, Base, VBPtrOffset, VBTableOffset, &VBPtr); in AdjustVirtualBase()
2926 CGF.EmitBlock(SkipAdjustBB); in AdjustVirtualBase()
2936 CodeGenFunction &CGF, const Expr *E, Address Base, llvm::Value *MemPtr, in EmitMemberDataPointerAddress() argument
2941 CGF.ConvertTypeForMem(MPT->getPointeeType())->getPointerTo(AS); in EmitMemberDataPointerAddress()
2942 CGBuilderTy &Builder = CGF.Builder; in EmitMemberDataPointerAddress()
2963 Addr = AdjustVirtualBase(CGF, E, RD, Base, VirtualBaseAdjustmentOffset, in EmitMemberDataPointerAddress()
2970 Addr = Builder.CreateBitCast(Addr, CGF.Int8Ty->getPointerTo(AS)); in EmitMemberDataPointerAddress()
2981 MicrosoftCXXABI::EmitMemberPointerConversion(CodeGenFunction &CGF, in EmitMemberPointerConversion() argument
3010 CGBuilderTy &Builder = CGF.Builder; in EmitMemberPointerConversion()
3013 llvm::Value *IsNotNull = EmitMemberPointerIsNotNull(CGF, Src, SrcTy); in EmitMemberPointerConversion()
3026 llvm::BasicBlock *ConvertBB = CGF.createBasicBlock("memptr.convert"); in EmitMemberPointerConversion()
3027 llvm::BasicBlock *ContinueBB = CGF.createBasicBlock("memptr.converted"); in EmitMemberPointerConversion()
3029 CGF.EmitBlock(ConvertBB); in EmitMemberPointerConversion()
3038 CGF.EmitBlock(ContinueBB); in EmitMemberPointerConversion()
3226 CodeGenFunction &CGF, const Expr *E, Address This, in EmitLoadOfMemberFunctionPointer() argument
3235 CGBuilderTy &Builder = CGF.Builder; in EmitLoadOfMemberFunctionPointer()
3258 ThisPtrForCall = AdjustVirtualBase(CGF, E, RD, This, in EmitLoadOfMemberFunctionPointer()
3266 llvm::Value *Ptr = Builder.CreateBitCast(ThisPtrForCall, CGF.Int8PtrTy); in EmitLoadOfMemberFunctionPointer()
3820 CodeGenFunction CGF(CGM); in getAddrOfCXXCtorClosure() local
3821 CGF.CurGD = GlobalDecl(CD, Ctor_Complete); in getAddrOfCXXCtorClosure()
3827 buildThisParam(CGF, FunctionArgs); in getAddrOfCXXCtorClosure()
3849 CGF.StartFunction(GlobalDecl(), FnInfo.getReturnType(), ThunkFn, FnInfo, in getAddrOfCXXCtorClosure()
3851 EmitThisParam(CGF); in getAddrOfCXXCtorClosure()
3852 llvm::Value *This = getThisValue(CGF); in getAddrOfCXXCtorClosure()
3855 IsCopy ? CGF.Builder.CreateLoad(CGF.GetAddrOfLocalVar(&SrcParam), "src") in getAddrOfCXXCtorClosure()
3875 CodeGenFunction::RunCleanupsScope Cleanups(CGF); in getAddrOfCXXCtorClosure()
3878 CGF.EmitCallArgs(Args, FPT, llvm::makeArrayRef(ArgVec), CD, IsCopy ? 1 : 0); in getAddrOfCXXCtorClosure()
3881 unsigned ExtraArgs = addImplicitConstructorArgs(CGF, CD, Ctor_Complete, in getAddrOfCXXCtorClosure()
3889 CGF.EmitCall(CalleeInfo, CalleeFn, ReturnValueSlot(), Args, CD); in getAddrOfCXXCtorClosure()
3895 CGF.FinishFunction(SourceLocation()); in getAddrOfCXXCtorClosure()
4172 void MicrosoftCXXABI::emitThrow(CodeGenFunction &CGF, const CXXThrowExpr *E) { in emitThrow() argument
4177 Address AI = CGF.CreateMemTemp(ThrowType); in emitThrow()
4178 CGF.EmitAnyExprToMem(SubExpr, AI, ThrowType.getQualifiers(), in emitThrow()
4187 CGF.Builder.CreateBitCast(AI.getPointer(), CGM.Int8PtrTy), in emitThrow()
4190 CGF.EmitNoreturnRuntimeCallOrInvoke(getThrowFn(), Args); in emitThrow()