Lines Matching refs:llvm

39   SmallVector<llvm::GlobalVariable *, 2> Globals;
75 llvm::Value *Ptr, QualType ElementType,
83 llvm::GlobalVariable *getMSCompleteObjectLocator(const CXXRecordDecl *RD,
86 llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty) override;
87 llvm::Constant *
92 llvm::Value *EmitTypeid(CodeGenFunction &CGF, QualType SrcRecordTy,
93 llvm::Value *ThisPtr,
94 llvm::Type *StdTypeInfoPtrTy) override;
99 llvm::Value *EmitDynamicCastCall(CodeGenFunction &CGF, llvm::Value *Value,
102 llvm::BasicBlock *CastEnd) override;
104 llvm::Value *EmitDynamicCastToVoid(CodeGenFunction &CGF, llvm::Value *Value,
110 llvm::Value *
111 GetVirtualBaseClassOffset(CodeGenFunction &CGF, llvm::Value *This,
115 llvm::BasicBlock *
185 llvm::Value *
187 llvm::Value *This,
193 llvm::Value *adjustThisParameterInVirtualFunctionPrologue(
194 CodeGenFunction &CGF, GlobalDecl GD, llvm::Value *This) override;
206 bool Delegating, llvm::Value *This) override;
211 llvm::Value *getVTableAddressPointInStructor(
216 llvm::Constant *
220 llvm::GlobalVariable *getAddrOfVTable(const CXXRecordDecl *RD,
223 llvm::Value *getVirtualFunctionPointer(CodeGenFunction &CGF, GlobalDecl GD,
224 llvm::Value *This,
225 llvm::Type *Ty) override;
227 llvm::Value *EmitVirtualDestructorCall(CodeGenFunction &CGF,
230 llvm::Value *This,
243 llvm::GlobalVariable *
245 llvm::GlobalVariable::LinkageTypes Linkage);
248 llvm::GlobalVariable *GV) const;
250 void setThunkLinkage(llvm::Function *Thunk, bool ForVTable, in setThunkLinkage()
253 Thunk->setDLLStorageClass(llvm::GlobalValue::DefaultStorageClass); in setThunkLinkage()
259 Thunk->setLinkage(llvm::GlobalValue::InternalLinkage); in setThunkLinkage()
261 Thunk->setLinkage(llvm::GlobalValue::WeakODRLinkage); in setThunkLinkage()
263 Thunk->setLinkage(llvm::GlobalValue::LinkOnceODRLinkage); in setThunkLinkage()
266 llvm::Value *performThisAdjustment(CodeGenFunction &CGF, llvm::Value *This,
269 llvm::Value *performReturnAdjustment(CodeGenFunction &CGF, llvm::Value *Ret,
274 ArrayRef<std::pair<const VarDecl *, llvm::GlobalVariable *>>
276 ArrayRef<llvm::Function *> CXXThreadLocalInits,
277 ArrayRef<llvm::GlobalVariable *> CXXThreadLocalInitVars) override;
284 llvm::GlobalVariable *DeclPtr,
287 llvm::Constant *Dtor, llvm::Constant *Addr) override;
316 llvm::Value *InitializeArrayCookie(CodeGenFunction &CGF,
317 llvm::Value *NewPtr,
318 llvm::Value *NumElements,
321 llvm::Value *readArrayCookieImpl(CodeGenFunction &CGF,
322 llvm::Value *allocPtr,
332 llvm::StructType *getTypeDescriptorType(StringRef TypeInfoString) { in getTypeDescriptorType()
333 llvm::SmallString<32> TDTypeName("rtti.TypeDescriptor"); in getTypeDescriptorType()
334 TDTypeName += llvm::utostr(TypeInfoString.size()); in getTypeDescriptorType()
335 llvm::StructType *&TypeDescriptorType = in getTypeDescriptorType()
339 llvm::Type *FieldTypes[] = { in getTypeDescriptorType()
342 llvm::ArrayType::get(CGM.Int8Ty, TypeInfoString.size() + 1)}; in getTypeDescriptorType()
344 llvm::StructType::create(CGM.getLLVMContext(), FieldTypes, TDTypeName); in getTypeDescriptorType()
348 llvm::Type *getImageRelativeType(llvm::Type *PtrType) { in getImageRelativeType()
354 llvm::StructType *getBaseClassDescriptorType() { in getBaseClassDescriptorType()
357 llvm::Type *FieldTypes[] = { in getBaseClassDescriptorType()
366 BaseClassDescriptorType = llvm::StructType::create( in getBaseClassDescriptorType()
371 llvm::StructType *getClassHierarchyDescriptorType() { in getClassHierarchyDescriptorType()
375 ClassHierarchyDescriptorType = llvm::StructType::create( in getClassHierarchyDescriptorType()
377 llvm::Type *FieldTypes[] = { in getClassHierarchyDescriptorType()
388 llvm::StructType *getCompleteObjectLocatorType() { in getCompleteObjectLocatorType()
391 CompleteObjectLocatorType = llvm::StructType::create( in getCompleteObjectLocatorType()
393 llvm::Type *FieldTypes[] = { in getCompleteObjectLocatorType()
401 llvm::ArrayRef<llvm::Type *> FieldTypesRef(FieldTypes); in getCompleteObjectLocatorType()
408 llvm::GlobalVariable *getImageBase() { in getImageBase()
410 if (llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(Name)) in getImageBase()
413 return new llvm::GlobalVariable(CGM.getModule(), CGM.Int8Ty, in getImageBase()
415 llvm::GlobalValue::ExternalLinkage, in getImageBase()
419 llvm::Constant *getImageRelativeConstant(llvm::Constant *PtrVal) { in getImageRelativeConstant()
424 return llvm::Constant::getNullValue(CGM.IntTy); in getImageRelativeConstant()
426 llvm::Constant *ImageBaseAsInt = in getImageRelativeConstant()
427 llvm::ConstantExpr::getPtrToInt(getImageBase(), CGM.IntPtrTy); in getImageRelativeConstant()
428 llvm::Constant *PtrValAsInt = in getImageRelativeConstant()
429 llvm::ConstantExpr::getPtrToInt(PtrVal, CGM.IntPtrTy); in getImageRelativeConstant()
430 llvm::Constant *Diff = in getImageRelativeConstant()
431 llvm::ConstantExpr::getSub(PtrValAsInt, ImageBaseAsInt, in getImageRelativeConstant()
433 return llvm::ConstantExpr::getTrunc(Diff, CGM.IntTy); in getImageRelativeConstant()
441 llvm::Constant *getZeroInt() { in getZeroInt()
442 return llvm::ConstantInt::get(CGM.IntTy, 0); in getZeroInt()
445 llvm::Constant *getAllOnesInt() { in getAllOnesInt()
446 return llvm::Constant::getAllOnesValue(CGM.IntTy); in getAllOnesInt()
449 llvm::Constant *getConstantOrZeroInt(llvm::Constant *C) { in getConstantOrZeroInt()
453 llvm::Value *getValueOrZeroInt(llvm::Value *C) { in getValueOrZeroInt()
461 llvm::SmallVectorImpl<llvm::Constant *> &fields);
466 llvm::Value *GetVBaseOffsetFromVBPtr(CodeGenFunction &CGF,
467 llvm::Value *Base,
468 llvm::Value *VBPtrOffset,
469 llvm::Value *VBTableOffset,
470 llvm::Value **VBPtr = nullptr);
472 llvm::Value *GetVBaseOffsetFromVBPtr(CodeGenFunction &CGF, in GetVBaseOffsetFromVBPtr()
473 llvm::Value *Base, in GetVBaseOffsetFromVBPtr()
476 llvm::Value **VBPtr = nullptr) { in GetVBaseOffsetFromVBPtr()
478 llvm::Value *VBPOffset = llvm::ConstantInt::get(CGM.IntTy, VBPtrOffset), in GetVBaseOffsetFromVBPtr()
479 *VBTOffset = llvm::ConstantInt::get(CGM.IntTy, VBTableOffset); in GetVBaseOffsetFromVBPtr()
483 std::pair<llvm::Value *, llvm::Value *>
484 performBaseAdjustment(CodeGenFunction &CGF, llvm::Value *Value,
489 llvm::Value *AdjustVirtualBase(CodeGenFunction &CGF, const Expr *E,
490 const CXXRecordDecl *RD, llvm::Value *Base,
491 llvm::Value *VirtualBaseAdjustmentOffset,
492 llvm::Value *VBPtrOffset /* optional */);
496 llvm::Constant *EmitFullMemberPointer(llvm::Constant *FirstField,
501 llvm::Constant *BuildMemberPointer(const CXXRecordDecl *RD,
506 llvm::Constant *MP);
515 llvm::Function *EmitVirtualMemPtrThunk(
520 llvm::Type *ConvertMemberPointerType(const MemberPointerType *MPT) override;
540 llvm::Constant *EmitNullMemberPointer(const MemberPointerType *MPT) override;
542 llvm::Constant *EmitMemberDataPointer(const MemberPointerType *MPT,
544 llvm::Constant *EmitMemberPointer(const CXXMethodDecl *MD) override;
545 llvm::Constant *EmitMemberPointer(const APValue &MP, QualType MPT) override;
547 llvm::Value *EmitMemberPointerComparison(CodeGenFunction &CGF,
548 llvm::Value *L,
549 llvm::Value *R,
553 llvm::Value *EmitMemberPointerIsNotNull(CodeGenFunction &CGF,
554 llvm::Value *MemPtr,
557 llvm::Value *
559 llvm::Value *Base, llvm::Value *MemPtr,
562 llvm::Value *EmitMemberPointerConversion(CodeGenFunction &CGF,
564 llvm::Value *Src) override;
566 llvm::Constant *EmitMemberPointerConversion(const CastExpr *E,
567 llvm::Constant *Src) override;
569 llvm::Value *
571 llvm::Value *&This, llvm::Value *MemPtr,
576 llvm::StructType *getCatchHandlerTypeType() { in getCatchHandlerTypeType()
578 llvm::Type *FieldTypes[] = { in getCatchHandlerTypeType()
582 CatchHandlerTypeType = llvm::StructType::create( in getCatchHandlerTypeType()
588 llvm::StructType *getCatchableTypeType() { in getCatchableTypeType()
591 llvm::Type *FieldTypes[] = { in getCatchableTypeType()
600 CatchableTypeType = llvm::StructType::create( in getCatchableTypeType()
605 llvm::StructType *getCatchableTypeArrayType(uint32_t NumEntries) { in getCatchableTypeArrayType()
606 llvm::StructType *&CatchableTypeArrayType = in getCatchableTypeArrayType()
611 llvm::SmallString<23> CTATypeName("eh.CatchableTypeArray."); in getCatchableTypeArrayType()
612 CTATypeName += llvm::utostr(NumEntries); in getCatchableTypeArrayType()
613 llvm::Type *CTType = in getCatchableTypeArrayType()
615 llvm::Type *FieldTypes[] = { in getCatchableTypeArrayType()
617 llvm::ArrayType::get(CTType, NumEntries) // CatchableTypes in getCatchableTypeArrayType()
620 llvm::StructType::create(CGM.getLLVMContext(), FieldTypes, CTATypeName); in getCatchableTypeArrayType()
624 llvm::StructType *getThrowInfoType() { in getThrowInfoType()
627 llvm::Type *FieldTypes[] = { in getThrowInfoType()
633 ThrowInfoType = llvm::StructType::create(CGM.getLLVMContext(), FieldTypes, in getThrowInfoType()
638 llvm::Constant *getThrowFn() { in getThrowFn()
641 llvm::Type *Args[] = {CGM.Int8PtrTy, getThrowInfoType()->getPointerTo()}; in getThrowFn()
642 llvm::FunctionType *FTy = in getThrowFn()
643 llvm::FunctionType::get(CGM.VoidTy, Args, /*IsVarArgs=*/false); in getThrowFn()
644 auto *Fn = cast<llvm::Function>( in getThrowFn()
647 if (CGM.getTarget().getTriple().getArch() == llvm::Triple::x86) in getThrowFn()
648 Fn->setCallingConv(llvm::CallingConv::X86_StdCall); in getThrowFn()
652 llvm::Function *getAddrOfCXXCtorClosure(const CXXConstructorDecl *CD,
655 llvm::Constant *getCatchableType(QualType T,
660 llvm::GlobalVariable *getCatchableTypeArray(QualType T);
662 llvm::GlobalVariable *getThrowInfo(QualType T) override;
666 typedef llvm::DenseMap<VFTableIdTy, llvm::GlobalVariable *> VTablesMapTy;
667 typedef llvm::DenseMap<VFTableIdTy, llvm::GlobalValue *> VFTablesMapTy;
673 llvm::SmallPtrSet<const CXXRecordDecl *, 4> DeferredVFTables;
677 llvm::DenseMap<const CXXRecordDecl *, VBTableGlobals> VBTablesMap;
683 llvm::GlobalVariable *Guard;
689 llvm::DenseMap<const DeclContext *, GuardInfo> GuardVariableMap;
691 llvm::DenseMap<size_t, llvm::StructType *> TypeDescriptorTypeMap;
692 llvm::StructType *BaseClassDescriptorType;
693 llvm::StructType *ClassHierarchyDescriptorType;
694 llvm::StructType *CompleteObjectLocatorType;
696 llvm::DenseMap<QualType, llvm::GlobalVariable *> CatchableTypeArrays;
698 llvm::StructType *CatchableTypeType;
699 llvm::DenseMap<uint32_t, llvm::StructType *> CatchableTypeArrayTypeMap;
700 llvm::StructType *ThrowInfoType;
701 llvm::StructType *CatchHandlerTypeType;
713 case llvm::Triple::x86: in getRecordArgABI()
727 case llvm::Triple::x86_64: in getRecordArgABI()
769 llvm::Value *Ptr, in emitVirtualObjectDelete()
776 llvm::Value *MDThis = in emitVirtualObjectDelete()
783 llvm::Value *Args[] = { in emitRethrow()
784 llvm::ConstantPointerNull::get(CGM.Int8PtrTy), in emitRethrow()
785 llvm::ConstantPointerNull::get(getThrowInfoType()->getPointerTo())}; in emitRethrow()
798 CGF.CGM.getIntrinsic(llvm::Intrinsic::eh_endcatch)); in Emit()
808 llvm::Value *Exn = CGF.getExceptionFromSlot(); in emitBeginCatch()
809 llvm::Function *BeginCatch = in emitBeginCatch()
810 CGF.CGM.getIntrinsic(llvm::Intrinsic::eh_begincatch); in emitBeginCatch()
815 llvm::Value *Args[2] = {Exn, llvm::Constant::getNullValue(CGF.Int8PtrTy)}; in emitBeginCatch()
822 llvm::Value *ParamAddr = in emitBeginCatch()
824 llvm::Value *Args[2] = {Exn, ParamAddr}; in emitBeginCatch()
831 std::pair<llvm::Value *, llvm::Value *>
832 MicrosoftCXXABI::performBaseAdjustment(CodeGenFunction &CGF, llvm::Value *Value, in performBaseAdjustment()
839 return std::make_pair(Value, llvm::ConstantInt::get(CGF.Int32Ty, 0)); in performBaseAdjustment()
848 llvm::Value *Offset = GetVirtualBaseClassOffset( in performBaseAdjustment()
862 static llvm::CallSite emitRTtypeidCall(CodeGenFunction &CGF, in emitRTtypeidCall()
863 llvm::Value *Argument) { in emitRTtypeidCall()
864 llvm::Type *ArgTypes[] = {CGF.Int8PtrTy}; in emitRTtypeidCall()
865 llvm::FunctionType *FTy = in emitRTtypeidCall()
866 llvm::FunctionType::get(CGF.Int8PtrTy, ArgTypes, false); in emitRTtypeidCall()
867 llvm::Value *Args[] = {Argument}; in emitRTtypeidCall()
868 llvm::Constant *Fn = CGF.CGM.CreateRuntimeFunction(FTy, "__RTtypeid"); in emitRTtypeidCall()
873 llvm::CallSite Call = in EmitBadTypeidCall()
874 emitRTtypeidCall(CGF, llvm::Constant::getNullValue(CGM.VoidPtrTy)); in EmitBadTypeidCall()
879 llvm::Value *MicrosoftCXXABI::EmitTypeid(CodeGenFunction &CGF, in EmitTypeid()
881 llvm::Value *ThisPtr, in EmitTypeid()
882 llvm::Type *StdTypeInfoPtrTy) { in EmitTypeid()
883 llvm::Value *Offset; in EmitTypeid()
896 llvm::Value *MicrosoftCXXABI::EmitDynamicCastCall( in EmitDynamicCastCall()
897 CodeGenFunction &CGF, llvm::Value *Value, QualType SrcRecordTy, in EmitDynamicCastCall()
898 QualType DestTy, QualType DestRecordTy, llvm::BasicBlock *CastEnd) { in EmitDynamicCastCall()
899 llvm::Type *DestLTy = CGF.ConvertType(DestTy); in EmitDynamicCastCall()
901 llvm::Value *SrcRTTI = in EmitDynamicCastCall()
903 llvm::Value *DestRTTI = in EmitDynamicCastCall()
906 llvm::Value *Offset; in EmitDynamicCastCall()
915 llvm::Type *ArgTypes[] = {CGF.Int8PtrTy, CGF.Int32Ty, CGF.Int8PtrTy, in EmitDynamicCastCall()
917 llvm::Constant *Function = CGF.CGM.CreateRuntimeFunction( in EmitDynamicCastCall()
918 llvm::FunctionType::get(CGF.Int8PtrTy, ArgTypes, false), in EmitDynamicCastCall()
920 llvm::Value *Args[] = { in EmitDynamicCastCall()
922 llvm::ConstantInt::get(CGF.Int32Ty, DestTy->isReferenceType())}; in EmitDynamicCastCall()
927 llvm::Value *
928 MicrosoftCXXABI::EmitDynamicCastToVoid(CodeGenFunction &CGF, llvm::Value *Value, in EmitDynamicCastToVoid()
931 llvm::Value *Offset; in EmitDynamicCastToVoid()
936 llvm::Type *ArgTypes[] = {CGF.Int8PtrTy}; in EmitDynamicCastToVoid()
937 llvm::Constant *Function = CGF.CGM.CreateRuntimeFunction( in EmitDynamicCastToVoid()
938 llvm::FunctionType::get(CGF.Int8PtrTy, ArgTypes, false), in EmitDynamicCastToVoid()
940 llvm::Value *Args[] = {Value}; in EmitDynamicCastToVoid()
948 llvm::Value *MicrosoftCXXABI::GetVirtualBaseClassOffset( in GetVirtualBaseClassOffset()
949 CodeGenFunction &CGF, llvm::Value *This, const CXXRecordDecl *ClassDecl, in GetVirtualBaseClassOffset()
954 llvm::Value *VBPtrOffset = llvm::ConstantInt::get(CGM.PtrDiffTy, VBPtrChars); in GetVirtualBaseClassOffset()
959 llvm::Value *VBTableOffset = in GetVirtualBaseClassOffset()
960 llvm::ConstantInt::get(CGM.IntTy, VBTableChars.getQuantity()); in GetVirtualBaseClassOffset()
962 llvm::Value *VBPtrToNewBase = in GetVirtualBaseClassOffset()
1003 llvm::BasicBlock *
1006 llvm::Value *IsMostDerivedClass = getStructorImplicitParamValue(CGF); in EmitCtorCompleteObjectHandler()
1009 llvm::Value *IsCompleteObject = in EmitCtorCompleteObjectHandler()
1012 llvm::BasicBlock *CallVbaseCtorsBB = CGF.createBasicBlock("ctor.init_vbases"); in EmitCtorCompleteObjectHandler()
1013 llvm::BasicBlock *SkipVbaseCtorsBB = CGF.createBasicBlock("ctor.skip_vbases"); in EmitCtorCompleteObjectHandler()
1048 cast<llvm::PointerType>(getThisValue(CGF)->getType())->getAddressSpace(); in initializeHiddenVirtualInheritanceMembers()
1049 llvm::Value *Int8This = nullptr; // Initialize lazily. in initializeHiddenVirtualInheritanceMembers()
1056 llvm::Value *VBaseOffset = in initializeHiddenVirtualInheritanceMembers()
1065 llvm::Value *VtorDispValue = Builder.CreateSub( in initializeHiddenVirtualInheritanceMembers()
1066 VBaseOffset, llvm::ConstantInt::get(CGM.Int32Ty, ConstantVBaseOffset), in initializeHiddenVirtualInheritanceMembers()
1072 llvm::Value *VtorDispPtr = Builder.CreateInBoundsGEP(Int8This, VBaseOffset); in initializeHiddenVirtualInheritanceMembers()
1101 llvm::Function *Fn = getAddrOfCXXCtorClosure(D, Ctor_DefaultClosure); in EmitCXXConstructors()
1102 Fn->setLinkage(llvm::GlobalValue::WeakODRLinkage); in EmitCXXConstructors()
1103 Fn->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); in EmitCXXConstructors()
1109 llvm::Value *ThisInt8Ptr = in EmitVBPtrStores()
1117 llvm::GlobalVariable *GV = VBGlobals.Globals[I]; in EmitVBPtrStores()
1124 llvm::Value *VBPtr = in EmitVBPtrStores()
1126 llvm::Value *GVPtr = in EmitVBPtrStores()
1202 llvm::Value *MicrosoftCXXABI::adjustThisArgumentForVirtualFunctionCall( in adjustThisArgumentForVirtualFunctionCall()
1203 CodeGenFunction &CGF, GlobalDecl GD, llvm::Value *This, bool VirtualCall) { in adjustThisArgumentForVirtualFunctionCall()
1211 unsigned AS = cast<llvm::PointerType>(This->getType())->getAddressSpace(); in adjustThisArgumentForVirtualFunctionCall()
1212 llvm::Type *charPtrTy = CGF.Int8Ty->getPointerTo(AS); in adjustThisArgumentForVirtualFunctionCall()
1235 unsigned AS = cast<llvm::PointerType>(This->getType())->getAddressSpace(); in adjustThisArgumentForVirtualFunctionCall()
1236 llvm::Type *charPtrTy = CGF.Int8Ty->getPointerTo(AS); in adjustThisArgumentForVirtualFunctionCall()
1247 llvm::Value *VBaseOffset = in adjustThisArgumentForVirtualFunctionCall()
1299 llvm::Value *MicrosoftCXXABI::adjustThisParameterInVirtualFunctionPrologue( in adjustThisParameterInVirtualFunctionPrologue()
1300 CodeGenFunction &CGF, GlobalDecl GD, llvm::Value *This) { in adjustThisParameterInVirtualFunctionPrologue()
1310 unsigned AS = cast<llvm::PointerType>(This->getType())->getAddressSpace(); in adjustThisParameterInVirtualFunctionPrologue()
1311 llvm::Type *charPtrTy = CGF.Int8Ty->getPointerTo(AS), in adjustThisParameterInVirtualFunctionPrologue()
1369 llvm::Value *MostDerivedArg = in addImplicitConstructorArgs()
1370 llvm::ConstantInt::get(CGM.Int32Ty, Type == Ctor_Complete); in addImplicitConstructorArgs()
1386 bool Delegating, llvm::Value *This) { in EmitDestructorCall()
1387 llvm::Value *Callee = CGM.getAddrOfCXXStructor(DD, getFromDtorType(Type)); in EmitDestructorCall()
1408 llvm::GlobalVariable *VTable = getAddrOfVTable(RD, Info->FullOffsetInMDC); in emitVTableDefinitions()
1412 llvm::Constant *RTTI = getContext().getLangOpts().RTTIData in emitVTableDefinitions()
1418 llvm::Constant *Init = CGVT.CreateVTableInitializer( in emitVTableDefinitions()
1427 llvm::Value *MicrosoftCXXABI::getVTableAddressPointInStructor( in getVTableAddressPointInStructor()
1434 llvm::GlobalValue *VTableAddressPoint = VFTablesMap[ID]; in getVTableAddressPointInStructor()
1445 llvm::raw_svector_ostream Out(Name); in mangleVFTableName()
1449 llvm::Constant *MicrosoftCXXABI::getVTableAddressPointForConstExpr( in getVTableAddressPointForConstExpr()
1453 llvm::GlobalValue *VFTable = VFTablesMap[ID]; in getVTableAddressPointForConstExpr()
1458 llvm::GlobalVariable *MicrosoftCXXABI::getAddrOfVTable(const CXXRecordDecl *RD, in getAddrOfVTable()
1470 llvm::GlobalVariable *&VTable = I->second; in getAddrOfVTable()
1483 llvm::StringSet<> ObservedMangledNames; in getAddrOfVTable()
1506 llvm::GlobalValue::LinkageTypes VFTableLinkage = CGM.getVTableLinkage(RD); in getAddrOfVTable()
1508 llvm::GlobalValue::isAvailableExternallyLinkage(VFTableLinkage) || in getAddrOfVTable()
1509 llvm::GlobalValue::isExternalLinkage(VFTableLinkage); in getAddrOfVTable()
1513 if (llvm::GlobalValue *VFTable = in getAddrOfVTable()
1517 ? cast<llvm::GlobalVariable>( in getAddrOfVTable()
1518 cast<llvm::GlobalAlias>(VFTable)->getBaseObject()) in getAddrOfVTable()
1519 : cast<llvm::GlobalVariable>(VFTable); in getAddrOfVTable()
1525 llvm::GlobalValue::LinkageTypes VTableLinkage = in getAddrOfVTable()
1526 VTableAliasIsRequred ? llvm::GlobalValue::PrivateLinkage : VFTableLinkage; in getAddrOfVTable()
1530 llvm::ArrayType *VTableType = in getAddrOfVTable()
1531 llvm::ArrayType::get(CGM.Int8PtrTy, NumVTableSlots); in getAddrOfVTable()
1535 llvm::GlobalValue *VFTable; in getAddrOfVTable()
1536 VTable = new llvm::GlobalVariable(CGM.getModule(), VTableType, in getAddrOfVTable()
1541 llvm::Comdat *C = nullptr; in getAddrOfVTable()
1543 (llvm::GlobalValue::isWeakForLinker(VFTableLinkage) || in getAddrOfVTable()
1544 (llvm::GlobalValue::isLocalLinkage(VFTableLinkage) && in getAddrOfVTable()
1552 llvm::Value *GEPIndices[] = {llvm::ConstantInt::get(CGM.IntTy, 0), in getAddrOfVTable()
1553 llvm::ConstantInt::get(CGM.IntTy, 1)}; in getAddrOfVTable()
1556 llvm::Constant *VTableGEP = llvm::ConstantExpr::getInBoundsGetElementPtr( in getAddrOfVTable()
1558 if (llvm::GlobalValue::isWeakForLinker(VFTableLinkage)) { in getAddrOfVTable()
1559 VFTableLinkage = llvm::GlobalValue::ExternalLinkage; in getAddrOfVTable()
1561 C->setSelectionKind(llvm::Comdat::Largest); in getAddrOfVTable()
1563 VFTable = llvm::GlobalAlias::create( in getAddrOfVTable()
1564 cast<llvm::SequentialType>(VTableGEP->getType())->getElementType(), in getAddrOfVTable()
1579 VFTable->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass); in getAddrOfVTable()
1581 VFTable->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); in getAddrOfVTable()
1587 llvm::Value *MicrosoftCXXABI::getVirtualFunctionPointer(CodeGenFunction &CGF, in getVirtualFunctionPointer()
1589 llvm::Value *This, in getVirtualFunctionPointer()
1590 llvm::Type *Ty) { in getVirtualFunctionPointer()
1595 llvm::Value *VPtr = in getVirtualFunctionPointer()
1597 llvm::Value *VTable = CGF.GetVTablePtr(VPtr, Ty); in getVirtualFunctionPointer()
1601 llvm::Value *VFuncPtr = in getVirtualFunctionPointer()
1606 llvm::Value *MicrosoftCXXABI::EmitVirtualDestructorCall( in EmitVirtualDestructorCall()
1608 llvm::Value *This, const CXXMemberCallExpr *CE) { in EmitVirtualDestructorCall()
1617 llvm::Type *Ty = CGF.CGM.getTypes().GetFunctionType(*FInfo); in EmitVirtualDestructorCall()
1618 llvm::Value *Callee = getVirtualFunctionPointer(CGF, GD, This, Ty); in EmitVirtualDestructorCall()
1621 llvm::Value *ImplicitParam = llvm::ConstantInt::get( in EmitVirtualDestructorCall()
1622 llvm::IntegerType::getInt32Ty(CGF.getLLVMContext()), in EmitVirtualDestructorCall()
1636 llvm::DenseMap<const CXXRecordDecl*, VBTableGlobals>::iterator Entry; in enumerateVBTables()
1649 llvm::GlobalVariable::LinkageTypes Linkage = CGM.getVTableLinkage(RD); in enumerateVBTables()
1659 llvm::Function *MicrosoftCXXABI::EmitVirtualMemPtrThunk( in EmitVirtualMemPtrThunk()
1667 llvm::raw_svector_ostream Out(ThunkName); in EmitVirtualMemPtrThunk()
1672 if (llvm::GlobalValue *GV = CGM.getModule().getNamedValue(ThunkName)) in EmitVirtualMemPtrThunk()
1673 return cast<llvm::Function>(GV); in EmitVirtualMemPtrThunk()
1677 llvm::FunctionType *ThunkTy = CGM.getTypes().GetFunctionType(FnInfo); in EmitVirtualMemPtrThunk()
1678 llvm::Function *ThunkFn = in EmitVirtualMemPtrThunk()
1679 llvm::Function::Create(ThunkTy, llvm::Function::ExternalLinkage, in EmitVirtualMemPtrThunk()
1684 ? llvm::GlobalValue::LinkOnceODRLinkage in EmitVirtualMemPtrThunk()
1685 : llvm::GlobalValue::InternalLinkage); in EmitVirtualMemPtrThunk()
1718 llvm::Value *VTable = CGF.GetVTablePtr( in EmitVirtualMemPtrThunk()
1720 llvm::Value *VFuncPtr = in EmitVirtualMemPtrThunk()
1722 llvm::Value *Callee = CGF.Builder.CreateLoad(VFuncPtr); in EmitVirtualMemPtrThunk()
1733 llvm::GlobalVariable *GV = VBGlobals.Globals[I]; in emitVirtualInheritanceTables()
1739 llvm::GlobalVariable *
1741 llvm::GlobalVariable::LinkageTypes Linkage) { in getAddrOfVBTable()
1743 llvm::raw_svector_ostream Out(OutName); in getAddrOfVBTable()
1748 llvm::ArrayType *VBTableType = in getAddrOfVBTable()
1749 llvm::ArrayType::get(CGM.IntTy, 1 + VBT.ReusingBase->getNumVBases()); in getAddrOfVBTable()
1753 llvm::GlobalVariable *GV = in getAddrOfVBTable()
1758 GV->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass); in getAddrOfVBTable()
1760 GV->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); in getAddrOfVBTable()
1770 llvm::GlobalVariable *GV) const { in emitVBTableDefinition()
1780 SmallVector<llvm::Constant *, 4> Offsets(1 + ReusingBase->getNumVBases(), in emitVBTableDefinition()
1785 Offsets[0] = llvm::ConstantInt::get(CGM.IntTy, -VBPtrOffset.getQuantity()); in emitVBTableDefinition()
1802 Offsets[VBIndex] = llvm::ConstantInt::get(CGM.IntTy, Offset.getQuantity()); in emitVBTableDefinition()
1806 cast<llvm::ArrayType>(cast<llvm::PointerType>(GV->getType()) in emitVBTableDefinition()
1808 llvm::ArrayType *VBTableType = in emitVBTableDefinition()
1809 llvm::ArrayType::get(CGM.IntTy, Offsets.size()); in emitVBTableDefinition()
1810 llvm::Constant *Init = llvm::ConstantArray::get(VBTableType, Offsets); in emitVBTableDefinition()
1814 llvm::Value *MicrosoftCXXABI::performThisAdjustment(CodeGenFunction &CGF, in performThisAdjustment()
1815 llvm::Value *This, in performThisAdjustment()
1820 llvm::Value *V = CGF.Builder.CreateBitCast(This, CGF.Int8PtrTy); in performThisAdjustment()
1825 llvm::Value *VtorDispPtr = in performThisAdjustment()
1829 llvm::Value *VtorDisp = CGF.Builder.CreateLoad(VtorDispPtr, "vtordisp"); in performThisAdjustment()
1838 llvm::Value *VBPtr; in performThisAdjustment()
1839 llvm::Value *VBaseOffset = in performThisAdjustment()
1857 llvm::Value *
1858 MicrosoftCXXABI::performReturnAdjustment(CodeGenFunction &CGF, llvm::Value *Ret, in performReturnAdjustment()
1863 llvm::Value *V = CGF.Builder.CreateBitCast(Ret, CGF.Int8PtrTy); in performReturnAdjustment()
1869 llvm::Value *VBPtr; in performReturnAdjustment()
1870 llvm::Value *VBaseOffset = in performReturnAdjustment()
1904 llvm::Value *MicrosoftCXXABI::readArrayCookieImpl(CodeGenFunction &CGF, in readArrayCookieImpl()
1905 llvm::Value *allocPtr, in readArrayCookieImpl()
1908 llvm::Value *numElementsPtr = in readArrayCookieImpl()
1913 llvm::Value* MicrosoftCXXABI::InitializeArrayCookie(CodeGenFunction &CGF, in InitializeArrayCookie()
1914 llvm::Value *newPtr, in InitializeArrayCookie()
1915 llvm::Value *numElements, in InitializeArrayCookie()
1924 llvm::Value *cookiePtr = newPtr; in InitializeArrayCookie()
1928 llvm::Value *numElementsPtr in InitializeArrayCookie()
1939 llvm::Constant *Dtor, in emitGlobalDtorWithTLRegDtor()
1940 llvm::Constant *Addr) { in emitGlobalDtorWithTLRegDtor()
1942 llvm::Constant *DtorStub = CGF.createAtExitStub(VD, Dtor, Addr); in emitGlobalDtorWithTLRegDtor()
1945 llvm::FunctionType *TLRegDtorTy = llvm::FunctionType::get( in emitGlobalDtorWithTLRegDtor()
1948 llvm::Constant *TLRegDtor = in emitGlobalDtorWithTLRegDtor()
1950 if (llvm::Function *TLRegDtorFn = dyn_cast<llvm::Function>(TLRegDtor)) in emitGlobalDtorWithTLRegDtor()
1957 llvm::Constant *Dtor, in registerGlobalDtor()
1958 llvm::Constant *Addr) { in registerGlobalDtor()
1968 ArrayRef<std::pair<const VarDecl *, llvm::GlobalVariable *>> in EmitThreadLocalInitFuncs()
1970 ArrayRef<llvm::Function *> CXXThreadLocalInits, in EmitThreadLocalInitFuncs()
1971 ArrayRef<llvm::GlobalVariable *> CXXThreadLocalInitVars) { in EmitThreadLocalInitFuncs()
1975 auto AddToXDU = [&CGM](llvm::Function *InitFunc) { in EmitThreadLocalInitFuncs()
1976 llvm::GlobalVariable *InitFuncPtr = new llvm::GlobalVariable( in EmitThreadLocalInitFuncs()
1978 llvm::GlobalVariable::InternalLinkage, InitFunc, in EmitThreadLocalInitFuncs()
1987 std::vector<llvm::Function *> NonComdatInits; in EmitThreadLocalInitFuncs()
1989 llvm::GlobalVariable *GV = CXXThreadLocalInitVars[I]; in EmitThreadLocalInitFuncs()
1990 llvm::Function *F = CXXThreadLocalInits[I]; in EmitThreadLocalInitFuncs()
1993 if (llvm::Comdat *C = GV->getComdat()) in EmitThreadLocalInitFuncs()
2000 llvm::FunctionType *FTy = in EmitThreadLocalInitFuncs()
2001 llvm::FunctionType::get(CGM.VoidTy, /*isVarArg=*/false); in EmitThreadLocalInitFuncs()
2002 llvm::Function *InitFunc = CGM.CreateGlobalInitOrDestructFunction( in EmitThreadLocalInitFuncs()
2019 llvm::GlobalVariable *GV, in EmitGuardedInit()
2025 llvm::Function *F = CGF.CurFn; in EmitGuardedInit()
2026 F->setLinkage(llvm::GlobalValue::LinkOnceODRLinkage); in EmitGuardedInit()
2041 llvm::IntegerType *GuardTy = CGF.Int32Ty; in EmitGuardedInit()
2042 llvm::ConstantInt *Zero = llvm::ConstantInt::get(GuardTy, 0); in EmitGuardedInit()
2071 llvm::raw_svector_ostream Out(GuardName); in EmitGuardedInit()
2079 new llvm::GlobalVariable(CGM.getModule(), GuardTy, false, in EmitGuardedInit()
2098 llvm::ConstantInt *Bit = llvm::ConstantInt::get(GuardTy, 1U << BitIndex); in EmitGuardedInit()
2099 llvm::LoadInst *LI = Builder.CreateLoad(GI->Guard); in EmitGuardedInit()
2100 llvm::Value *IsInitialized = in EmitGuardedInit()
2102 llvm::BasicBlock *InitBlock = CGF.createBasicBlock("init"); in EmitGuardedInit()
2103 llvm::BasicBlock *EndBlock = CGF.createBasicBlock("init.end"); in EmitGuardedInit()
2132 llvm::Type *
2136 llvm::SmallVector<llvm::Type *, 4> fields; in ConvertMemberPointerType()
2152 return llvm::StructType::get(CGM.getLLVMContext(), fields); in ConvertMemberPointerType()
2157 llvm::SmallVectorImpl<llvm::Constant *> &fields) { in GetNullMemberPointerFields()
2163 fields.push_back(llvm::Constant::getNullValue(CGM.VoidPtrTy)); in GetNullMemberPointerFields()
2180 llvm::Constant *
2182 llvm::SmallVector<llvm::Constant *, 4> fields; in EmitNullMemberPointer()
2186 llvm::Constant *Res = llvm::ConstantStruct::getAnon(fields); in EmitNullMemberPointer()
2191 llvm::Constant *
2192 MicrosoftCXXABI::EmitFullMemberPointer(llvm::Constant *FirstField, in EmitFullMemberPointer()
2204 llvm::SmallVector<llvm::Constant *, 4> fields; in EmitFullMemberPointer()
2208 fields.push_back(llvm::ConstantInt::get( in EmitFullMemberPointer()
2215 fields.push_back(llvm::ConstantInt::get(CGM.IntTy, Offs.getQuantity())); in EmitFullMemberPointer()
2222 return llvm::ConstantStruct::getAnon(fields); in EmitFullMemberPointer()
2225 llvm::Constant *
2229 llvm::Constant *FirstField = in EmitMemberDataPointer()
2230 llvm::ConstantInt::get(CGM.IntTy, offset.getQuantity()); in EmitMemberDataPointer()
2235 llvm::Constant *MicrosoftCXXABI::EmitMemberPointer(const CXXMethodDecl *MD) { in EmitMemberPointer()
2239 llvm::Constant *MicrosoftCXXABI::EmitMemberPointer(const APValue &MP, in EmitMemberPointer()
2259 llvm::Constant *
2268 llvm::Constant *FirstField; in BuildMemberPointer()
2271 llvm::Type *Ty; in BuildMemberPointer()
2282 FirstField = llvm::ConstantExpr::getBitCast(FirstField, CGM.VoidPtrTy); in BuildMemberPointer()
2290 FirstField = llvm::Constant::getNullValue(CGM.VoidPtrTy); in BuildMemberPointer()
2293 FirstField = llvm::Constant::getNullValue(CGM.VoidPtrTy); in BuildMemberPointer()
2297 FirstField = llvm::Constant::getNullValue(CGM.VoidPtrTy); in BuildMemberPointer()
2299 llvm::Function *Thunk = EmitVirtualMemPtrThunk(MD, ML); in BuildMemberPointer()
2300 FirstField = llvm::ConstantExpr::getBitCast(Thunk, CGM.VoidPtrTy); in BuildMemberPointer()
2314 llvm::Value *
2316 llvm::Value *L, in EmitMemberPointerComparison()
2317 llvm::Value *R, in EmitMemberPointerComparison()
2323 llvm::ICmpInst::Predicate Eq; in EmitMemberPointerComparison()
2324 llvm::Instruction::BinaryOps And, Or; in EmitMemberPointerComparison()
2326 Eq = llvm::ICmpInst::ICMP_NE; in EmitMemberPointerComparison()
2327 And = llvm::Instruction::Or; in EmitMemberPointerComparison()
2328 Or = llvm::Instruction::And; in EmitMemberPointerComparison()
2330 Eq = llvm::ICmpInst::ICMP_EQ; in EmitMemberPointerComparison()
2331 And = llvm::Instruction::And; in EmitMemberPointerComparison()
2332 Or = llvm::Instruction::Or; in EmitMemberPointerComparison()
2344 llvm::Value *L0 = Builder.CreateExtractValue(L, 0, "lhs.0"); in EmitMemberPointerComparison()
2345 llvm::Value *R0 = Builder.CreateExtractValue(R, 0, "rhs.0"); in EmitMemberPointerComparison()
2346 llvm::Value *Cmp0 = Builder.CreateICmp(Eq, L0, R0, "memptr.cmp.first"); in EmitMemberPointerComparison()
2349 llvm::Value *Res = nullptr; in EmitMemberPointerComparison()
2350 llvm::StructType *LType = cast<llvm::StructType>(L->getType()); in EmitMemberPointerComparison()
2352 llvm::Value *LF = Builder.CreateExtractValue(L, I); in EmitMemberPointerComparison()
2353 llvm::Value *RF = Builder.CreateExtractValue(R, I); in EmitMemberPointerComparison()
2354 llvm::Value *Cmp = Builder.CreateICmp(Eq, LF, RF, "memptr.cmp.rest"); in EmitMemberPointerComparison()
2364 llvm::Value *Zero = llvm::Constant::getNullValue(L0->getType()); in EmitMemberPointerComparison()
2365 llvm::Value *IsZero = Builder.CreateICmp(Eq, L0, Zero, "memptr.cmp.iszero"); in EmitMemberPointerComparison()
2374 llvm::Value *
2376 llvm::Value *MemPtr, in EmitMemberPointerIsNotNull()
2379 llvm::SmallVector<llvm::Constant *, 4> fields; in EmitMemberPointerIsNotNull()
2382 fields.push_back(llvm::Constant::getNullValue(CGM.VoidPtrTy)); in EmitMemberPointerIsNotNull()
2386 llvm::Value *FirstField = MemPtr; in EmitMemberPointerIsNotNull()
2389 llvm::Value *Res = Builder.CreateICmpNE(FirstField, fields[0], "memptr.cmp0"); in EmitMemberPointerIsNotNull()
2398 llvm::Value *Field = Builder.CreateExtractValue(MemPtr, I); in EmitMemberPointerIsNotNull()
2399 llvm::Value *Next = Builder.CreateICmpNE(Field, fields[I], "memptr.cmp"); in EmitMemberPointerIsNotNull()
2406 llvm::Constant *Val) { in MemberPointerConstantIsNull()
2409 llvm::Constant *FirstField = Val->getType()->isStructTy() ? in MemberPointerConstantIsNull()
2421 llvm::SmallVector<llvm::Constant *, 4> Fields; in MemberPointerConstantIsNull()
2436 llvm::Value *
2438 llvm::Value *This, in GetVBaseOffsetFromVBPtr()
2439 llvm::Value *VBPtrOffset, in GetVBaseOffsetFromVBPtr()
2440 llvm::Value *VBTableOffset, in GetVBaseOffsetFromVBPtr()
2441 llvm::Value **VBPtrOut) { in GetVBaseOffsetFromVBPtr()
2445 llvm::Value *VBPtr = in GetVBaseOffsetFromVBPtr()
2450 llvm::Value *VBTable = Builder.CreateLoad(VBPtr, "vbtable"); in GetVBaseOffsetFromVBPtr()
2453 llvm::Value *VBTableIndex = Builder.CreateAShr( in GetVBaseOffsetFromVBPtr()
2454 VBTableOffset, llvm::ConstantInt::get(VBTableOffset->getType(), 2), in GetVBaseOffsetFromVBPtr()
2458 llvm::Value *VBaseOffs = Builder.CreateInBoundsGEP(VBTable, VBTableIndex); in GetVBaseOffsetFromVBPtr()
2465 llvm::Value *MicrosoftCXXABI::AdjustVirtualBase( in AdjustVirtualBase()
2467 llvm::Value *Base, llvm::Value *VBTableOffset, llvm::Value *VBPtrOffset) { in AdjustVirtualBase()
2470 llvm::BasicBlock *OriginalBB = nullptr; in AdjustVirtualBase()
2471 llvm::BasicBlock *SkipAdjustBB = nullptr; in AdjustVirtualBase()
2472 llvm::BasicBlock *VBaseAdjustBB = nullptr; in AdjustVirtualBase()
2482 llvm::Value *IsVirtual = in AdjustVirtualBase()
2502 VBPtrOffset = llvm::ConstantInt::get(CGM.IntTy, offs.getQuantity()); in AdjustVirtualBase()
2504 llvm::Value *VBPtr = nullptr; in AdjustVirtualBase()
2505 llvm::Value *VBaseOffs = in AdjustVirtualBase()
2507 llvm::Value *AdjustedBase = Builder.CreateInBoundsGEP(VBPtr, VBaseOffs); in AdjustVirtualBase()
2513 llvm::PHINode *Phi = Builder.CreatePHI(CGM.Int8PtrTy, 2, "memptr.base"); in AdjustVirtualBase()
2521 llvm::Value *MicrosoftCXXABI::EmitMemberDataPointerAddress( in EmitMemberDataPointerAddress()
2522 CodeGenFunction &CGF, const Expr *E, llvm::Value *Base, llvm::Value *MemPtr, in EmitMemberDataPointerAddress()
2526 llvm::Type *PType = in EmitMemberDataPointerAddress()
2534 llvm::Value *FieldOffset = MemPtr; in EmitMemberDataPointerAddress()
2535 llvm::Value *VirtualBaseAdjustmentOffset = nullptr; in EmitMemberDataPointerAddress()
2536 llvm::Value *VBPtrOffset = nullptr; in EmitMemberDataPointerAddress()
2556 llvm::Value *Addr = in EmitMemberDataPointerAddress()
2569 llvm::Value *
2572 llvm::Value *Src) { in EmitMemberPointerConversion()
2578 if (isa<llvm::Constant>(Src)) in EmitMemberPointerConversion()
2579 return EmitMemberPointerConversion(E, cast<llvm::Constant>(Src)); in EmitMemberPointerConversion()
2602 llvm::Value *IsNotNull = EmitMemberPointerIsNotNull(CGF, Src, SrcTy); in EmitMemberPointerConversion()
2603 llvm::Constant *DstNull = EmitNullMemberPointer(DstTy); in EmitMemberPointerConversion()
2614 llvm::BasicBlock *OriginalBB = Builder.GetInsertBlock(); in EmitMemberPointerConversion()
2615 llvm::BasicBlock *ConvertBB = CGF.createBasicBlock("memptr.convert"); in EmitMemberPointerConversion()
2616 llvm::BasicBlock *ContinueBB = CGF.createBasicBlock("memptr.converted"); in EmitMemberPointerConversion()
2621 llvm::Value *FirstField = Src; in EmitMemberPointerConversion()
2622 llvm::Value *NonVirtualBaseAdjustment = nullptr; in EmitMemberPointerConversion()
2623 llvm::Value *VirtualBaseAdjustmentOffset = nullptr; in EmitMemberPointerConversion()
2624 llvm::Value *VBPtrOffset = nullptr; in EmitMemberPointerConversion()
2640 llvm::Constant *Adj = getMemberPointerAdjustment(E); in EmitMemberPointerConversion()
2642 Adj = llvm::ConstantExpr::getTruncOrBitCast(Adj, CGM.IntTy); in EmitMemberPointerConversion()
2643 llvm::Value *&NVAdjustField = IsFunc ? NonVirtualBaseAdjustment : FirstField; in EmitMemberPointerConversion()
2657 llvm::Value *Dst; in EmitMemberPointerConversion()
2661 Dst = llvm::UndefValue::get(DstNull->getType()); in EmitMemberPointerConversion()
2678 llvm::PHINode *Phi = Builder.CreatePHI(DstNull->getType(), 2, "memptr.converted"); in EmitMemberPointerConversion()
2684 llvm::Constant *
2686 llvm::Constant *Src) { in EmitMemberPointerConversion()
2706 llvm::Constant *FirstField = Src; in EmitMemberPointerConversion()
2707 llvm::Constant *NonVirtualBaseAdjustment = nullptr; in EmitMemberPointerConversion()
2708 llvm::Constant *VirtualBaseAdjustmentOffset = nullptr; in EmitMemberPointerConversion()
2709 llvm::Constant *VBPtrOffset = nullptr; in EmitMemberPointerConversion()
2725 llvm::Constant *Adj = getMemberPointerAdjustment(E); in EmitMemberPointerConversion()
2727 Adj = llvm::ConstantExpr::getTruncOrBitCast(Adj, CGM.IntTy); in EmitMemberPointerConversion()
2728 llvm::Constant *&NVAdjustField = in EmitMemberPointerConversion()
2734 NVAdjustField = llvm::ConstantExpr::getNSWSub(NVAdjustField, Adj); in EmitMemberPointerConversion()
2736 NVAdjustField = llvm::ConstantExpr::getNSWAdd(NVAdjustField, Adj); in EmitMemberPointerConversion()
2745 llvm::SmallVector<llvm::Constant *, 4> Fields; in EmitMemberPointerConversion()
2753 return llvm::ConstantStruct::getAnon(Fields); in EmitMemberPointerConversion()
2756 llvm::Value *MicrosoftCXXABI::EmitLoadOfMemberFunctionPointer( in EmitLoadOfMemberFunctionPointer()
2757 CodeGenFunction &CGF, const Expr *E, llvm::Value *&This, in EmitLoadOfMemberFunctionPointer()
2758 llvm::Value *MemPtr, const MemberPointerType *MPT) { in EmitLoadOfMemberFunctionPointer()
2763 llvm::FunctionType *FTy = in EmitLoadOfMemberFunctionPointer()
2772 llvm::Value *FunctionPointer = MemPtr; in EmitLoadOfMemberFunctionPointer()
2773 llvm::Value *NonVirtualBaseAdjustment = nullptr; in EmitLoadOfMemberFunctionPointer()
2774 llvm::Value *VirtualBaseAdjustmentOffset = nullptr; in EmitLoadOfMemberFunctionPointer()
2775 llvm::Value *VBPtrOffset = nullptr; in EmitLoadOfMemberFunctionPointer()
2795 llvm::Value *Ptr = Builder.CreateBitCast(This, Builder.getInt8PtrTy()); in EmitLoadOfMemberFunctionPointer()
2837 static llvm::GlobalVariable *getTypeInfoVTable(CodeGenModule &CGM) { in getTypeInfoVTable()
2841 return new llvm::GlobalVariable(CGM.getModule(), CGM.Int8PtrTy, in getTypeInfoVTable()
2843 llvm::GlobalVariable::ExternalLinkage, in getTypeInfoVTable()
2907 static llvm::GlobalValue::LinkageTypes getLinkageForRTTI(QualType Ty) { in getLinkageForRTTI()
2912 return llvm::GlobalValue::InternalLinkage; in getLinkageForRTTI()
2916 return llvm::GlobalValue::LinkOnceODRLinkage; in getLinkageForRTTI()
2937 llvm::GlobalVariable *getBaseClassDescriptor(const MSRTTIClass &Classes);
2938 llvm::GlobalVariable *
2940 llvm::GlobalVariable *getClassHierarchyDescriptor();
2941 llvm::GlobalVariable *getCompleteObjectLocator(const VPtrInfo *Info);
2945 llvm::LLVMContext &VMContext;
2946 llvm::Module &Module;
2948 llvm::GlobalVariable::LinkageTypes Linkage;
2966 llvm::SmallPtrSet<const CXXRecordDecl *, 8> VirtualBases; in detectAmbiguousBases()
2967 llvm::SmallPtrSet<const CXXRecordDecl *, 8> UniqueBases; in detectAmbiguousBases()
2968 llvm::SmallPtrSet<const CXXRecordDecl *, 8> AmbiguousBases; in detectAmbiguousBases()
2986 llvm::GlobalVariable *MSRTTIBuilder::getClassHierarchyDescriptor() { in getClassHierarchyDescriptor()
2989 llvm::raw_svector_ostream Out(MangledName); in getClassHierarchyDescriptor()
3015 llvm::Value *GEPIndices[] = {llvm::ConstantInt::get(CGM.IntTy, 0), in getClassHierarchyDescriptor()
3016 llvm::ConstantInt::get(CGM.IntTy, 0)}; in getClassHierarchyDescriptor()
3020 auto CHD = new llvm::GlobalVariable(Module, Type, /*Constant=*/true, Linkage, in getClassHierarchyDescriptor()
3029 llvm::Constant *Fields[] = { in getClassHierarchyDescriptor()
3030 llvm::ConstantInt::get(CGM.IntTy, 0), // Unknown in getClassHierarchyDescriptor()
3031 llvm::ConstantInt::get(CGM.IntTy, Flags), in getClassHierarchyDescriptor()
3032 llvm::ConstantInt::get(CGM.IntTy, Classes.size()), in getClassHierarchyDescriptor()
3033 ABI.getImageRelativeConstant(llvm::ConstantExpr::getInBoundsGetElementPtr( in getClassHierarchyDescriptor()
3035 llvm::ArrayRef<llvm::Value *>(GEPIndices))), in getClassHierarchyDescriptor()
3037 CHD->setInitializer(llvm::ConstantStruct::get(Type, Fields)); in getClassHierarchyDescriptor()
3041 llvm::GlobalVariable *
3045 llvm::raw_svector_ostream Out(MangledName); in getBaseClassArray()
3054 llvm::Type *PtrType = ABI.getImageRelativeType( in getBaseClassArray()
3056 auto *ArrType = llvm::ArrayType::get(PtrType, Classes.size() + 1); in getBaseClassArray()
3058 new llvm::GlobalVariable(Module, ArrType, in getBaseClassArray()
3065 SmallVector<llvm::Constant *, 8> BaseClassArrayData; in getBaseClassArray()
3069 BaseClassArrayData.push_back(llvm::Constant::getNullValue(PtrType)); in getBaseClassArray()
3070 BCA->setInitializer(llvm::ConstantArray::get(ArrType, BaseClassArrayData)); in getBaseClassArray()
3074 llvm::GlobalVariable *
3088 llvm::raw_svector_ostream Out(MangledName); in getBaseClassDescriptor()
3101 new llvm::GlobalVariable(Module, Type, /*Constant=*/true, Linkage, in getBaseClassDescriptor()
3107 llvm::Constant *Fields[] = { in getBaseClassDescriptor()
3110 llvm::ConstantInt::get(CGM.IntTy, Class.NumBases), in getBaseClassDescriptor()
3111 llvm::ConstantInt::get(CGM.IntTy, Class.OffsetInVBase), in getBaseClassDescriptor()
3112 llvm::ConstantInt::get(CGM.IntTy, VBPtrOffset), in getBaseClassDescriptor()
3113 llvm::ConstantInt::get(CGM.IntTy, OffsetInVBTable), in getBaseClassDescriptor()
3114 llvm::ConstantInt::get(CGM.IntTy, Class.Flags), in getBaseClassDescriptor()
3118 BCD->setInitializer(llvm::ConstantStruct::get(Type, Fields)); in getBaseClassDescriptor()
3122 llvm::GlobalVariable *
3126 llvm::raw_svector_ostream Out(MangledName); in getCompleteObjectLocator()
3146 llvm::StructType *Type = ABI.getCompleteObjectLocatorType(); in getCompleteObjectLocator()
3147 auto COL = new llvm::GlobalVariable(Module, Type, /*Constant=*/true, Linkage, in getCompleteObjectLocator()
3151 llvm::Constant *Fields[] = { in getCompleteObjectLocator()
3152 llvm::ConstantInt::get(CGM.IntTy, ABI.isImageRelative()), in getCompleteObjectLocator()
3153 llvm::ConstantInt::get(CGM.IntTy, OffsetToTop), in getCompleteObjectLocator()
3154 llvm::ConstantInt::get(CGM.IntTy, VFPtrOffset), in getCompleteObjectLocator()
3160 llvm::ArrayRef<llvm::Constant *> FieldsRef(Fields); in getCompleteObjectLocator()
3163 COL->setInitializer(llvm::ConstantStruct::get(Type, FieldsRef)); in getCompleteObjectLocator()
3200 llvm::Constant *
3221 llvm::raw_svector_ostream Out(MangledName); in getAddrOfCXXCatchHandlerType()
3225 if (llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(MangledName)) in getAddrOfCXXCatchHandlerType()
3226 return llvm::ConstantExpr::getBitCast(GV, CGM.Int8PtrTy); in getAddrOfCXXCatchHandlerType()
3228 llvm::Constant *Fields[] = { in getAddrOfCXXCatchHandlerType()
3229 llvm::ConstantInt::get(CGM.IntTy, Flags), // Flags in getAddrOfCXXCatchHandlerType()
3232 llvm::StructType *CatchHandlerTypeType = getCatchHandlerTypeType(); in getAddrOfCXXCatchHandlerType()
3233 auto *Var = new llvm::GlobalVariable( in getAddrOfCXXCatchHandlerType()
3235 llvm::GlobalValue::PrivateLinkage, in getAddrOfCXXCatchHandlerType()
3236 llvm::ConstantStruct::get(CatchHandlerTypeType, Fields), in getAddrOfCXXCatchHandlerType()
3247 llvm::Constant *MicrosoftCXXABI::getAddrOfRTTIDescriptor(QualType Type) { in getAddrOfRTTIDescriptor()
3250 llvm::raw_svector_ostream Out(MangledName); in getAddrOfRTTIDescriptor()
3255 if (llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(MangledName)) in getAddrOfRTTIDescriptor()
3256 return llvm::ConstantExpr::getBitCast(GV, CGM.Int8PtrTy); in getAddrOfRTTIDescriptor()
3261 llvm::raw_svector_ostream Out(TypeInfoString); in getAddrOfRTTIDescriptor()
3266 llvm::Constant *Fields[] = { in getAddrOfRTTIDescriptor()
3268 llvm::ConstantPointerNull::get(CGM.Int8PtrTy), // Runtime data in getAddrOfRTTIDescriptor()
3269 llvm::ConstantDataArray::getString(CGM.getLLVMContext(), TypeInfoString)}; in getAddrOfRTTIDescriptor()
3270 llvm::StructType *TypeDescriptorType = in getAddrOfRTTIDescriptor()
3272 auto *Var = new llvm::GlobalVariable( in getAddrOfRTTIDescriptor()
3275 llvm::ConstantStruct::get(TypeDescriptorType, Fields), in getAddrOfRTTIDescriptor()
3279 return llvm::ConstantExpr::getBitCast(Var, CGM.Int8PtrTy); in getAddrOfRTTIDescriptor()
3283 llvm::GlobalVariable *
3293 llvm::Function *Fn = CGM.codegenCXXStructor(ctor, StructorType::Complete); in emitCXXConstructor()
3320 llvm::Function *Fn = CGM.codegenCXXStructor(dtor, dtorType); in emitCXXDestructor()
3334 llvm::Function *
3341 llvm::raw_svector_ostream Out(ThunkName); in getAddrOfCXXCtorClosure()
3346 if (llvm::GlobalValue *GV = CGM.getModule().getNamedValue(ThunkName)) in getAddrOfCXXCtorClosure()
3347 return cast<llvm::Function>(GV); in getAddrOfCXXCtorClosure()
3351 llvm::FunctionType *ThunkTy = CGM.getTypes().GetFunctionType(FnInfo); in getAddrOfCXXCtorClosure()
3354 llvm::Function *ThunkFn = llvm::Function::Create( in getAddrOfCXXCtorClosure()
3356 ThunkFn->setCallingConv(static_cast<llvm::CallingConv::ID>( in getAddrOfCXXCtorClosure()
3393 llvm::Value *This = getThisValue(CGF); in getAddrOfCXXCtorClosure()
3395 llvm::Value *SrcVal = in getAddrOfCXXCtorClosure()
3429 llvm::Value *CalleeFn = CGM.getAddrOfCXXStructor(CD, StructorType::Complete); in getAddrOfCXXCtorClosure()
3443 llvm::Constant *MicrosoftCXXABI::getCatchableType(QualType T, in getCatchableType()
3460 llvm::raw_svector_ostream Out(MangledName); in getCatchableType()
3464 if (llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(MangledName)) in getCatchableType()
3469 llvm::Constant *TD = getImageRelativeConstant(getAddrOfRTTIDescriptor(T)); in getCatchableType()
3473 llvm::Constant *CopyCtor; in getCatchableType()
3480 CopyCtor = llvm::ConstantExpr::getBitCast(CopyCtor, CGM.Int8PtrTy); in getCatchableType()
3482 CopyCtor = llvm::Constant::getNullValue(CGM.Int8PtrTy); in getCatchableType()
3508 llvm::Constant *Fields[] = { in getCatchableType()
3509 llvm::ConstantInt::get(CGM.IntTy, Flags), // Flags in getCatchableType()
3511 llvm::ConstantInt::get(CGM.IntTy, NVOffset), // NonVirtualAdjustment in getCatchableType()
3512 llvm::ConstantInt::get(CGM.IntTy, VBPtrOffset), // OffsetToVBPtr in getCatchableType()
3513 llvm::ConstantInt::get(CGM.IntTy, VBIndex), // VBTableIndex in getCatchableType()
3514 llvm::ConstantInt::get(CGM.IntTy, Size), // Size in getCatchableType()
3517 llvm::StructType *CTType = getCatchableTypeType(); in getCatchableType()
3518 auto *GV = new llvm::GlobalVariable( in getCatchableType()
3520 llvm::ConstantStruct::get(CTType, Fields), StringRef(MangledName)); in getCatchableType()
3528 llvm::GlobalVariable *MicrosoftCXXABI::getCatchableTypeArray(QualType T) { in getCatchableTypeArray()
3532 llvm::GlobalVariable *&CTA = CatchableTypeArrays[T]; in getCatchableTypeArray()
3539 llvm::SmallSetVector<llvm::Constant *, 2> CatchableTypes; in getCatchableTypeArray()
3621 llvm::Type *CTType = in getCatchableTypeArray()
3623 llvm::ArrayType *AT = llvm::ArrayType::get(CTType, NumEntries); in getCatchableTypeArray()
3624 llvm::StructType *CTAType = getCatchableTypeArrayType(NumEntries); in getCatchableTypeArray()
3625 llvm::Constant *Fields[] = { in getCatchableTypeArray()
3626 llvm::ConstantInt::get(CGM.IntTy, NumEntries), // NumEntries in getCatchableTypeArray()
3627 llvm::ConstantArray::get( in getCatchableTypeArray()
3628 AT, llvm::makeArrayRef(CatchableTypes.begin(), in getCatchableTypeArray()
3633 llvm::raw_svector_ostream Out(MangledName); in getCatchableTypeArray()
3636 CTA = new llvm::GlobalVariable( in getCatchableTypeArray()
3638 llvm::ConstantStruct::get(CTAType, Fields), StringRef(MangledName)); in getCatchableTypeArray()
3646 llvm::GlobalVariable *MicrosoftCXXABI::getThrowInfo(QualType T) { in getThrowInfo()
3652 llvm::GlobalVariable *CTA = getCatchableTypeArray(T); in getThrowInfo()
3658 cast<llvm::ConstantInt>(CTA->getInitializer()->getAggregateElement(0U)) in getThrowInfo()
3663 llvm::raw_svector_ostream Out(MangledName); in getThrowInfo()
3670 if (llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(MangledName)) in getThrowInfo()
3684 llvm::Constant *CleanupFn = llvm::Constant::getNullValue(CGM.Int8PtrTy); in getThrowInfo()
3688 CleanupFn = llvm::ConstantExpr::getBitCast( in getThrowInfo()
3692 llvm::Constant *ForwardCompat = in getThrowInfo()
3693 getImageRelativeConstant(llvm::Constant::getNullValue(CGM.Int8PtrTy)); in getThrowInfo()
3694 llvm::Constant *PointerToCatchableTypes = getImageRelativeConstant( in getThrowInfo()
3695 llvm::ConstantExpr::getBitCast(CTA, CGM.Int8PtrTy)); in getThrowInfo()
3696 llvm::StructType *TIType = getThrowInfoType(); in getThrowInfo()
3697 llvm::Constant *Fields[] = { in getThrowInfo()
3698 llvm::ConstantInt::get(CGM.IntTy, Flags), // Flags in getThrowInfo()
3703 auto *GV = new llvm::GlobalVariable( in getThrowInfo()
3705 llvm::ConstantStruct::get(TIType, Fields), StringRef(MangledName)); in getThrowInfo()
3718 llvm::AllocaInst *AI = CGF.CreateMemTemp(ThrowType); in emitThrow()
3724 llvm::GlobalVariable *TI = getThrowInfo(ThrowType); in emitThrow()
3727 llvm::Value *Args[] = {CGF.Builder.CreateBitCast(AI, CGM.Int8PtrTy), TI}; in emitThrow()