Lines Matching refs:llvm
43 llvm::DenseMap<const CXXRecordDecl *, llvm::GlobalVariable *> VTables;
74 llvm::Type *ConvertMemberPointerType(const MemberPointerType *MPT) override;
76 llvm::Value *
79 llvm::Value *&This,
80 llvm::Value *MemFnPtr,
83 llvm::Value *
85 llvm::Value *Base,
86 llvm::Value *MemPtr,
89 llvm::Value *EmitMemberPointerConversion(CodeGenFunction &CGF,
91 llvm::Value *Src) override;
92 llvm::Constant *EmitMemberPointerConversion(const CastExpr *E,
93 llvm::Constant *Src) override;
95 llvm::Constant *EmitNullMemberPointer(const MemberPointerType *MPT) override;
97 llvm::Constant *EmitMemberPointer(const CXXMethodDecl *MD) override;
98 llvm::Constant *EmitMemberDataPointer(const MemberPointerType *MPT,
100 llvm::Constant *EmitMemberPointer(const APValue &MP, QualType MPT) override;
101 llvm::Constant *BuildMemberPointer(const CXXMethodDecl *MD,
104 llvm::Value *EmitMemberPointerComparison(CodeGenFunction &CGF,
105 llvm::Value *L, llvm::Value *R,
109 llvm::Value *EmitMemberPointerIsNotNull(CodeGenFunction &CGF,
110 llvm::Value *Addr,
114 llvm::Value *Ptr, QualType ElementType,
122 llvm::CallInst *
124 llvm::Value *Exn) override;
128 llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty) override;
129 llvm::Constant *
137 llvm::Value *EmitTypeid(CodeGenFunction &CGF, QualType SrcRecordTy,
138 llvm::Value *ThisPtr,
139 llvm::Type *StdTypeInfoPtrTy) override;
144 llvm::Value *EmitDynamicCastCall(CodeGenFunction &CGF, llvm::Value *Value,
147 llvm::BasicBlock *CastEnd) override;
149 llvm::Value *EmitDynamicCastToVoid(CodeGenFunction &CGF, llvm::Value *Value,
155 llvm::Value *
156 GetVirtualBaseClassOffset(CodeGenFunction &CGF, llvm::Value *This,
188 bool Delegating, llvm::Value *This) override;
193 llvm::Value *getVTableAddressPointInStructor(
198 llvm::Constant *
202 llvm::GlobalVariable *getAddrOfVTable(const CXXRecordDecl *RD,
205 llvm::Value *getVirtualFunctionPointer(CodeGenFunction &CGF, GlobalDecl GD,
206 llvm::Value *This,
207 llvm::Type *Ty) override;
209 llvm::Value *EmitVirtualDestructorCall(CodeGenFunction &CGF,
212 llvm::Value *This,
217 void setThunkLinkage(llvm::Function *Thunk, bool ForVTable, GlobalDecl GD, in setThunkLinkage()
222 Thunk->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage); in setThunkLinkage()
225 llvm::Value *performThisAdjustment(CodeGenFunction &CGF, llvm::Value *This,
228 llvm::Value *performReturnAdjustment(CodeGenFunction &CGF, llvm::Value *Ret,
242 llvm::Value *InitializeArrayCookie(CodeGenFunction &CGF,
243 llvm::Value *NewPtr,
244 llvm::Value *NumElements,
247 llvm::Value *readArrayCookieImpl(CodeGenFunction &CGF,
248 llvm::Value *allocPtr,
252 llvm::GlobalVariable *DeclPtr,
255 llvm::Constant *dtor, llvm::Constant *addr) override;
257 llvm::Function *getOrCreateThreadLocalWrapper(const VarDecl *VD,
258 llvm::Value *Val);
261 ArrayRef<std::pair<const VarDecl *, llvm::GlobalVariable *>>
263 ArrayRef<llvm::Function *> CXXThreadLocalInits,
264 ArrayRef<llvm::GlobalVariable *> CXXThreadLocalInitVars) override;
300 llvm::GlobalValue::LinkageTypes Linkage) const;
322 llvm::Value *InitializeArrayCookie(CodeGenFunction &CGF,
323 llvm::Value *NewPtr,
324 llvm::Value *NumElements,
327 llvm::Value *readArrayCookieImpl(CodeGenFunction &CGF, llvm::Value *allocPtr,
363 == llvm::Triple::le32) { in CreateItaniumCXXABI()
378 llvm::Type *
382 return llvm::StructType::get(CGM.PtrDiffTy, CGM.PtrDiffTy, nullptr); in ConvertMemberPointerType()
405 llvm::Value *ItaniumCXXABI::EmitLoadOfMemberFunctionPointer( in EmitLoadOfMemberFunctionPointer()
406 CodeGenFunction &CGF, const Expr *E, llvm::Value *&This, in EmitLoadOfMemberFunctionPointer()
407 llvm::Value *MemFnPtr, const MemberPointerType *MPT) { in EmitLoadOfMemberFunctionPointer()
415 llvm::FunctionType *FTy = in EmitLoadOfMemberFunctionPointer()
419 llvm::Constant *ptrdiff_1 = llvm::ConstantInt::get(CGM.PtrDiffTy, 1); in EmitLoadOfMemberFunctionPointer()
421 llvm::BasicBlock *FnVirtual = CGF.createBasicBlock("memptr.virtual"); in EmitLoadOfMemberFunctionPointer()
422 llvm::BasicBlock *FnNonVirtual = CGF.createBasicBlock("memptr.nonvirtual"); in EmitLoadOfMemberFunctionPointer()
423 llvm::BasicBlock *FnEnd = CGF.createBasicBlock("memptr.end"); in EmitLoadOfMemberFunctionPointer()
426 llvm::Value *RawAdj = Builder.CreateExtractValue(MemFnPtr, 1, "memptr.adj"); in EmitLoadOfMemberFunctionPointer()
429 llvm::Value *Adj = RawAdj; in EmitLoadOfMemberFunctionPointer()
435 llvm::Value *Ptr = Builder.CreateBitCast(This, Builder.getInt8PtrTy()); in EmitLoadOfMemberFunctionPointer()
440 llvm::Value *FnAsInt = Builder.CreateExtractValue(MemFnPtr, 0, "memptr.ptr"); in EmitLoadOfMemberFunctionPointer()
444 llvm::Value *IsVirtual; in EmitLoadOfMemberFunctionPointer()
458 llvm::Type *VTableTy = Builder.getInt8PtrTy(); in EmitLoadOfMemberFunctionPointer()
459 llvm::Value *VTable = CGF.GetVTablePtr(This, VTableTy); in EmitLoadOfMemberFunctionPointer()
462 llvm::Value *VTableOffset = FnAsInt; in EmitLoadOfMemberFunctionPointer()
469 llvm::Value *VirtualFn = Builder.CreateLoad(VTable, "memptr.virtualfn"); in EmitLoadOfMemberFunctionPointer()
475 llvm::Value *NonVirtualFn = in EmitLoadOfMemberFunctionPointer()
480 llvm::PHINode *Callee = Builder.CreatePHI(FTy->getPointerTo(), 2); in EmitLoadOfMemberFunctionPointer()
488 llvm::Value *ItaniumCXXABI::EmitMemberDataPointerAddress( in EmitMemberDataPointerAddress()
489 CodeGenFunction &CGF, const Expr *E, llvm::Value *Base, llvm::Value *MemPtr, in EmitMemberDataPointerAddress()
501 llvm::Value *Addr = Builder.CreateInBoundsGEP(Base, MemPtr, "memptr.offset"); in EmitMemberDataPointerAddress()
505 llvm::Type *PType in EmitMemberDataPointerAddress()
533 llvm::Value *
536 llvm::Value *src) { in EmitMemberPointerConversion()
545 if (isa<llvm::Constant>(src)) in EmitMemberPointerConversion()
546 return EmitMemberPointerConversion(E, cast<llvm::Constant>(src)); in EmitMemberPointerConversion()
548 llvm::Constant *adj = getMemberPointerAdjustment(E); in EmitMemberPointerConversion()
560 llvm::Value *dst; in EmitMemberPointerConversion()
567 llvm::Value *null = llvm::Constant::getAllOnesValue(src->getType()); in EmitMemberPointerConversion()
568 llvm::Value *isNull = Builder.CreateICmpEQ(src, null, "memptr.isnull"); in EmitMemberPointerConversion()
574 uint64_t offset = cast<llvm::ConstantInt>(adj)->getZExtValue(); in EmitMemberPointerConversion()
576 adj = llvm::ConstantInt::get(adj->getType(), offset); in EmitMemberPointerConversion()
579 llvm::Value *srcAdj = Builder.CreateExtractValue(src, 1, "src.adj"); in EmitMemberPointerConversion()
580 llvm::Value *dstAdj; in EmitMemberPointerConversion()
589 llvm::Constant *
591 llvm::Constant *src) { in EmitMemberPointerConversion()
600 llvm::Constant *adj = getMemberPointerAdjustment(E); in EmitMemberPointerConversion()
615 return llvm::ConstantExpr::getNSWSub(src, adj); in EmitMemberPointerConversion()
617 return llvm::ConstantExpr::getNSWAdd(src, adj); in EmitMemberPointerConversion()
622 uint64_t offset = cast<llvm::ConstantInt>(adj)->getZExtValue(); in EmitMemberPointerConversion()
624 adj = llvm::ConstantInt::get(adj->getType(), offset); in EmitMemberPointerConversion()
627 llvm::Constant *srcAdj = llvm::ConstantExpr::getExtractValue(src, 1); in EmitMemberPointerConversion()
628 llvm::Constant *dstAdj; in EmitMemberPointerConversion()
630 dstAdj = llvm::ConstantExpr::getNSWSub(srcAdj, adj); in EmitMemberPointerConversion()
632 dstAdj = llvm::ConstantExpr::getNSWAdd(srcAdj, adj); in EmitMemberPointerConversion()
634 return llvm::ConstantExpr::getInsertValue(src, dstAdj, 1); in EmitMemberPointerConversion()
637 llvm::Constant *
642 return llvm::ConstantInt::get(CGM.PtrDiffTy, -1ULL, /*isSigned=*/true); in EmitNullMemberPointer()
644 llvm::Constant *Zero = llvm::ConstantInt::get(CGM.PtrDiffTy, 0); in EmitNullMemberPointer()
645 llvm::Constant *Values[2] = { Zero, Zero }; in EmitNullMemberPointer()
646 return llvm::ConstantStruct::getAnon(Values); in EmitNullMemberPointer()
649 llvm::Constant *
655 return llvm::ConstantInt::get(CGM.PtrDiffTy, offset.getQuantity()); in EmitMemberDataPointer()
658 llvm::Constant *ItaniumCXXABI::EmitMemberPointer(const CXXMethodDecl *MD) { in EmitMemberPointer()
662 llvm::Constant *ItaniumCXXABI::BuildMemberPointer(const CXXMethodDecl *MD, in BuildMemberPointer()
670 llvm::Constant *MemPtr[2]; in BuildMemberPointer()
686 MemPtr[0] = llvm::ConstantInt::get(CGM.PtrDiffTy, VTableOffset); in BuildMemberPointer()
687 MemPtr[1] = llvm::ConstantInt::get(CGM.PtrDiffTy, in BuildMemberPointer()
694 MemPtr[0] = llvm::ConstantInt::get(CGM.PtrDiffTy, VTableOffset + 1); in BuildMemberPointer()
695 MemPtr[1] = llvm::ConstantInt::get(CGM.PtrDiffTy, in BuildMemberPointer()
700 llvm::Type *Ty; in BuildMemberPointer()
710 llvm::Constant *addr = CGM.GetAddrOfFunction(MD, Ty); in BuildMemberPointer()
712 MemPtr[0] = llvm::ConstantExpr::getPtrToInt(addr, CGM.PtrDiffTy); in BuildMemberPointer()
713 MemPtr[1] = llvm::ConstantInt::get(CGM.PtrDiffTy, in BuildMemberPointer()
718 return llvm::ConstantStruct::getAnon(MemPtr); in BuildMemberPointer()
721 llvm::Constant *ItaniumCXXABI::EmitMemberPointer(const APValue &MP, in EmitMemberPointer()
742 llvm::Value *
744 llvm::Value *L, in EmitMemberPointerComparison()
745 llvm::Value *R, in EmitMemberPointerComparison()
750 llvm::ICmpInst::Predicate Eq; in EmitMemberPointerComparison()
751 llvm::Instruction::BinaryOps And, Or; in EmitMemberPointerComparison()
753 Eq = llvm::ICmpInst::ICMP_NE; in EmitMemberPointerComparison()
754 And = llvm::Instruction::Or; in EmitMemberPointerComparison()
755 Or = llvm::Instruction::And; in EmitMemberPointerComparison()
757 Eq = llvm::ICmpInst::ICMP_EQ; in EmitMemberPointerComparison()
758 And = llvm::Instruction::And; in EmitMemberPointerComparison()
759 Or = llvm::Instruction::Or; in EmitMemberPointerComparison()
777 llvm::Value *LPtr = Builder.CreateExtractValue(L, 0, "lhs.memptr.ptr"); in EmitMemberPointerComparison()
778 llvm::Value *RPtr = Builder.CreateExtractValue(R, 0, "rhs.memptr.ptr"); in EmitMemberPointerComparison()
782 llvm::Value *PtrEq = Builder.CreateICmp(Eq, LPtr, RPtr, "cmp.ptr"); in EmitMemberPointerComparison()
787 llvm::Value *Zero = llvm::Constant::getNullValue(LPtr->getType()); in EmitMemberPointerComparison()
788 llvm::Value *EqZero = Builder.CreateICmp(Eq, LPtr, Zero, "cmp.ptr.null"); in EmitMemberPointerComparison()
792 llvm::Value *LAdj = Builder.CreateExtractValue(L, 1, "lhs.memptr.adj"); in EmitMemberPointerComparison()
793 llvm::Value *RAdj = Builder.CreateExtractValue(R, 1, "rhs.memptr.adj"); in EmitMemberPointerComparison()
794 llvm::Value *AdjEq = Builder.CreateICmp(Eq, LAdj, RAdj, "cmp.adj"); in EmitMemberPointerComparison()
799 llvm::Value *One = llvm::ConstantInt::get(LPtr->getType(), 1); in EmitMemberPointerComparison()
802 llvm::Value *OrAdj = Builder.CreateOr(LAdj, RAdj, "or.adj"); in EmitMemberPointerComparison()
803 llvm::Value *OrAdjAnd1 = Builder.CreateAnd(OrAdj, One); in EmitMemberPointerComparison()
804 llvm::Value *OrAdjAnd1EqZero = Builder.CreateICmp(Eq, OrAdjAnd1, Zero, in EmitMemberPointerComparison()
810 llvm::Value *Result = Builder.CreateBinOp(Or, EqZero, AdjEq); in EmitMemberPointerComparison()
816 llvm::Value *
818 llvm::Value *MemPtr, in EmitMemberPointerIsNotNull()
825 llvm::Value *NegativeOne = in EmitMemberPointerIsNotNull()
826 llvm::Constant::getAllOnesValue(MemPtr->getType()); in EmitMemberPointerIsNotNull()
831 llvm::Value *Ptr = Builder.CreateExtractValue(MemPtr, 0, "memptr.ptr"); in EmitMemberPointerIsNotNull()
833 llvm::Constant *Zero = llvm::ConstantInt::get(Ptr->getType(), 0); in EmitMemberPointerIsNotNull()
834 llvm::Value *Result = Builder.CreateICmpNE(Ptr, Zero, "memptr.tobool"); in EmitMemberPointerIsNotNull()
839 llvm::Constant *One = llvm::ConstantInt::get(Ptr->getType(), 1); in EmitMemberPointerIsNotNull()
840 llvm::Value *Adj = Builder.CreateExtractValue(MemPtr, 1, "memptr.adj"); in EmitMemberPointerIsNotNull()
841 llvm::Value *VirtualBit = Builder.CreateAnd(Adj, One, "memptr.virtualbit"); in EmitMemberPointerIsNotNull()
842 llvm::Value *IsVirtual = Builder.CreateICmpNE(VirtualBit, Zero, in EmitMemberPointerIsNotNull()
875 llvm::Value *Ptr, in emitVirtualObjectDelete()
884 llvm::Value *VTable = CGF.GetVTablePtr(Ptr, CGF.IntPtrTy->getPointerTo()); in emitVirtualObjectDelete()
887 llvm::Value *OffsetPtr = CGF.Builder.CreateConstInBoundsGEP1_64( in emitVirtualObjectDelete()
889 llvm::LoadInst *Offset = CGF.Builder.CreateLoad(OffsetPtr); in emitVirtualObjectDelete()
893 llvm::Value *CompletePtr = CGF.Builder.CreateBitCast(Ptr, CGF.Int8PtrTy); in emitVirtualObjectDelete()
914 llvm::FunctionType *FTy = in emitRethrow()
915 llvm::FunctionType::get(CGM.VoidTy, /*IsVarArgs=*/false); in emitRethrow()
917 llvm::Constant *Fn = CGM.CreateRuntimeFunction(FTy, "__cxa_rethrow"); in emitRethrow()
925 static llvm::Constant *getAllocateExceptionFn(CodeGenModule &CGM) { in getAllocateExceptionFn()
928 llvm::FunctionType *FTy = in getAllocateExceptionFn()
929 llvm::FunctionType::get(CGM.Int8PtrTy, CGM.SizeTy, /*IsVarArgs=*/false); in getAllocateExceptionFn()
934 static llvm::Constant *getThrowFn(CodeGenModule &CGM) { in getThrowFn()
938 llvm::Type *Args[3] = { CGM.Int8PtrTy, CGM.Int8PtrTy, CGM.Int8PtrTy }; in getThrowFn()
939 llvm::FunctionType *FTy = in getThrowFn()
940 llvm::FunctionType::get(CGM.VoidTy, Args, /*IsVarArgs=*/false); in getThrowFn()
948 llvm::Type *SizeTy = CGF.ConvertType(getContext().getSizeType()); in emitThrow()
951 llvm::Constant *AllocExceptionFn = getAllocateExceptionFn(CGM); in emitThrow()
952 llvm::CallInst *ExceptionPtr = CGF.EmitNounwindRuntimeCall( in emitThrow()
953 AllocExceptionFn, llvm::ConstantInt::get(SizeTy, TypeSize), "exception"); in emitThrow()
958 llvm::Constant *TypeInfo = CGM.GetAddrOfRTTIDescriptor(ThrowType, in emitThrow()
963 llvm::Constant *Dtor = nullptr; in emitThrow()
969 Dtor = llvm::ConstantExpr::getBitCast(Dtor, CGM.Int8PtrTy); in emitThrow()
972 if (!Dtor) Dtor = llvm::Constant::getNullValue(CGM.Int8PtrTy); in emitThrow()
974 llvm::Value *args[] = { ExceptionPtr, TypeInfo, Dtor }; in emitThrow()
978 static llvm::Constant *getItaniumDynamicCastFn(CodeGenFunction &CGF) { in getItaniumDynamicCastFn()
984 llvm::Type *Int8PtrTy = CGF.Int8PtrTy; in getItaniumDynamicCastFn()
985 llvm::Type *PtrDiffTy = in getItaniumDynamicCastFn()
988 llvm::Type *Args[4] = { Int8PtrTy, Int8PtrTy, Int8PtrTy, PtrDiffTy }; in getItaniumDynamicCastFn()
990 llvm::FunctionType *FTy = llvm::FunctionType::get(Int8PtrTy, Args, false); in getItaniumDynamicCastFn()
993 llvm::Attribute::AttrKind FuncAttrs[] = { llvm::Attribute::NoUnwind, in getItaniumDynamicCastFn()
994 llvm::Attribute::ReadOnly }; in getItaniumDynamicCastFn()
995 llvm::AttributeSet Attrs = llvm::AttributeSet::get( in getItaniumDynamicCastFn()
996 CGF.getLLVMContext(), llvm::AttributeSet::FunctionIndex, FuncAttrs); in getItaniumDynamicCastFn()
1001 static llvm::Constant *getBadCastFn(CodeGenFunction &CGF) { in getBadCastFn()
1003 llvm::FunctionType *FTy = llvm::FunctionType::get(CGF.VoidTy, false); in getBadCastFn()
1059 static llvm::Constant *getBadTypeidFn(CodeGenFunction &CGF) { in getBadTypeidFn()
1061 llvm::FunctionType *FTy = llvm::FunctionType::get(CGF.VoidTy, false); in getBadTypeidFn()
1072 llvm::Value *Fn = getBadTypeidFn(CGF); in EmitBadTypeidCall()
1077 llvm::Value *ItaniumCXXABI::EmitTypeid(CodeGenFunction &CGF, in EmitTypeid()
1079 llvm::Value *ThisPtr, in EmitTypeid()
1080 llvm::Type *StdTypeInfoPtrTy) { in EmitTypeid()
1081 llvm::Value *Value = in EmitTypeid()
1094 llvm::Value *ItaniumCXXABI::EmitDynamicCastCall( in EmitDynamicCastCall()
1095 CodeGenFunction &CGF, llvm::Value *Value, QualType SrcRecordTy, in EmitDynamicCastCall()
1096 QualType DestTy, QualType DestRecordTy, llvm::BasicBlock *CastEnd) { in EmitDynamicCastCall()
1097 llvm::Type *PtrDiffLTy = in EmitDynamicCastCall()
1099 llvm::Type *DestLTy = CGF.ConvertType(DestTy); in EmitDynamicCastCall()
1101 llvm::Value *SrcRTTI = in EmitDynamicCastCall()
1103 llvm::Value *DestRTTI = in EmitDynamicCastCall()
1109 llvm::Value *OffsetHint = llvm::ConstantInt::get( in EmitDynamicCastCall()
1116 llvm::Value *args[] = {Value, SrcRTTI, DestRTTI, OffsetHint}; in EmitDynamicCastCall()
1123 llvm::BasicBlock *BadCastBlock = in EmitDynamicCastCall()
1126 llvm::Value *IsNull = CGF.Builder.CreateIsNull(Value); in EmitDynamicCastCall()
1136 llvm::Value *ItaniumCXXABI::EmitDynamicCastToVoid(CodeGenFunction &CGF, in EmitDynamicCastToVoid()
1137 llvm::Value *Value, in EmitDynamicCastToVoid()
1140 llvm::Type *PtrDiffLTy = in EmitDynamicCastToVoid()
1142 llvm::Type *DestLTy = CGF.ConvertType(DestTy); in EmitDynamicCastToVoid()
1145 llvm::Value *VTable = CGF.GetVTablePtr(Value, PtrDiffLTy->getPointerTo()); in EmitDynamicCastToVoid()
1148 llvm::Value *OffsetToTop = in EmitDynamicCastToVoid()
1160 llvm::Value *Fn = getBadCastFn(CGF); in EmitBadCastCall()
1166 llvm::Value *
1168 llvm::Value *This, in GetVirtualBaseClassOffset()
1171 llvm::Value *VTablePtr = CGF.GetVTablePtr(This, CGM.Int8PtrTy); in GetVirtualBaseClassOffset()
1176 llvm::Value *VBaseOffsetPtr = in GetVirtualBaseClassOffset()
1182 llvm::Value *VBaseOffset = in GetVirtualBaseClassOffset()
1283 llvm::Value *VTT = in addImplicitConstructorArgs()
1294 bool Delegating, llvm::Value *This) { in EmitDestructorCall()
1296 llvm::Value *VTT = CGF.GetVTTParameter(GD, ForVirtualBase, Delegating); in EmitDestructorCall()
1299 llvm::Value *Callee = nullptr; in EmitDestructorCall()
1312 llvm::GlobalVariable *VTable = getAddrOfVTable(RD, CharUnits()); in emitVTableDefinitions()
1318 llvm::GlobalVariable::LinkageTypes Linkage = CGM.getVTableLinkage(RD); in emitVTableDefinitions()
1319 llvm::Constant *RTTI = in emitVTableDefinitions()
1323 llvm::Constant *Init = CGVT.CreateVTableInitializer( in emitVTableDefinitions()
1357 llvm::Value *ItaniumCXXABI::getVTableAddressPointInStructor( in getVTableAddressPointInStructor()
1363 llvm::Value *VTableAddressPoint; in getVTableAddressPointInStructor()
1370 llvm::Value *VTT = CGF.LoadCXXVTT(); in getVTableAddressPointInStructor()
1377 llvm::Constant *VTable = in getVTableAddressPointInStructor()
1389 llvm::Constant *ItaniumCXXABI::getVTableAddressPointForConstExpr( in getVTableAddressPointForConstExpr()
1397 llvm::Value *Indices[] = { in getVTableAddressPointForConstExpr()
1398 llvm::ConstantInt::get(CGM.Int64Ty, 0), in getVTableAddressPointForConstExpr()
1399 llvm::ConstantInt::get(CGM.Int64Ty, AddressPoint) in getVTableAddressPointForConstExpr()
1402 return llvm::ConstantExpr::getInBoundsGetElementPtr(VTable->getValueType(), in getVTableAddressPointForConstExpr()
1406 llvm::GlobalVariable *ItaniumCXXABI::getAddrOfVTable(const CXXRecordDecl *RD, in getAddrOfVTable()
1410 llvm::GlobalVariable *&VTable = VTables[RD]; in getAddrOfVTable()
1418 llvm::raw_svector_ostream Out(OutName); in getAddrOfVTable()
1424 llvm::ArrayType *ArrayType = llvm::ArrayType::get( in getAddrOfVTable()
1428 Name, ArrayType, llvm::GlobalValue::ExternalLinkage); in getAddrOfVTable()
1432 VTable->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass); in getAddrOfVTable()
1434 VTable->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); in getAddrOfVTable()
1439 llvm::Value *ItaniumCXXABI::getVirtualFunctionPointer(CodeGenFunction &CGF, in getVirtualFunctionPointer()
1441 llvm::Value *This, in getVirtualFunctionPointer()
1442 llvm::Type *Ty) { in getVirtualFunctionPointer()
1445 llvm::Value *VTable = CGF.GetVTablePtr(This, Ty); in getVirtualFunctionPointer()
1451 llvm::Value *VFuncPtr = in getVirtualFunctionPointer()
1456 llvm::Value *ItaniumCXXABI::EmitVirtualDestructorCall( in EmitVirtualDestructorCall()
1458 llvm::Value *This, const CXXMemberCallExpr *CE) { in EmitVirtualDestructorCall()
1464 llvm::Type *Ty = CGF.CGM.getTypes().GetFunctionType(*FInfo); in EmitVirtualDestructorCall()
1465 llvm::Value *Callee = in EmitVirtualDestructorCall()
1475 llvm::GlobalVariable *VTT = VTables.GetAddrOfVTT(RD); in emitVirtualInheritanceTables()
1479 static llvm::Value *performTypeAdjustment(CodeGenFunction &CGF, in performTypeAdjustment()
1480 llvm::Value *Ptr, in performTypeAdjustment()
1487 llvm::Type *Int8PtrTy = CGF.Int8PtrTy; in performTypeAdjustment()
1488 llvm::Value *V = CGF.Builder.CreateBitCast(Ptr, Int8PtrTy); in performTypeAdjustment()
1496 llvm::Type *PtrDiffTy = in performTypeAdjustment()
1500 llvm::Value *VTablePtrPtr = in performTypeAdjustment()
1503 llvm::Value *VTablePtr = CGF.Builder.CreateLoad(VTablePtrPtr); in performTypeAdjustment()
1505 llvm::Value *OffsetPtr = in performTypeAdjustment()
1511 llvm::Value *Offset = CGF.Builder.CreateLoad(OffsetPtr); in performTypeAdjustment()
1526 llvm::Value *ItaniumCXXABI::performThisAdjustment(CodeGenFunction &CGF, in performThisAdjustment()
1527 llvm::Value *This, in performThisAdjustment()
1534 llvm::Value *
1535 ItaniumCXXABI::performReturnAdjustment(CodeGenFunction &CGF, llvm::Value *Ret, in performReturnAdjustment()
1548 llvm::Type *T = in EmitReturnFromThunk()
1549 cast<llvm::PointerType>(CGF.ReturnValue->getType())->getElementType(); in EmitReturnFromThunk()
1550 RValue Undef = RValue::get(llvm::UndefValue::get(T)); in EmitReturnFromThunk()
1563 llvm::Value *ItaniumCXXABI::InitializeArrayCookie(CodeGenFunction &CGF, in InitializeArrayCookie()
1564 llvm::Value *NewPtr, in InitializeArrayCookie()
1565 llvm::Value *NumElements, in InitializeArrayCookie()
1582 llvm::Value *CookiePtr = NewPtr; in InitializeArrayCookie()
1589 llvm::Type *NumElementsTy = CGF.ConvertType(SizeTy)->getPointerTo(AS); in InitializeArrayCookie()
1590 llvm::Value *NumElementsPtr = in InitializeArrayCookie()
1592 llvm::Instruction *SI = CGF.Builder.CreateStore(NumElements, NumElementsPtr); in InitializeArrayCookie()
1597 llvm::FunctionType *FTy = in InitializeArrayCookie()
1598 llvm::FunctionType::get(CGM.VoidTy, NumElementsTy, false); in InitializeArrayCookie()
1599 llvm::Constant *F = in InitializeArrayCookie()
1610 llvm::Value *ItaniumCXXABI::readArrayCookieImpl(CodeGenFunction &CGF, in readArrayCookieImpl()
1611 llvm::Value *allocPtr, in readArrayCookieImpl()
1614 llvm::Value *numElementsPtr = allocPtr; in readArrayCookieImpl()
1632 llvm::FunctionType *FTy = in readArrayCookieImpl()
1633 llvm::FunctionType::get(CGF.SizeTy, CGF.SizeTy->getPointerTo(0), false); in readArrayCookieImpl()
1634 llvm::Constant *F = in readArrayCookieImpl()
1652 llvm::Value *ARMCXXABI::InitializeArrayCookie(CodeGenFunction &CGF, in InitializeArrayCookie()
1653 llvm::Value *newPtr, in InitializeArrayCookie()
1654 llvm::Value *numElements, in InitializeArrayCookie()
1663 llvm::Value *cookie = newPtr; in InitializeArrayCookie()
1667 llvm::Value *elementSize = llvm::ConstantInt::get(CGF.SizeTy, in InitializeArrayCookie()
1682 llvm::Value *ARMCXXABI::readArrayCookieImpl(CodeGenFunction &CGF, in readArrayCookieImpl()
1683 llvm::Value *allocPtr, in readArrayCookieImpl()
1687 llvm::Value *numElementsPtr in readArrayCookieImpl()
1698 static llvm::Constant *getGuardAcquireFn(CodeGenModule &CGM, in getGuardAcquireFn()
1699 llvm::PointerType *GuardPtrTy) { in getGuardAcquireFn()
1701 llvm::FunctionType *FTy = in getGuardAcquireFn()
1702 llvm::FunctionType::get(CGM.getTypes().ConvertType(CGM.getContext().IntTy), in getGuardAcquireFn()
1705 llvm::AttributeSet::get(CGM.getLLVMContext(), in getGuardAcquireFn()
1706 llvm::AttributeSet::FunctionIndex, in getGuardAcquireFn()
1707 llvm::Attribute::NoUnwind)); in getGuardAcquireFn()
1710 static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM, in getGuardReleaseFn()
1711 llvm::PointerType *GuardPtrTy) { in getGuardReleaseFn()
1713 llvm::FunctionType *FTy = in getGuardReleaseFn()
1714 llvm::FunctionType::get(CGM.VoidTy, GuardPtrTy, /*isVarArg=*/false); in getGuardReleaseFn()
1716 llvm::AttributeSet::get(CGM.getLLVMContext(), in getGuardReleaseFn()
1717 llvm::AttributeSet::FunctionIndex, in getGuardReleaseFn()
1718 llvm::Attribute::NoUnwind)); in getGuardReleaseFn()
1721 static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM, in getGuardAbortFn()
1722 llvm::PointerType *GuardPtrTy) { in getGuardAbortFn()
1724 llvm::FunctionType *FTy = in getGuardAbortFn()
1725 llvm::FunctionType::get(CGM.VoidTy, GuardPtrTy, /*isVarArg=*/false); in getGuardAbortFn()
1727 llvm::AttributeSet::get(CGM.getLLVMContext(), in getGuardAbortFn()
1728 llvm::AttributeSet::FunctionIndex, in getGuardAbortFn()
1729 llvm::Attribute::NoUnwind)); in getGuardAbortFn()
1734 llvm::GlobalVariable *Guard;
1735 CallGuardAbort(llvm::GlobalVariable *Guard) : Guard(Guard) {} in CallGuardAbort()
1748 llvm::GlobalVariable *var, in EmitGuardedInit()
1761 llvm::IntegerType *guardTy; in EmitGuardedInit()
1769 llvm::PointerType *guardPtrTy = guardTy->getPointerTo(); in EmitGuardedInit()
1773 llvm::GlobalVariable *guard = CGM.getStaticLocalDeclGuardAddress(&D); in EmitGuardedInit()
1778 llvm::raw_svector_ostream out(guardName); in EmitGuardedInit()
1785 guard = new llvm::GlobalVariable(CGM.getModule(), guardTy, in EmitGuardedInit()
1787 llvm::ConstantInt::get(guardTy, 0), in EmitGuardedInit()
1795 llvm::Comdat *C = var->getComdat(); in EmitGuardedInit()
1824 llvm::LoadInst *LI = in EmitGuardedInit()
1835 LI->setAtomic(llvm::Acquire); in EmitGuardedInit()
1857 llvm::Value *V = in EmitGuardedInit()
1859 ? Builder.CreateAnd(LI, llvm::ConstantInt::get(CGM.Int8Ty, 1)) in EmitGuardedInit()
1861 llvm::Value *isInitialized = Builder.CreateIsNull(V, "guard.uninitialized"); in EmitGuardedInit()
1863 llvm::BasicBlock *InitCheckBlock = CGF.createBasicBlock("init.check"); in EmitGuardedInit()
1864 llvm::BasicBlock *EndBlock = CGF.createBasicBlock("init.end"); in EmitGuardedInit()
1874 llvm::Value *V in EmitGuardedInit()
1877 llvm::BasicBlock *InitBlock = CGF.createBasicBlock("init"); in EmitGuardedInit()
1898 Builder.CreateStore(llvm::ConstantInt::get(guardTy, 1), guard); in EmitGuardedInit()
1906 llvm::Constant *dtor, in emitGlobalDtorWithCXAAtExit()
1907 llvm::Constant *addr, in emitGlobalDtorWithCXAAtExit()
1911 const llvm::Triple &T = CGF.getTarget().getTriple(); in emitGlobalDtorWithCXAAtExit()
1918 llvm::Type *dtorTy = in emitGlobalDtorWithCXAAtExit()
1919 llvm::FunctionType::get(CGF.VoidTy, CGF.Int8PtrTy, false)->getPointerTo(); in emitGlobalDtorWithCXAAtExit()
1922 llvm::Type *paramTys[] = { dtorTy, CGF.Int8PtrTy, CGF.Int8PtrTy }; in emitGlobalDtorWithCXAAtExit()
1923 llvm::FunctionType *atexitTy = in emitGlobalDtorWithCXAAtExit()
1924 llvm::FunctionType::get(CGF.IntTy, paramTys, false); in emitGlobalDtorWithCXAAtExit()
1927 llvm::Constant *atexit = CGF.CGM.CreateRuntimeFunction(atexitTy, Name); in emitGlobalDtorWithCXAAtExit()
1928 if (llvm::Function *fn = dyn_cast<llvm::Function>(atexit)) in emitGlobalDtorWithCXAAtExit()
1932 llvm::Constant *handle = in emitGlobalDtorWithCXAAtExit()
1935 llvm::Value *args[] = { in emitGlobalDtorWithCXAAtExit()
1936 llvm::ConstantExpr::getBitCast(dtor, dtorTy), in emitGlobalDtorWithCXAAtExit()
1937 llvm::ConstantExpr::getBitCast(addr, CGF.Int8PtrTy), in emitGlobalDtorWithCXAAtExit()
1946 llvm::Constant *dtor, in registerGlobalDtor()
1947 llvm::Constant *addr) { in registerGlobalDtor()
1977 static llvm::GlobalValue::LinkageTypes
1979 llvm::GlobalValue::LinkageTypes VarLinkage = in getThreadLocalWrapperLinkage()
1983 if (llvm::GlobalValue::isLocalLinkage(VarLinkage)) in getThreadLocalWrapperLinkage()
1988 if (llvm::GlobalVariable::isLinkOnceLinkage(VarLinkage) || in getThreadLocalWrapperLinkage()
1989 llvm::GlobalVariable::isWeakODRLinkage(VarLinkage)) in getThreadLocalWrapperLinkage()
1990 return llvm::GlobalVariable::WeakAnyLinkage; in getThreadLocalWrapperLinkage()
1993 return llvm::GlobalValue::WeakODRLinkage; in getThreadLocalWrapperLinkage()
1996 llvm::Function *
1998 llvm::Value *Val) { in getOrCreateThreadLocalWrapper()
2002 llvm::raw_svector_ostream Out(WrapperName); in getOrCreateThreadLocalWrapper()
2007 if (llvm::Value *V = CGM.getModule().getNamedValue(WrapperName)) in getOrCreateThreadLocalWrapper()
2008 return cast<llvm::Function>(V); in getOrCreateThreadLocalWrapper()
2010 llvm::Type *RetTy = Val->getType(); in getOrCreateThreadLocalWrapper()
2014 llvm::FunctionType *FnTy = llvm::FunctionType::get(RetTy, false); in getOrCreateThreadLocalWrapper()
2015 llvm::Function *Wrapper = in getOrCreateThreadLocalWrapper()
2016 llvm::Function::Create(FnTy, getThreadLocalWrapperLinkage(VD, CGM), in getOrCreateThreadLocalWrapper()
2020 Wrapper->setVisibility(llvm::GlobalValue::HiddenVisibility); in getOrCreateThreadLocalWrapper()
2026 ArrayRef<std::pair<const VarDecl *, llvm::GlobalVariable *>> in EmitThreadLocalInitFuncs()
2027 CXXThreadLocals, ArrayRef<llvm::Function *> CXXThreadLocalInits, in EmitThreadLocalInitFuncs()
2028 ArrayRef<llvm::GlobalVariable *> CXXThreadLocalInitVars) { in EmitThreadLocalInitFuncs()
2029 llvm::Function *InitFunc = nullptr; in EmitThreadLocalInitFuncs()
2032 llvm::FunctionType *FTy = in EmitThreadLocalInitFuncs()
2033 llvm::FunctionType::get(CGM.VoidTy, /*isVarArg=*/false); in EmitThreadLocalInitFuncs()
2037 llvm::GlobalVariable *Guard = new llvm::GlobalVariable( in EmitThreadLocalInitFuncs()
2039 llvm::GlobalVariable::InternalLinkage, in EmitThreadLocalInitFuncs()
2040 llvm::ConstantInt::get(CGM.Int8Ty, 0), "__tls_guard"); in EmitThreadLocalInitFuncs()
2047 llvm::GlobalVariable *Var = CXXThreadLocals[I].second; in EmitThreadLocalInitFuncs()
2058 llvm::raw_svector_ostream Out(InitFnName); in EmitThreadLocalInitFuncs()
2066 llvm::GlobalValue *Init = nullptr; in EmitThreadLocalInitFuncs()
2071 Init = llvm::GlobalAlias::create(Var->getLinkage(), InitFnName.str(), in EmitThreadLocalInitFuncs()
2078 llvm::FunctionType *FnTy = llvm::FunctionType::get(CGM.VoidTy, false); in EmitThreadLocalInitFuncs()
2079 Init = llvm::Function::Create( in EmitThreadLocalInitFuncs()
2080 FnTy, llvm::GlobalVariable::ExternalWeakLinkage, InitFnName.str(), in EmitThreadLocalInitFuncs()
2087 llvm::Function *Wrapper = getOrCreateThreadLocalWrapper(VD, Var); in EmitThreadLocalInitFuncs()
2088 llvm::LLVMContext &Context = CGM.getModule().getContext(); in EmitThreadLocalInitFuncs()
2089 llvm::BasicBlock *Entry = llvm::BasicBlock::Create(Context, "", Wrapper); in EmitThreadLocalInitFuncs()
2096 llvm::Value *Have = Builder.CreateIsNotNull(Init); in EmitThreadLocalInitFuncs()
2097 llvm::BasicBlock *InitBB = llvm::BasicBlock::Create(Context, "", Wrapper); in EmitThreadLocalInitFuncs()
2098 llvm::BasicBlock *ExitBB = llvm::BasicBlock::Create(Context, "", Wrapper); in EmitThreadLocalInitFuncs()
2110 llvm::Value *Val = Var; in EmitThreadLocalInitFuncs()
2112 llvm::LoadInst *LI = Builder.CreateLoad(Val); in EmitThreadLocalInitFuncs()
2127 llvm::Type *Ty = CGF.getTypes().ConvertTypeForMem(T); in EmitThreadLocalVarDeclLValue()
2128 llvm::Value *Val = CGF.CGM.GetAddrOfGlobalVar(VD, Ty); in EmitThreadLocalVarDeclLValue()
2129 llvm::Function *Wrapper = getOrCreateThreadLocalWrapper(VD, Val); in EmitThreadLocalVarDeclLValue()
2165 llvm::LLVMContext &VMContext;
2169 SmallVector<llvm::Constant *, 16> Fields;
2172 llvm::GlobalVariable *
2173 GetAddrOfTypeName(QualType Ty, llvm::GlobalVariable::LinkageTypes Linkage);
2177 llvm::Constant *GetAddrOfExternalRTTIDescriptor(QualType Ty);
2247 llvm::Constant *BuildTypeInfo(QualType Ty, bool Force = false);
2251 llvm::GlobalVariable *ItaniumRTTIBuilder::GetAddrOfTypeName( in GetAddrOfTypeName()
2252 QualType Ty, llvm::GlobalVariable::LinkageTypes Linkage) { in GetAddrOfTypeName()
2254 llvm::raw_svector_ostream Out(OutName); in GetAddrOfTypeName()
2262 llvm::Constant *Init = llvm::ConstantDataArray::getString(VMContext, in GetAddrOfTypeName()
2265 llvm::GlobalVariable *GV = in GetAddrOfTypeName()
2273 llvm::Constant *
2277 llvm::raw_svector_ostream Out(OutName); in GetAddrOfExternalRTTIDescriptor()
2283 llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(Name); in GetAddrOfExternalRTTIDescriptor()
2287 GV = new llvm::GlobalVariable(CGM.getModule(), CGM.Int8PtrTy, in GetAddrOfExternalRTTIDescriptor()
2289 llvm::GlobalValue::ExternalLinkage, nullptr, in GetAddrOfExternalRTTIDescriptor()
2294 GV->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass); in GetAddrOfExternalRTTIDescriptor()
2298 return llvm::ConstantExpr::getBitCast(GV, CGM.Int8PtrTy); in GetAddrOfExternalRTTIDescriptor()
2602 llvm::Constant *VTable = in BuildVTablePointer()
2605 llvm::Type *PtrDiffTy = in BuildVTablePointer()
2609 llvm::Constant *Two = llvm::ConstantInt::get(PtrDiffTy, 2); in BuildVTablePointer()
2611 llvm::ConstantExpr::getInBoundsGetElementPtr(CGM.Int8PtrTy, VTable, Two); in BuildVTablePointer()
2612 VTable = llvm::ConstantExpr::getBitCast(VTable, CGM.Int8PtrTy); in BuildVTablePointer()
2619 static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM, in getTypeInfoLinkage()
2631 return llvm::GlobalValue::InternalLinkage; in getTypeInfoLinkage()
2637 return llvm::GlobalValue::InternalLinkage; in getTypeInfoLinkage()
2644 return llvm::GlobalValue::LinkOnceODRLinkage; in getTypeInfoLinkage()
2650 return llvm::GlobalValue::WeakODRLinkage; in getTypeInfoLinkage()
2655 return llvm::GlobalValue::LinkOnceODRLinkage; in getTypeInfoLinkage()
2661 llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo(QualType Ty, bool Force) { in BuildTypeInfo()
2667 llvm::raw_svector_ostream Out(OutName); in BuildTypeInfo()
2672 llvm::GlobalVariable *OldGV = CGM.getModule().getNamedGlobal(Name); in BuildTypeInfo()
2677 return llvm::ConstantExpr::getBitCast(OldGV, CGM.Int8PtrTy); in BuildTypeInfo()
2686 llvm::GlobalVariable::LinkageTypes Linkage; in BuildTypeInfo()
2688 Linkage = llvm::GlobalValue::ExternalLinkage; in BuildTypeInfo()
2696 llvm::GlobalVariable *TypeName = GetAddrOfTypeName(Ty, Linkage); in BuildTypeInfo()
2697 llvm::Constant *TypeNameField; in BuildTypeInfo()
2706 TypeNameField = llvm::ConstantExpr::getPtrToInt(TypeName, CGM.Int64Ty); in BuildTypeInfo()
2707 llvm::Constant *flag = in BuildTypeInfo()
2708 llvm::ConstantInt::get(CGM.Int64Ty, ((uint64_t)1) << 63); in BuildTypeInfo()
2709 TypeNameField = llvm::ConstantExpr::getAdd(TypeNameField, flag); in BuildTypeInfo()
2711 llvm::ConstantExpr::getIntToPtr(TypeNameField, CGM.Int8PtrTy); in BuildTypeInfo()
2713 TypeNameField = llvm::ConstantExpr::getBitCast(TypeName, CGM.Int8PtrTy); in BuildTypeInfo()
2799 llvm::Constant *Init = llvm::ConstantStruct::getAnon(Fields); in BuildTypeInfo()
2801 llvm::Module &M = CGM.getModule(); in BuildTypeInfo()
2802 llvm::GlobalVariable *GV = in BuildTypeInfo()
2803 new llvm::GlobalVariable(M, Init->getType(), in BuildTypeInfo()
2812 llvm::Constant *NewPtr = in BuildTypeInfo()
2813 llvm::ConstantExpr::getBitCast(GV, OldGV->getType()); in BuildTypeInfo()
2835 llvm::GlobalValue::VisibilityTypes llvmVisibility; in BuildTypeInfo()
2836 if (llvm::GlobalValue::isLocalLinkage(Linkage)) in BuildTypeInfo()
2838 llvmVisibility = llvm::GlobalValue::DefaultVisibility; in BuildTypeInfo()
2840 llvmVisibility = llvm::GlobalValue::HiddenVisibility; in BuildTypeInfo()
2846 return llvm::ConstantExpr::getBitCast(GV, CGM.Int8PtrTy); in BuildTypeInfo()
2884 llvm::Constant *BaseTypeInfo = in BuildObjCObjectTypeInfo()
2895 llvm::Constant *BaseTypeInfo = in BuildSIClassTypeInfo()
2904 llvm::SmallPtrSet<const CXXRecordDecl *, 16> NonVirtualBases;
2905 llvm::SmallPtrSet<const CXXRecordDecl *, 16> VirtualBases;
2964 llvm::Type *UnsignedIntLTy = in BuildVMIClassTypeInfo()
2972 Fields.push_back(llvm::ConstantInt::get(UnsignedIntLTy, Flags)); in BuildVMIClassTypeInfo()
2977 Fields.push_back(llvm::ConstantInt::get(UnsignedIntLTy, RD->getNumBases())); in BuildVMIClassTypeInfo()
2982 llvm::Type *LongLTy = in BuildVMIClassTypeInfo()
3033 Fields.push_back(llvm::ConstantInt::get(LongLTy, OffsetFlags)); in BuildVMIClassTypeInfo()
3055 llvm::Type *UnsignedIntLTy = in BuildPointerTypeInfo()
3057 Fields.push_back(llvm::ConstantInt::get(UnsignedIntLTy, Flags)); in BuildPointerTypeInfo()
3062 llvm::Constant *PointeeTypeInfo = in BuildPointerTypeInfo()
3093 llvm::Type *UnsignedIntLTy = in BuildPointerToMemberTypeInfo()
3095 Fields.push_back(llvm::ConstantInt::get(UnsignedIntLTy, Flags)); in BuildPointerToMemberTypeInfo()
3100 llvm::Constant *PointeeTypeInfo = in BuildPointerToMemberTypeInfo()
3112 llvm::Constant *ItaniumCXXABI::getAddrOfRTTIDescriptor(QualType Ty) { in getAddrOfRTTIDescriptor()
3145 QualType CanTy, llvm::GlobalValue::LinkageTypes Linkage) const { in classifyRTTIUniqueness()
3150 if (Linkage != llvm::GlobalValue::LinkOnceODRLinkage && in classifyRTTIUniqueness()
3151 Linkage != llvm::GlobalValue::WeakODRLinkage) in classifyRTTIUniqueness()
3159 if (Linkage == llvm::GlobalValue::LinkOnceODRLinkage) in classifyRTTIUniqueness()
3165 assert(Linkage == llvm::GlobalValue::WeakODRLinkage); in classifyRTTIUniqueness()
3190 llvm::GlobalValue::LinkageTypes Linkage = CGM.getFunctionLinkage(AliasDecl); in getCodegenToUse()
3192 if (llvm::GlobalValue::isDiscardableIfUnused(Linkage)) in getCodegenToUse()
3196 if (!llvm::GlobalAlias::isValidLinkage(Linkage)) in getCodegenToUse()
3199 if (llvm::GlobalValue::isWeakForLinker(Linkage)) { in getCodegenToUse()
3212 llvm::GlobalValue::LinkageTypes Linkage = CGM.getFunctionLinkage(AliasDecl); in emitConstructorDestructorAlias()
3215 llvm::GlobalValue *Entry = CGM.GetGlobalValue(MangledName); in emitConstructorDestructorAlias()
3219 auto *Aliasee = cast<llvm::GlobalValue>(CGM.GetAddrOfGlobal(TargetDecl)); in emitConstructorDestructorAlias()
3220 llvm::PointerType *AliasType = Aliasee->getType(); in emitConstructorDestructorAlias()
3223 auto *Alias = llvm::GlobalAlias::create( in emitConstructorDestructorAlias()
3266 auto *Aliasee = cast<llvm::GlobalValue>(CGM.GetAddrOfGlobal(BaseDecl)); in emitCXXStructor()
3280 llvm::Function *Fn = CGM.codegenCXXStructor(MD, Type); in emitCXXStructor()
3284 llvm::raw_svector_ostream Out(Buffer); in emitCXXStructor()
3289 llvm::Comdat *C = CGM.getModule().getOrInsertComdat(Out.str()); in emitCXXStructor()
3296 static llvm::Constant *getBeginCatchFn(CodeGenModule &CGM) { in getBeginCatchFn()
3298 llvm::FunctionType *FTy = llvm::FunctionType::get( in getBeginCatchFn()
3304 static llvm::Constant *getEndCatchFn(CodeGenModule &CGM) { in getEndCatchFn()
3306 llvm::FunctionType *FTy = in getEndCatchFn()
3307 llvm::FunctionType::get(CGM.VoidTy, /*IsVarArgs=*/false); in getEndCatchFn()
3312 static llvm::Constant *getGetExceptionPtrFn(CodeGenModule &CGM) { in getGetExceptionPtrFn()
3314 llvm::FunctionType *FTy = llvm::FunctionType::get( in getGetExceptionPtrFn()
3352 static llvm::Value *CallBeginCatch(CodeGenFunction &CGF, in CallBeginCatch()
3353 llvm::Value *Exn, in CallBeginCatch()
3355 llvm::CallInst *call = in CallBeginCatch()
3367 llvm::Value *ParamAddr, in InitCatchParam()
3370 llvm::Value *Exn = CGF.getExceptionFromSlot(); in InitCatchParam()
3374 llvm::Type *LLVMCatchTy = CGF.ConvertTypeForMem(CatchType); in InitCatchParam()
3383 llvm::Value *AdjustedExn = CallBeginCatch(CGF, Exn, EndCatchMightThrow); in InitCatchParam()
3417 llvm::Type *PtrTy = in InitCatchParam()
3418 cast<llvm::PointerType>(LLVMCatchTy)->getElementType(); in InitCatchParam()
3421 llvm::Value *ExnPtrTmp = CGF.CreateTempAlloca(PtrTy, "exn.byref.tmp"); in InitCatchParam()
3422 llvm::Value *Casted = CGF.Builder.CreateBitCast(AdjustedExn, PtrTy); in InitCatchParam()
3430 llvm::Value *ExnCast = in InitCatchParam()
3439 llvm::Value *AdjustedExn = CallBeginCatch(CGF, Exn, false); in InitCatchParam()
3444 llvm::Value *CastExn = in InitCatchParam()
3467 llvm::Type *PtrTy = LLVMCatchTy->getPointerTo(0); // addrspace 0 ok in InitCatchParam()
3468 llvm::Value *Cast = CGF.Builder.CreateBitCast(AdjustedExn, PtrTy); in InitCatchParam()
3479 llvm::Value *ExnLoad = CGF.EmitLoadOfScalar(srcLV, Loc); in InitCatchParam()
3491 llvm::Type *PtrTy = LLVMCatchTy->getPointerTo(0); // addrspace 0 ok in InitCatchParam()
3497 llvm::Value *rawAdjustedExn = CallBeginCatch(CGF, Exn, true); in InitCatchParam()
3498 llvm::Value *adjustedExn = CGF.Builder.CreateBitCast(rawAdjustedExn, PtrTy); in InitCatchParam()
3505 llvm::CallInst *rawAdjustedExn = in InitCatchParam()
3509 llvm::Value *adjustedExn = CGF.Builder.CreateBitCast(rawAdjustedExn, PtrTy); in InitCatchParam()
3567 llvm::Value *Exn = CGF.getExceptionFromSlot(); in emitBeginCatch()
3581 static llvm::Constant *getClangCallTerminateFn(CodeGenModule &CGM) { in getClangCallTerminateFn()
3582 llvm::FunctionType *fnTy = in getClangCallTerminateFn()
3583 llvm::FunctionType::get(CGM.VoidTy, CGM.Int8PtrTy, /*IsVarArgs=*/false); in getClangCallTerminateFn()
3584 llvm::Constant *fnRef = in getClangCallTerminateFn()
3587 llvm::Function *fn = dyn_cast<llvm::Function>(fnRef); in getClangCallTerminateFn()
3595 fn->addFnAttr(llvm::Attribute::NoInline); in getClangCallTerminateFn()
3599 fn->setLinkage(llvm::Function::LinkOnceODRLinkage); in getClangCallTerminateFn()
3600 fn->setVisibility(llvm::Function::HiddenVisibility); in getClangCallTerminateFn()
3605 llvm::BasicBlock *entry = in getClangCallTerminateFn()
3606 llvm::BasicBlock::Create(CGM.getLLVMContext(), "", fn); in getClangCallTerminateFn()
3610 llvm::Value *exn = &*fn->arg_begin(); in getClangCallTerminateFn()
3613 llvm::CallInst *catchCall = builder.CreateCall(getBeginCatchFn(CGM), exn); in getClangCallTerminateFn()
3618 llvm::CallInst *termCall = builder.CreateCall(CGM.getTerminateFn()); in getClangCallTerminateFn()
3630 llvm::CallInst *
3632 llvm::Value *Exn) { in emitTerminateForUnexpectedException()