Lines Matching refs:llvm
51 llvm::LLVMContext &VMContext;
61 llvm::Constant *getMessageSendFn() const { in getMessageSendFn()
64 llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy }; in getMessageSendFn()
66 CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy, in getMessageSendFn()
69 llvm::AttributeSet::get(CGM.getLLVMContext(), in getMessageSendFn()
70 llvm::AttributeSet::FunctionIndex, in getMessageSendFn()
71 llvm::Attribute::NonLazyBind)); in getMessageSendFn()
79 llvm::Constant *getMessageSendStretFn() const { in getMessageSendStretFn()
80 llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy }; in getMessageSendStretFn()
81 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.VoidTy, in getMessageSendStretFn()
92 llvm::Constant *getMessageSendFpretFn() const { in getMessageSendFpretFn()
93 llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy }; in getMessageSendFpretFn()
94 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.DoubleTy, in getMessageSendFpretFn()
105 llvm::Constant *getMessageSendFp2retFn() const { in getMessageSendFp2retFn()
106 llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy }; in getMessageSendFp2retFn()
107 llvm::Type *longDoubleType = llvm::Type::getX86_FP80Ty(VMContext); in getMessageSendFp2retFn()
108 llvm::Type *resultType = in getMessageSendFp2retFn()
109 llvm::StructType::get(longDoubleType, longDoubleType, nullptr); in getMessageSendFp2retFn()
111 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(resultType, in getMessageSendFp2retFn()
121 llvm::Constant *getMessageSendSuperFn() const { in getMessageSendSuperFn()
122 llvm::Type *params[] = { SuperPtrTy, SelectorPtrTy }; in getMessageSendSuperFn()
123 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy, in getMessageSendSuperFn()
132 llvm::Constant *getMessageSendSuperFn2() const { in getMessageSendSuperFn2()
133 llvm::Type *params[] = { SuperPtrTy, SelectorPtrTy }; in getMessageSendSuperFn2()
134 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy, in getMessageSendSuperFn2()
143 llvm::Constant *getMessageSendSuperStretFn() const { in getMessageSendSuperStretFn()
144 llvm::Type *params[] = { Int8PtrTy, SuperPtrTy, SelectorPtrTy }; in getMessageSendSuperStretFn()
146 llvm::FunctionType::get(CGM.VoidTy, params, true), in getMessageSendSuperStretFn()
154 llvm::Constant *getMessageSendSuperStretFn2() const { in getMessageSendSuperStretFn2()
155 llvm::Type *params[] = { Int8PtrTy, SuperPtrTy, SelectorPtrTy }; in getMessageSendSuperStretFn2()
157 llvm::FunctionType::get(CGM.VoidTy, params, true), in getMessageSendSuperStretFn2()
161 llvm::Constant *getMessageSendSuperFpretFn() const { in getMessageSendSuperFpretFn()
166 llvm::Constant *getMessageSendSuperFpretFn2() const { in getMessageSendSuperFpretFn2()
175 llvm::Type *ShortTy, *IntTy, *LongTy, *LongLongTy;
176 llvm::Type *Int8PtrTy, *Int8PtrPtrTy;
177 llvm::Type *IvarOffsetVarTy;
180 llvm::Type *ObjectPtrTy;
183 llvm::Type *PtrObjectPtrTy;
186 llvm::Type *SelectorPtrTy;
191 llvm::Type *ExternalProtocolPtrTy;
194 llvm::Type *getExternalProtocolPtrTy() { in getExternalProtocolPtrTy()
200 llvm::Type *T = Types.ConvertType(Ctx.getObjCProtoType()); in getExternalProtocolPtrTy()
201 ExternalProtocolPtrTy = llvm::PointerType::getUnqual(T); in getExternalProtocolPtrTy()
213 llvm::StructType *SuperTy;
215 llvm::Type *SuperPtrTy;
219 llvm::StructType *PropertyTy;
223 llvm::StructType *PropertyListTy;
225 llvm::Type *PropertyListPtrTy;
228 llvm::StructType *MethodTy;
231 llvm::Type *CacheTy;
233 llvm::Type *CachePtrTy;
235 llvm::Constant *getGetPropertyFn() { in getGetPropertyFn()
246 llvm::FunctionType *FTy = in getGetPropertyFn()
253 llvm::Constant *getSetPropertyFn() { in getSetPropertyFn()
266 llvm::FunctionType *FTy = in getSetPropertyFn()
273 llvm::Constant *getOptimizedSetPropertyFn(bool atomic, bool copy) { in getOptimizedSetPropertyFn()
292 llvm::FunctionType *FTy = in getOptimizedSetPropertyFn()
309 llvm::Constant *getCopyStructFn() { in getCopyStructFn()
319 llvm::FunctionType *FTy = in getCopyStructFn()
330 llvm::Constant *getCppAtomicObjectFunction() { in getCppAtomicObjectFunction()
338 llvm::FunctionType *FTy = in getCppAtomicObjectFunction()
346 llvm::Constant *getEnumerationMutationFn() { in getEnumerationMutationFn()
352 llvm::FunctionType *FTy = in getEnumerationMutationFn()
360 llvm::Constant *getGcReadWeakFn() { in getGcReadWeakFn()
362 llvm::Type *args[] = { ObjectPtrTy->getPointerTo() }; in getGcReadWeakFn()
363 llvm::FunctionType *FTy = in getGcReadWeakFn()
364 llvm::FunctionType::get(ObjectPtrTy, args, false); in getGcReadWeakFn()
369 llvm::Constant *getGcAssignWeakFn() { in getGcAssignWeakFn()
371 llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() }; in getGcAssignWeakFn()
372 llvm::FunctionType *FTy = in getGcAssignWeakFn()
373 llvm::FunctionType::get(ObjectPtrTy, args, false); in getGcAssignWeakFn()
378 llvm::Constant *getGcAssignGlobalFn() { in getGcAssignGlobalFn()
380 llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() }; in getGcAssignGlobalFn()
381 llvm::FunctionType *FTy = in getGcAssignGlobalFn()
382 llvm::FunctionType::get(ObjectPtrTy, args, false); in getGcAssignGlobalFn()
387 llvm::Constant *getGcAssignThreadLocalFn() { in getGcAssignThreadLocalFn()
389 llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() }; in getGcAssignThreadLocalFn()
390 llvm::FunctionType *FTy = in getGcAssignThreadLocalFn()
391 llvm::FunctionType::get(ObjectPtrTy, args, false); in getGcAssignThreadLocalFn()
396 llvm::Constant *getGcAssignIvarFn() { in getGcAssignIvarFn()
398 llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo(), in getGcAssignIvarFn()
400 llvm::FunctionType *FTy = in getGcAssignIvarFn()
401 llvm::FunctionType::get(ObjectPtrTy, args, false); in getGcAssignIvarFn()
406 llvm::Constant *GcMemmoveCollectableFn() { in GcMemmoveCollectableFn()
408 llvm::Type *args[] = { Int8PtrTy, Int8PtrTy, LongTy }; in GcMemmoveCollectableFn()
409 llvm::FunctionType *FTy = llvm::FunctionType::get(Int8PtrTy, args, false); in GcMemmoveCollectableFn()
414 llvm::Constant *getGcAssignStrongCastFn() { in getGcAssignStrongCastFn()
416 llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() }; in getGcAssignStrongCastFn()
417 llvm::FunctionType *FTy = in getGcAssignStrongCastFn()
418 llvm::FunctionType::get(ObjectPtrTy, args, false); in getGcAssignStrongCastFn()
423 llvm::Constant *getExceptionThrowFn() { in getExceptionThrowFn()
425 llvm::Type *args[] = { ObjectPtrTy }; in getExceptionThrowFn()
426 llvm::FunctionType *FTy = in getExceptionThrowFn()
427 llvm::FunctionType::get(CGM.VoidTy, args, false); in getExceptionThrowFn()
432 llvm::Constant *getExceptionRethrowFn() { in getExceptionRethrowFn()
434 llvm::FunctionType *FTy = llvm::FunctionType::get(CGM.VoidTy, false); in getExceptionRethrowFn()
439 llvm::Constant *getSyncEnterFn() { in getSyncEnterFn()
441 llvm::Type *args[] = { ObjectPtrTy }; in getSyncEnterFn()
442 llvm::FunctionType *FTy = in getSyncEnterFn()
443 llvm::FunctionType::get(CGM.IntTy, args, false); in getSyncEnterFn()
448 llvm::Constant *getSyncExitFn() { in getSyncExitFn()
450 llvm::Type *args[] = { ObjectPtrTy }; in getSyncExitFn()
451 llvm::FunctionType *FTy = in getSyncExitFn()
452 llvm::FunctionType::get(CGM.IntTy, args, false); in getSyncExitFn()
456 llvm::Constant *getSendFn(bool IsSuper) const { in getSendFn()
460 llvm::Constant *getSendFn2(bool IsSuper) const { in getSendFn2()
464 llvm::Constant *getSendStretFn(bool IsSuper) const { in getSendStretFn()
468 llvm::Constant *getSendStretFn2(bool IsSuper) const { in getSendStretFn2()
472 llvm::Constant *getSendFpretFn(bool IsSuper) const { in getSendFpretFn()
476 llvm::Constant *getSendFpretFn2(bool IsSuper) const { in getSendFpretFn2()
480 llvm::Constant *getSendFp2retFn(bool IsSuper) const { in getSendFp2retFn()
484 llvm::Constant *getSendFp2RetFn2(bool IsSuper) const { in getSendFp2RetFn2()
496 llvm::StructType *SymtabTy;
498 llvm::Type *SymtabPtrTy;
500 llvm::StructType *ModuleTy;
503 llvm::StructType *ProtocolTy;
505 llvm::Type *ProtocolPtrTy;
508 llvm::StructType *ProtocolExtensionTy;
511 llvm::Type *ProtocolExtensionPtrTy;
514 llvm::StructType *MethodDescriptionTy;
517 llvm::StructType *MethodDescriptionListTy;
520 llvm::Type *MethodDescriptionListPtrTy;
522 llvm::StructType *ProtocolListTy;
524 llvm::Type *ProtocolListPtrTy;
526 llvm::StructType *CategoryTy;
528 llvm::StructType *ClassTy;
530 llvm::Type *ClassPtrTy;
532 llvm::StructType *ClassExtensionTy;
534 llvm::Type *ClassExtensionPtrTy;
536 llvm::StructType *IvarTy;
538 llvm::Type *IvarListTy;
540 llvm::Type *IvarListPtrTy;
542 llvm::Type *MethodListTy;
544 llvm::Type *MethodListPtrTy;
547 llvm::Type *ExceptionDataTy;
550 llvm::Constant *getExceptionTryEnterFn() { in getExceptionTryEnterFn()
551 llvm::Type *params[] = { ExceptionDataTy->getPointerTo() }; in getExceptionTryEnterFn()
553 llvm::FunctionType::get(CGM.VoidTy, params, false), in getExceptionTryEnterFn()
558 llvm::Constant *getExceptionTryExitFn() { in getExceptionTryExitFn()
559 llvm::Type *params[] = { ExceptionDataTy->getPointerTo() }; in getExceptionTryExitFn()
561 llvm::FunctionType::get(CGM.VoidTy, params, false), in getExceptionTryExitFn()
566 llvm::Constant *getExceptionExtractFn() { in getExceptionExtractFn()
567 llvm::Type *params[] = { ExceptionDataTy->getPointerTo() }; in getExceptionExtractFn()
568 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy, in getExceptionExtractFn()
574 llvm::Constant *getExceptionMatchFn() { in getExceptionMatchFn()
575 llvm::Type *params[] = { ClassPtrTy, ObjectPtrTy }; in getExceptionMatchFn()
577 llvm::FunctionType::get(CGM.Int32Ty, params, false), in getExceptionMatchFn()
583 llvm::Constant *getSetJmpFn() { in getSetJmpFn()
585 llvm::Type *params[] = { CGM.Int32Ty->getPointerTo() }; in getSetJmpFn()
587 CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.Int32Ty, in getSetJmpFn()
590 llvm::AttributeSet::get(CGM.getLLVMContext(), in getSetJmpFn()
591 llvm::AttributeSet::FunctionIndex, in getSetJmpFn()
592 llvm::Attribute::NonLazyBind)); in getSetJmpFn()
605 llvm::StructType *MethodListnfABITy;
608 llvm::Type *MethodListnfABIPtrTy;
611 llvm::StructType *ProtocolnfABITy;
614 llvm::Type *ProtocolnfABIPtrTy;
617 llvm::StructType *ProtocolListnfABITy;
620 llvm::Type *ProtocolListnfABIPtrTy;
623 llvm::StructType *ClassnfABITy;
626 llvm::Type *ClassnfABIPtrTy;
629 llvm::StructType *IvarnfABITy;
632 llvm::StructType *IvarListnfABITy;
635 llvm::Type *IvarListnfABIPtrTy;
638 llvm::StructType *ClassRonfABITy;
641 llvm::Type *ImpnfABITy;
644 llvm::StructType *CategorynfABITy;
653 llvm::StructType *MessageRefTy;
658 llvm::Type *MessageRefPtrTy;
663 llvm::FunctionType *MessengerTy;
670 llvm::StructType *SuperMessageRefTy;
673 llvm::Type *SuperMessageRefPtrTy;
675 llvm::Constant *getMessageSendFixupFn() { in getMessageSendFixupFn()
677 llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy }; in getMessageSendFixupFn()
678 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy, in getMessageSendFixupFn()
683 llvm::Constant *getMessageSendFpretFixupFn() { in getMessageSendFpretFixupFn()
685 llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy }; in getMessageSendFpretFixupFn()
686 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy, in getMessageSendFpretFixupFn()
691 llvm::Constant *getMessageSendStretFixupFn() { in getMessageSendStretFixupFn()
693 llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy }; in getMessageSendStretFixupFn()
694 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy, in getMessageSendStretFixupFn()
699 llvm::Constant *getMessageSendSuper2FixupFn() { in getMessageSendSuper2FixupFn()
702 llvm::Type *params[] = { SuperPtrTy, SuperMessageRefPtrTy }; in getMessageSendSuper2FixupFn()
703 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy, in getMessageSendSuper2FixupFn()
708 llvm::Constant *getMessageSendSuper2StretFixupFn() { in getMessageSendSuper2StretFixupFn()
711 llvm::Type *params[] = { SuperPtrTy, SuperMessageRefPtrTy }; in getMessageSendSuper2StretFixupFn()
712 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy, in getMessageSendSuper2StretFixupFn()
717 llvm::Constant *getObjCEndCatchFn() { in getObjCEndCatchFn()
718 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.VoidTy, false), in getObjCEndCatchFn()
723 llvm::Constant *getObjCBeginCatchFn() { in getObjCBeginCatchFn()
724 llvm::Type *params[] = { Int8PtrTy }; in getObjCBeginCatchFn()
725 return CGM.CreateRuntimeFunction(llvm::FunctionType::get(Int8PtrTy, in getObjCBeginCatchFn()
730 llvm::StructType *EHTypeTy;
731 llvm::Type *EHTypePtrTy;
829 llvm::LLVMContext &VMContext;
842 llvm::SetVector<IdentifierInfo*> LazySymbols;
848 llvm::SetVector<IdentifierInfo*> DefinedSymbols;
851 llvm::StringMap<llvm::GlobalVariable*> ClassNames;
854 llvm::DenseMap<Selector, llvm::GlobalVariable*> MethodVarNames;
857 llvm::SetVector<std::string> DefinedCategoryNames;
861 llvm::StringMap<llvm::GlobalVariable*> MethodVarTypes;
865 llvm::DenseMap<const ObjCMethodDecl*, llvm::Function*> MethodDefinitions;
868 llvm::DenseMap<IdentifierInfo*, llvm::GlobalVariable*> PropertyNames;
871 llvm::DenseMap<IdentifierInfo*, llvm::GlobalVariable*> ClassReferences;
874 llvm::DenseMap<Selector, llvm::GlobalVariable*> SelectorReferences;
879 llvm::DenseMap<IdentifierInfo*, llvm::GlobalVariable*> Protocols;
883 llvm::DenseSet<IdentifierInfo*> DefinedProtocols;
886 SmallVector<llvm::GlobalValue*, 16> DefinedClasses;
892 SmallVector<llvm::GlobalValue*, 16> DefinedNonLazyClasses;
895 SmallVector<llvm::GlobalValue*, 16> DefinedCategories;
898 SmallVector<llvm::GlobalValue*, 16> DefinedNonLazyCategories;
908 llvm::Constant *GetMethodVarName(Selector Sel);
909 llvm::Constant *GetMethodVarName(IdentifierInfo *Ident);
915 llvm::Constant *GetMethodVarType(const ObjCMethodDecl *D,
917 llvm::Constant *GetMethodVarType(const FieldDecl *D);
921 llvm::Constant *GetPropertyName(IdentifierInfo *Ident);
924 llvm::Constant *GetPropertyTypeString(const ObjCPropertyDecl *PD,
930 llvm::Constant *GetClassName(StringRef RuntimeName);
932 llvm::Function *GetMethodDefinition(const ObjCMethodDecl *MD);
937 llvm::Constant *BuildIvarLayout(const ObjCImplementationDecl *OI,
940 llvm::Constant *BuildIvarLayoutBitmap(std::string &BitMap);
946 const llvm::StructLayout *Layout,
963 void BuildRCRecordLayout(const llvm::StructLayout *RecLayout,
971 llvm::Constant *getBitmapBlockLayout(bool ComputeByrefLayout);
976 llvm::Constant *GetIvarLayoutName(IdentifierInfo *Ident,
981 llvm::Constant *EmitPropertyList(Twine Name,
988 llvm::Constant *EmitProtocolMethodTypes(Twine Name,
989 ArrayRef<llvm::Constant*> MethodTypes,
994 llvm::SmallPtrSet<const IdentifierInfo*, 16> &PropertySet,
995 SmallVectorImpl<llvm::Constant*> &Properties,
1003 llvm::Constant *GetProtocolRef(const ObjCProtocolDecl *PD);
1019 llvm::GlobalVariable *CreateMetadataVar(Twine Name, llvm::Constant *Init,
1026 llvm::Value *Sel,
1027 llvm::Value *Arg0,
1042 llvm::Constant *GenerateConstantString(const StringLiteral *SL) override;
1044 llvm::Function *GenerateMethod(const ObjCMethodDecl *OMD,
1052 virtual llvm::Constant *GetOrEmitProtocol(const ObjCProtocolDecl *PD)=0;
1058 virtual llvm::Constant *GetOrEmitProtocolRef(const ObjCProtocolDecl *PD)=0;
1059 llvm::Constant *BuildGCBlockLayout(CodeGen::CodeGenModule &CGM,
1061 llvm::Constant *BuildRCBlockLayout(CodeGen::CodeGenModule &CGM,
1064 llvm::Constant *BuildByrefLayout(CodeGen::CodeGenModule &CGM,
1078 llvm::Constant *EmitModuleSymbols();
1087 llvm::Constant *EmitClassExtension(const ObjCImplementationDecl *ID);
1091 llvm::Value *EmitClassRef(CodeGenFunction &CGF,
1094 llvm::Value *EmitClassRefFromId(CodeGenFunction &CGF,
1097 llvm::Value *EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) override;
1100 llvm::Value *EmitSuperClassRef(const ObjCInterfaceDecl *ID);
1107 llvm::Constant *EmitIvarList(const ObjCImplementationDecl *ID,
1113 llvm::Constant *EmitMetaClassRef(const ObjCInterfaceDecl *ID);
1117 llvm::Constant *EmitMetaClass(const ObjCImplementationDecl *ID,
1118 llvm::Constant *Protocols,
1119 ArrayRef<llvm::Constant*> Methods);
1121 llvm::Constant *GetMethodConstant(const ObjCMethodDecl *MD);
1123 llvm::Constant *GetMethodDescriptionConstant(const ObjCMethodDecl *MD);
1127 llvm::Constant *EmitMethodList(Twine Name,
1129 ArrayRef<llvm::Constant*> Methods);
1142 llvm::Constant *EmitMethodDescList(Twine Name,
1144 ArrayRef<llvm::Constant*> Methods);
1149 llvm::Constant *GetOrEmitProtocol(const ObjCProtocolDecl *PD) override;
1155 llvm::Constant *GetOrEmitProtocolRef(const ObjCProtocolDecl *PD) override;
1161 llvm::Constant *
1163 ArrayRef<llvm::Constant*> OptInstanceMethods,
1164 ArrayRef<llvm::Constant*> OptClassMethods,
1165 ArrayRef<llvm::Constant*> MethodTypesExt);
1169 llvm::Constant *EmitProtocolList(Twine Name,
1175 llvm::Value *EmitSelector(CodeGenFunction &CGF, Selector Sel,
1181 llvm::Function *ModuleInitFunction() override;
1186 Selector Sel, llvm::Value *Receiver,
1195 bool isCategoryImpl, llvm::Value *Receiver,
1199 llvm::Value *GetClass(CodeGenFunction &CGF,
1202 llvm::Value *GetSelector(CodeGenFunction &CGF, Selector Sel,
1207 llvm::Value *GetSelector(CodeGenFunction &CGF,
1210 llvm::Constant *GetEHType(QualType T) override;
1218 llvm::Value *GenerateProtocolRef(CodeGenFunction &CGF,
1221 llvm::Constant *GetPropertyGetFunction() override;
1222 llvm::Constant *GetPropertySetFunction() override;
1223 llvm::Constant *GetOptimizedPropertySetFunction(bool atomic,
1225 llvm::Constant *GetGetStructFunction() override;
1226 llvm::Constant *GetSetStructFunction() override;
1227 llvm::Constant *GetCppAtomicObjectGetFunction() override;
1228 llvm::Constant *GetCppAtomicObjectSetFunction() override;
1229 llvm::Constant *EnumerationMutationFunction() override;
1238 llvm::Value * EmitObjCWeakRead(CodeGen::CodeGenFunction &CGF,
1239 llvm::Value *AddrWeakObj) override;
1241 llvm::Value *src, llvm::Value *dst) override;
1243 llvm::Value *src, llvm::Value *dest,
1246 llvm::Value *src, llvm::Value *dest,
1247 llvm::Value *ivarOffset) override;
1249 llvm::Value *src, llvm::Value *dest) override;
1251 llvm::Value *dest, llvm::Value *src,
1252 llvm::Value *size) override;
1255 llvm::Value *BaseValue, const ObjCIvarDecl *Ivar,
1257 llvm::Value *EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
1263 llvm::GlobalVariable *GetClassGlobal(const std::string &Name, in GetClassGlobal()
1272 llvm::GlobalVariable* ObjCEmptyCacheVar;
1273 llvm::GlobalVariable* ObjCEmptyVtableVar;
1276 llvm::DenseMap<IdentifierInfo*, llvm::GlobalVariable*> SuperClassReferences;
1279 llvm::DenseMap<IdentifierInfo*, llvm::GlobalVariable*> MetaClassReferences;
1282 llvm::DenseMap<IdentifierInfo*, llvm::GlobalVariable*> EHTypeReferences;
1286 llvm::DenseSet<Selector> VTableDispatchMethods;
1289 std::vector<llvm::GlobalValue*> DefinedMetaClasses;
1301 void AddModuleClassList(ArrayRef<llvm::GlobalValue*> Container,
1305 llvm::GlobalVariable * BuildClassRoTInitializer(unsigned flags,
1309 llvm::GlobalVariable * BuildClassMetaData(const std::string &ClassName,
1310 llvm::Constant *IsAGV,
1311 llvm::Constant *SuperClassGV,
1312 llvm::Constant *ClassRoGV,
1316 llvm::Constant *GetMethodConstant(const ObjCMethodDecl *MD);
1318 llvm::Constant *GetMethodDescriptionConstant(const ObjCMethodDecl *MD);
1322 llvm::Constant *EmitMethodList(Twine Name,
1324 ArrayRef<llvm::Constant*> Methods);
1330 llvm::Constant *EmitIvarList(const ObjCImplementationDecl *ID);
1332 llvm::Constant *EmitIvarOffsetVar(const ObjCInterfaceDecl *ID,
1339 llvm::Constant *GetOrEmitProtocol(const ObjCProtocolDecl *PD) override;
1345 llvm::Constant *GetOrEmitProtocolRef(const ObjCProtocolDecl *PD) override;
1349 llvm::Constant *EmitProtocolList(Twine Name,
1357 llvm::Value *Receiver,
1365 llvm::GlobalVariable *GetClassGlobal(const std::string &Name,
1370 llvm::Value *EmitClassRef(CodeGenFunction &CGF,
1373 llvm::Value *EmitClassRefFromId(CodeGenFunction &CGF,
1377 llvm::Value *EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) override;
1381 llvm::Value *EmitSuperClassRef(CodeGenFunction &CGF,
1386 llvm::Value *EmitMetaClassRef(CodeGenFunction &CGF,
1392 llvm::GlobalVariable * ObjCIvarOffsetVariable(
1398 llvm::Value *EmitSelector(CodeGenFunction &CGF, Selector Sel,
1403 llvm::Constant *GetInterfaceEHType(const ObjCInterfaceDecl *ID,
1456 llvm::Function *ModuleInitFunction() override;
1461 llvm::Value *Receiver,
1470 bool isCategoryImpl, llvm::Value *Receiver,
1474 llvm::Value *GetClass(CodeGenFunction &CGF,
1477 llvm::Value *GetSelector(CodeGenFunction &CGF, Selector Sel, in GetSelector()
1483 llvm::Value *GetSelector(CodeGenFunction &CGF, in GetSelector()
1493 llvm::Value *GenerateProtocolRef(CodeGenFunction &CGF,
1496 llvm::Constant *GetEHType(QualType T) override;
1498 llvm::Constant *GetPropertyGetFunction() override { in GetPropertyGetFunction()
1501 llvm::Constant *GetPropertySetFunction() override { in GetPropertySetFunction()
1505 llvm::Constant *GetOptimizedPropertySetFunction(bool atomic, in GetOptimizedPropertySetFunction()
1510 llvm::Constant *GetSetStructFunction() override { in GetSetStructFunction()
1513 llvm::Constant *GetGetStructFunction() override { in GetGetStructFunction()
1516 llvm::Constant *GetCppAtomicObjectSetFunction() override { in GetCppAtomicObjectSetFunction()
1519 llvm::Constant *GetCppAtomicObjectGetFunction() override { in GetCppAtomicObjectGetFunction()
1523 llvm::Constant *EnumerationMutationFunction() override { in EnumerationMutationFunction()
1533 llvm::Value * EmitObjCWeakRead(CodeGen::CodeGenFunction &CGF,
1534 llvm::Value *AddrWeakObj) override;
1536 llvm::Value *src, llvm::Value *dst) override;
1538 llvm::Value *src, llvm::Value *dest,
1541 llvm::Value *src, llvm::Value *dest,
1542 llvm::Value *ivarOffset) override;
1544 llvm::Value *src, llvm::Value *dest) override;
1546 llvm::Value *dest, llvm::Value *src,
1547 llvm::Value *size) override;
1549 llvm::Value *BaseValue, const ObjCIvarDecl *Ivar,
1551 llvm::Value *EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
1559 llvm::BasicBlock *NullBB;
1563 void init(CodeGenFunction &CGF, llvm::Value *receiver) { in init()
1566 llvm::BasicBlock *callBB = CGF.createBasicBlock("msgSend.call"); in init()
1572 llvm::Value *isNull = CGF.Builder.CreateIsNull(receiver); in init()
1589 llvm::BasicBlock *contBB = nullptr; in complete()
1592 llvm::BasicBlock *callBB = CGF.Builder.GetInsertBlock(); in complete()
1629 llvm::Constant *null = CGF.CGM.EmitNullConstant(resultType); in complete()
1636 llvm::PHINode *phi = CGF.Builder.CreatePHI(null->getType(), 2); in complete()
1658 llvm::Type *scalarTy = callResult.first->getType(); in complete()
1659 llvm::Constant *scalarZero = llvm::Constant::getNullValue(scalarTy); in complete()
1662 llvm::PHINode *real = CGF.Builder.CreatePHI(scalarTy, 2); in complete()
1665 llvm::PHINode *imag = CGF.Builder.CreatePHI(scalarTy, 2); in complete()
1677 static llvm::Constant *getConstantGEP(llvm::LLVMContext &VMContext, in getConstantGEP()
1678 llvm::GlobalVariable *C, unsigned idx0, in getConstantGEP()
1680 llvm::Value *Idxs[] = { in getConstantGEP()
1681 llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), idx0), in getConstantGEP()
1682 llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), idx1) in getConstantGEP()
1684 return llvm::ConstantExpr::getGetElementPtr(C->getValueType(), C, Idxs); in getConstantGEP()
1708 llvm::Value *CGObjCMac::GetClass(CodeGenFunction &CGF, in GetClass()
1714 llvm::Value *CGObjCMac::GetSelector(CodeGenFunction &CGF, Selector Sel, in GetSelector()
1718 llvm::Value *CGObjCMac::GetSelector(CodeGenFunction &CGF, const ObjCMethodDecl in GetSelector()
1723 llvm::Constant *CGObjCMac::GetEHType(QualType T) { in GetEHType()
1759 llvm::Constant *CGObjCCommonMac::GenerateConstantString( in GenerateConstantString()
1780 llvm::Value *Receiver, in GenerateMessageSendSuper()
1786 llvm::Value *ObjCSuper = in GenerateMessageSendSuper()
1788 llvm::Value *ReceiverAsObject = in GenerateMessageSendSuper()
1795 llvm::Value *Target; in GenerateMessageSendSuper()
1808 llvm::Constant *MetaClassPtr = EmitMetaClassRef(Class); in GenerateMessageSendSuper()
1809 llvm::Value *SuperPtr = in GenerateMessageSendSuper()
1811 llvm::Value *Super = CGF.Builder.CreateLoad(SuperPtr); in GenerateMessageSendSuper()
1817 llvm::Value *ClassPtr = EmitSuperClassRef(Class); in GenerateMessageSendSuper()
1823 llvm::Type *ClassTy = in GenerateMessageSendSuper()
1839 llvm::Value *Receiver, in GenerateMessageSend()
1853 llvm::Value *Sel, in EmitMessageSend()
1854 llvm::Value *Arg0, in EmitMessageSend()
1877 llvm::Constant *Fn = nullptr; in EmitMessageSend()
1908 Fn = llvm::ConstantExpr::getBitCast(Fn, MSI.MessengerType); in EmitMessageSend()
1934 llvm::Constant *CGObjCCommonMac::BuildGCBlockLayout(CodeGenModule &CGM, in BuildGCBlockLayout()
1937 llvm::Constant *nullPtr = llvm::Constant::getNullValue(CGM.Int8PtrTy); in BuildGCBlockLayout()
1955 const llvm::StructLayout *layout = in BuildGCBlockLayout()
2001 llvm::array_pod_sort(IvarsInfo.begin(), IvarsInfo.end()); in BuildGCBlockLayout()
2002 llvm::array_pod_sort(SkipIvars.begin(), SkipIvars.end()); in BuildGCBlockLayout()
2005 llvm::Constant *C = BuildIvarLayoutBitmap(BitMap); in BuildGCBlockLayout()
2058 void CGObjCCommonMac::BuildRCRecordLayout(const llvm::StructLayout *RecLayout, in BuildRCRecordLayout()
2188 llvm::Type *Ty = CGM.getTypes().ConvertType(QualType(RT, 0)); in BuildRCBlockVarRecordLayout()
2189 const llvm::StructLayout *RecLayout = in BuildRCBlockVarRecordLayout()
2190 CGM.getDataLayout().getStructLayout(cast<llvm::StructType>(Ty)); in BuildRCBlockVarRecordLayout()
2301 llvm::Constant *CGObjCCommonMac::getBitmapBlockLayout(bool ComputeByrefLayout) { in getBitmapBlockLayout()
2302 llvm::Constant *nullPtr = llvm::Constant::getNullValue(CGM.Int8PtrTy); in getBitmapBlockLayout()
2311 llvm::array_pod_sort(RunSkipBlockVars.begin(), RunSkipBlockVars.end()); in getBitmapBlockLayout()
2385 const llvm::APInt Instruction(64, Result); in getBitmapBlockLayout()
2386 return llvm::Constant::getIntegerValue(CGM.Int64Ty, Instruction); in getBitmapBlockLayout()
2389 const llvm::APInt Instruction(32, Result); in getBitmapBlockLayout()
2390 return llvm::Constant::getIntegerValue(CGM.Int32Ty, Instruction); in getBitmapBlockLayout()
2443 llvm::GlobalVariable *Entry = CreateMetadataVar( in getBitmapBlockLayout()
2445 llvm::ConstantDataArray::getString(VMContext, BitMap, false), in getBitmapBlockLayout()
2450 llvm::Constant *CGObjCCommonMac::BuildRCBlockLayout(CodeGenModule &CGM, in BuildRCBlockLayout()
2464 const llvm::StructLayout *layout = in BuildRCBlockLayout()
2504 llvm::Constant *CGObjCCommonMac::BuildByrefLayout(CodeGen::CodeGenModule &CGM, in BuildByrefLayout()
2513 llvm::Constant *Result = getBitmapBlockLayout(true); in BuildByrefLayout()
2516 llvm::Constant *nullPtr = llvm::Constant::getNullValue(CGM.Int8PtrTy); in BuildByrefLayout()
2520 llvm::Value *CGObjCMac::GenerateProtocolRef(CodeGenFunction &CGF, in GenerateProtocolRef()
2526 return llvm::ConstantExpr::getBitCast(GetProtocolRef(PD), in GenerateProtocolRef()
2542 llvm::Constant *CGObjCCommonMac::GetProtocolRef(const ObjCProtocolDecl *PD) { in GetProtocolRef()
2561 llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) { in GetOrEmitProtocol()
2562 llvm::GlobalVariable *Entry = Protocols[PD->getIdentifier()]; in GetOrEmitProtocol()
2577 std::vector<llvm::Constant*> InstanceMethods, ClassMethods; in GetOrEmitProtocol()
2578 std::vector<llvm::Constant*> OptInstanceMethods, OptClassMethods; in GetOrEmitProtocol()
2579 std::vector<llvm::Constant*> MethodTypesExt, OptMethodTypesExt; in GetOrEmitProtocol()
2581 llvm::Constant *C = GetMethodDescriptionConstant(MD); in GetOrEmitProtocol()
2595 llvm::Constant *C = GetMethodDescriptionConstant(MD); in GetOrEmitProtocol()
2611 llvm::Constant *Values[] = { in GetOrEmitProtocol()
2623 llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ProtocolTy, in GetOrEmitProtocol()
2631 Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolTy, in GetOrEmitProtocol()
2632 false, llvm::GlobalValue::PrivateLinkage, in GetOrEmitProtocol()
2645 llvm::Constant *CGObjCMac::GetOrEmitProtocolRef(const ObjCProtocolDecl *PD) { in GetOrEmitProtocolRef()
2646 llvm::GlobalVariable *&Entry = Protocols[PD->getIdentifier()]; in GetOrEmitProtocolRef()
2652 Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolTy, in GetOrEmitProtocolRef()
2653 false, llvm::GlobalValue::PrivateLinkage, in GetOrEmitProtocolRef()
2672 llvm::Constant *
2674 ArrayRef<llvm::Constant*> OptInstanceMethods, in EmitProtocolExtension()
2675 ArrayRef<llvm::Constant*> OptClassMethods, in EmitProtocolExtension()
2676 ArrayRef<llvm::Constant*> MethodTypesExt) { in EmitProtocolExtension()
2679 llvm::Constant *Values[] = { in EmitProtocolExtension()
2680 llvm::ConstantInt::get(ObjCTypes.IntTy, Size), in EmitProtocolExtension()
2695 return llvm::Constant::getNullValue(ObjCTypes.ProtocolExtensionPtrTy); in EmitProtocolExtension()
2697 llvm::Constant *Init = in EmitProtocolExtension()
2698 llvm::ConstantStruct::get(ObjCTypes.ProtocolExtensionTy, Values); in EmitProtocolExtension()
2712 llvm::Constant *
2716 SmallVector<llvm::Constant *, 16> ProtocolRefs; in EmitProtocolList()
2723 return llvm::Constant::getNullValue(ObjCTypes.ProtocolListPtrTy); in EmitProtocolList()
2726 ProtocolRefs.push_back(llvm::Constant::getNullValue(ObjCTypes.ProtocolPtrTy)); in EmitProtocolList()
2728 llvm::Constant *Values[3]; in EmitProtocolList()
2730 Values[0] = llvm::Constant::getNullValue(ObjCTypes.ProtocolListPtrTy); in EmitProtocolList()
2731 Values[1] = llvm::ConstantInt::get(ObjCTypes.LongTy, in EmitProtocolList()
2734 llvm::ConstantArray::get(llvm::ArrayType::get(ObjCTypes.ProtocolPtrTy, in EmitProtocolList()
2738 llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values); in EmitProtocolList()
2739 llvm::GlobalVariable *GV = in EmitProtocolList()
2742 return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.ProtocolListPtrTy); in EmitProtocolList()
2746 PushProtocolProperties(llvm::SmallPtrSet<const IdentifierInfo*,16> &PropertySet, in PushProtocolProperties()
2747 SmallVectorImpl<llvm::Constant *> &Properties, in PushProtocolProperties()
2756 llvm::Constant *Prop[] = { in PushProtocolProperties()
2760 Properties.push_back(llvm::ConstantStruct::get(ObjCTypes.PropertyTy, Prop)); in PushProtocolProperties()
2776 llvm::Constant *CGObjCCommonMac::EmitPropertyList(Twine Name, in EmitPropertyList()
2780 SmallVector<llvm::Constant *, 16> Properties; in EmitPropertyList()
2781 llvm::SmallPtrSet<const IdentifierInfo*, 16> PropertySet; in EmitPropertyList()
2784 llvm::Constant *Prop[] = { in EmitPropertyList()
2788 Properties.push_back(llvm::ConstantStruct::get(ObjCTypes.PropertyTy, in EmitPropertyList()
2802 return llvm::Constant::getNullValue(ObjCTypes.PropertyListPtrTy); in EmitPropertyList()
2806 llvm::Constant *Values[3]; in EmitPropertyList()
2807 Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, PropertySize); in EmitPropertyList()
2808 Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Properties.size()); in EmitPropertyList()
2809 llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.PropertyTy, in EmitPropertyList()
2811 Values[2] = llvm::ConstantArray::get(AT, Properties); in EmitPropertyList()
2812 llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values); in EmitPropertyList()
2814 llvm::GlobalVariable *GV = in EmitPropertyList()
2820 return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.PropertyListPtrTy); in EmitPropertyList()
2823 llvm::Constant *
2825 ArrayRef<llvm::Constant*> MethodTypes, in EmitProtocolMethodTypes()
2829 return llvm::Constant::getNullValue(ObjCTypes.Int8PtrPtrTy); in EmitProtocolMethodTypes()
2831 llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.Int8PtrTy, in EmitProtocolMethodTypes()
2833 llvm::Constant *Init = llvm::ConstantArray::get(AT, MethodTypes); in EmitProtocolMethodTypes()
2835 llvm::GlobalVariable *GV = CreateMetadataVar( in EmitProtocolMethodTypes()
2838 return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.Int8PtrPtrTy); in EmitProtocolMethodTypes()
2847 llvm::Constant *
2849 llvm::Constant *Desc[] = { in GetMethodDescriptionConstant()
2850 llvm::ConstantExpr::getBitCast(GetMethodVarName(MD->getSelector()), in GetMethodDescriptionConstant()
2857 return llvm::ConstantStruct::get(ObjCTypes.MethodDescriptionTy, in GetMethodDescriptionConstant()
2861 llvm::Constant *
2863 ArrayRef<llvm::Constant*> Methods) { in EmitMethodDescList()
2866 return llvm::Constant::getNullValue(ObjCTypes.MethodDescriptionListPtrTy); in EmitMethodDescList()
2868 llvm::Constant *Values[2]; in EmitMethodDescList()
2869 Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size()); in EmitMethodDescList()
2870 llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodDescriptionTy, in EmitMethodDescList()
2872 Values[1] = llvm::ConstantArray::get(AT, Methods); in EmitMethodDescList()
2873 llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values); in EmitMethodDescList()
2875 llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true); in EmitMethodDescList()
2876 return llvm::ConstantExpr::getBitCast(GV, in EmitMethodDescList()
2903 llvm::raw_svector_ostream(ExtName) << Interface->getName() << '_' in GenerateCategory()
2906 SmallVector<llvm::Constant *, 16> InstanceMethods, ClassMethods; in GenerateCategory()
2915 llvm::Constant *Values[7]; in GenerateCategory()
2930 Values[4] = llvm::Constant::getNullValue(ObjCTypes.ProtocolListPtrTy); in GenerateCategory()
2932 Values[5] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size); in GenerateCategory()
2939 Values[6] = llvm::Constant::getNullValue(ObjCTypes.PropertyListPtrTy); in GenerateCategory()
2942 llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.CategoryTy, in GenerateCategory()
2945 llvm::GlobalVariable *GV = in GenerateCategory()
3013 llvm::Constant *Protocols = in GenerateClass()
3027 SmallVector<llvm::Constant *, 16> InstanceMethods, ClassMethods; in GenerateClass()
3041 if (llvm::Constant *C = GetMethodConstant(MD)) in GenerateClass()
3044 if (llvm::Constant *C = GetMethodConstant(MD)) in GenerateClass()
3049 llvm::Constant *Values[12]; in GenerateClass()
3056 llvm::ConstantExpr::getBitCast(GetClassName(Super->getObjCRuntimeNameAsString()), in GenerateClass()
3059 Values[ 1] = llvm::Constant::getNullValue(ObjCTypes.ClassPtrTy); in GenerateClass()
3063 Values[ 3] = llvm::ConstantInt::get(ObjCTypes.LongTy, 0); in GenerateClass()
3064 Values[ 4] = llvm::ConstantInt::get(ObjCTypes.LongTy, Flags); in GenerateClass()
3065 Values[ 5] = llvm::ConstantInt::get(ObjCTypes.LongTy, Size); in GenerateClass()
3071 Values[ 8] = llvm::Constant::getNullValue(ObjCTypes.CachePtrTy); in GenerateClass()
3075 llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ClassTy, in GenerateClass()
3081 llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name, true); in GenerateClass()
3097 llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID, in EmitMetaClass()
3098 llvm::Constant *Protocols, in EmitMetaClass()
3099 ArrayRef<llvm::Constant*> Methods) { in EmitMetaClass()
3106 llvm::Constant *Values[12]; in EmitMetaClass()
3112 llvm::ConstantExpr::getBitCast(GetClassName(Root->getObjCRuntimeNameAsString()), in EmitMetaClass()
3119 llvm::ConstantExpr::getBitCast(GetClassName(Super->getObjCRuntimeNameAsString()), in EmitMetaClass()
3122 Values[ 1] = llvm::Constant::getNullValue(ObjCTypes.ClassPtrTy); in EmitMetaClass()
3126 Values[ 3] = llvm::ConstantInt::get(ObjCTypes.LongTy, 0); in EmitMetaClass()
3127 Values[ 4] = llvm::ConstantInt::get(ObjCTypes.LongTy, Flags); in EmitMetaClass()
3128 Values[ 5] = llvm::ConstantInt::get(ObjCTypes.LongTy, Size); in EmitMetaClass()
3134 Values[ 8] = llvm::Constant::getNullValue(ObjCTypes.CachePtrTy); in EmitMetaClass()
3137 Values[10] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); in EmitMetaClass()
3139 Values[11] = llvm::Constant::getNullValue(ObjCTypes.ClassExtensionPtrTy); in EmitMetaClass()
3140 llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ClassTy, in EmitMetaClass()
3147 llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name, true); in EmitMetaClass()
3153 GV = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassTy, false, in EmitMetaClass()
3154 llvm::GlobalValue::PrivateLinkage, in EmitMetaClass()
3164 llvm::Constant *CGObjCMac::EmitMetaClassRef(const ObjCInterfaceDecl *ID) { in EmitMetaClassRef()
3175 llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name, true); in EmitMetaClassRef()
3177 GV = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassTy, false, in EmitMetaClassRef()
3178 llvm::GlobalValue::PrivateLinkage, nullptr, in EmitMetaClassRef()
3186 llvm::Value *CGObjCMac::EmitSuperClassRef(const ObjCInterfaceDecl *ID) { in EmitSuperClassRef()
3188 llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name, true); in EmitSuperClassRef()
3191 GV = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassTy, false, in EmitSuperClassRef()
3192 llvm::GlobalValue::PrivateLinkage, nullptr, in EmitSuperClassRef()
3207 llvm::Constant *
3212 llvm::Constant *Values[3]; in EmitClassExtension()
3213 Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size); in EmitClassExtension()
3220 return llvm::Constant::getNullValue(ObjCTypes.ClassExtensionPtrTy); in EmitClassExtension()
3222 llvm::Constant *Init = in EmitClassExtension()
3223 llvm::ConstantStruct::get(ObjCTypes.ClassExtensionTy, Values); in EmitClassExtension()
3240 llvm::Constant *CGObjCMac::EmitIvarList(const ObjCImplementationDecl *ID, in EmitIvarList()
3242 std::vector<llvm::Constant*> Ivars; in EmitIvarList()
3250 return llvm::Constant::getNullValue(ObjCTypes.IvarListPtrTy); in EmitIvarList()
3259 llvm::Constant *Ivar[] = { in EmitIvarList()
3262 llvm::ConstantInt::get(ObjCTypes.IntTy, in EmitIvarList()
3265 Ivars.push_back(llvm::ConstantStruct::get(ObjCTypes.IvarTy, Ivar)); in EmitIvarList()
3270 return llvm::Constant::getNullValue(ObjCTypes.IvarListPtrTy); in EmitIvarList()
3272 llvm::Constant *Values[2]; in EmitIvarList()
3273 Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size()); in EmitIvarList()
3274 llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarTy, in EmitIvarList()
3276 Values[1] = llvm::ConstantArray::get(AT, Ivars); in EmitIvarList()
3277 llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values); in EmitIvarList()
3279 llvm::GlobalVariable *GV; in EmitIvarList()
3288 return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.IvarListPtrTy); in EmitIvarList()
3308 llvm::Constant *CGObjCMac::GetMethodConstant(const ObjCMethodDecl *MD) { in GetMethodConstant()
3309 llvm::Function *Fn = GetMethodDefinition(MD); in GetMethodConstant()
3313 llvm::Constant *Method[] = { in GetMethodConstant()
3314 llvm::ConstantExpr::getBitCast(GetMethodVarName(MD->getSelector()), in GetMethodConstant()
3317 llvm::ConstantExpr::getBitCast(Fn, ObjCTypes.Int8PtrTy) in GetMethodConstant()
3319 return llvm::ConstantStruct::get(ObjCTypes.MethodTy, Method); in GetMethodConstant()
3322 llvm::Constant *CGObjCMac::EmitMethodList(Twine Name, in EmitMethodList()
3324 ArrayRef<llvm::Constant*> Methods) { in EmitMethodList()
3327 return llvm::Constant::getNullValue(ObjCTypes.MethodListPtrTy); in EmitMethodList()
3329 llvm::Constant *Values[3]; in EmitMethodList()
3330 Values[0] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); in EmitMethodList()
3331 Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size()); in EmitMethodList()
3332 llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy, in EmitMethodList()
3334 Values[2] = llvm::ConstantArray::get(AT, Methods); in EmitMethodList()
3335 llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values); in EmitMethodList()
3337 llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true); in EmitMethodList()
3338 return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.MethodListPtrTy); in EmitMethodList()
3341 llvm::Function *CGObjCCommonMac::GenerateMethod(const ObjCMethodDecl *OMD, in GenerateMethod()
3347 llvm::FunctionType *MethodTy = in GenerateMethod()
3349 llvm::Function *Method = in GenerateMethod()
3350 llvm::Function::Create(MethodTy, in GenerateMethod()
3351 llvm::GlobalValue::InternalLinkage, in GenerateMethod()
3359 llvm::GlobalVariable *CGObjCCommonMac::CreateMetadataVar(Twine Name, in CreateMetadataVar()
3360 llvm::Constant *Init, in CreateMetadataVar()
3364 llvm::Type *Ty = Init->getType(); in CreateMetadataVar()
3365 llvm::GlobalVariable *GV = in CreateMetadataVar()
3366 new llvm::GlobalVariable(CGM.getModule(), Ty, false, in CreateMetadataVar()
3367 llvm::GlobalValue::PrivateLinkage, Init, Name); in CreateMetadataVar()
3377 llvm::Function *CGObjCMac::ModuleInitFunction() { in ModuleInitFunction()
3383 llvm::Constant *CGObjCMac::GetPropertyGetFunction() { in GetPropertyGetFunction()
3387 llvm::Constant *CGObjCMac::GetPropertySetFunction() { in GetPropertySetFunction()
3391 llvm::Constant *CGObjCMac::GetOptimizedPropertySetFunction(bool atomic, in GetOptimizedPropertySetFunction()
3396 llvm::Constant *CGObjCMac::GetGetStructFunction() { in GetGetStructFunction()
3399 llvm::Constant *CGObjCMac::GetSetStructFunction() { in GetSetStructFunction()
3403 llvm::Constant *CGObjCMac::GetCppAtomicObjectGetFunction() { in GetCppAtomicObjectGetFunction()
3406 llvm::Constant *CGObjCMac::GetCppAtomicObjectSetFunction() { in GetCppAtomicObjectSetFunction()
3410 llvm::Constant *CGObjCMac::EnumerationMutationFunction() { in EnumerationMutationFunction()
3426 llvm::Value *SyncArgSlot;
3427 llvm::Value *CallTryExitVar;
3428 llvm::Value *ExceptionData;
3431 llvm::Value *SyncArgSlot, in PerformFragileFinally()
3432 llvm::Value *CallTryExitVar, in PerformFragileFinally()
3433 llvm::Value *ExceptionData, in PerformFragileFinally()
3441 llvm::BasicBlock *FinallyCallExit = in Emit()
3443 llvm::BasicBlock *FinallyNoCallExit = in Emit()
3462 llvm::Value *CurCleanupDest = in Emit()
3478 llvm::Value *SyncArg = CGF.Builder.CreateLoad(SyncArgSlot); in Emit()
3486 SmallVector<llvm::Value*, 20> Locals;
3487 llvm::DenseSet<llvm::BasicBlock*> BlocksBeforeTry;
3489 llvm::InlineAsm *ReadHazard;
3490 llvm::InlineAsm *WriteHazard;
3492 llvm::FunctionType *GetAsmFnType();
3516 for (llvm::Function::iterator in FragileHazards()
3520 llvm::FunctionType *AsmFnTy = GetAsmFnType(); in FragileHazards()
3534 ReadHazard = llvm::InlineAsm::get(AsmFnTy, "", Constraint, true, false); in FragileHazards()
3548 WriteHazard = llvm::InlineAsm::get(AsmFnTy, "", Constraint, true, false); in FragileHazards()
3561 llvm::CallInst *call = Builder.CreateCall(ReadHazard, Locals); in emitReadHazard()
3574 for (llvm::Function::iterator in emitHazardsInNewBlocks()
3576 llvm::BasicBlock &BB = *FI; in emitHazardsInNewBlocks()
3580 for (llvm::BasicBlock::iterator in emitHazardsInNewBlocks()
3582 llvm::Instruction &I = *BI; in emitHazardsInNewBlocks()
3586 if (!isa<llvm::CallInst>(I) && !isa<llvm::InvokeInst>(I)) continue; in emitHazardsInNewBlocks()
3587 if (isa<llvm::IntrinsicInst>(I)) in emitHazardsInNewBlocks()
3592 llvm::CallSite CS(&I); in emitHazardsInNewBlocks()
3606 static void addIfPresent(llvm::DenseSet<llvm::Value*> &S, llvm::Value *V) { in addIfPresent()
3612 llvm::DenseSet<llvm::Value*> AllocasToIgnore; in collectLocals()
3618 llvm::BasicBlock &Entry = CGF.CurFn->getEntryBlock(); in collectLocals()
3619 for (llvm::BasicBlock::iterator in collectLocals()
3621 if (isa<llvm::AllocaInst>(*I) && !AllocasToIgnore.count(&*I)) in collectLocals()
3625 llvm::FunctionType *FragileHazards::GetAsmFnType() { in GetAsmFnType()
3626 SmallVector<llvm::Type *, 16> tys(Locals.size()); in GetAsmFnType()
3629 return llvm::FunctionType::get(CGF.VoidTy, tys, false); in GetAsmFnType()
3763 llvm::Value *SyncArgSlot = nullptr; in EmitTryOrSynchronizedStmt()
3765 llvm::Value *SyncArg = in EmitTryOrSynchronizedStmt()
3776 llvm::Value *ExceptionData = CGF.CreateTempAlloca(ObjCTypes.ExceptionDataTy, in EmitTryOrSynchronizedStmt()
3793 llvm::Value *CallTryExitVar = CGF.CreateTempAlloca(CGF.Builder.getInt1Ty(), in EmitTryOrSynchronizedStmt()
3798 llvm::Value *PropagatingExnVar = nullptr; in EmitTryOrSynchronizedStmt()
3814 llvm::Constant *Zero = llvm::ConstantInt::get(CGF.Builder.getInt32Ty(), 0); in EmitTryOrSynchronizedStmt()
3815 llvm::Value *GEPIndexes[] = { Zero, Zero, Zero }; in EmitTryOrSynchronizedStmt()
3816 llvm::Value *SetJmpBuffer = CGF.Builder.CreateGEP( in EmitTryOrSynchronizedStmt()
3818 llvm::CallInst *SetJmpResult = CGF.EmitNounwindRuntimeCall( in EmitTryOrSynchronizedStmt()
3824 llvm::BasicBlock *TryBlock = CGF.createBasicBlock("try"); in EmitTryOrSynchronizedStmt()
3825 llvm::BasicBlock *TryHandler = CGF.createBasicBlock("try.handler"); in EmitTryOrSynchronizedStmt()
3826 llvm::Value *DidCatch = in EmitTryOrSynchronizedStmt()
3855 llvm::CallInst *Caught = in EmitTryOrSynchronizedStmt()
3867 llvm::BasicBlock *CatchBlock = nullptr; in EmitTryOrSynchronizedStmt()
3868 llvm::BasicBlock *CatchHandler = nullptr; in EmitTryOrSynchronizedStmt()
3881 llvm::CallInst *SetJmpResult = in EmitTryOrSynchronizedStmt()
3886 llvm::Value *Threw = in EmitTryOrSynchronizedStmt()
3951 llvm::Value *Class = EmitClassRef(CGF, IDecl); in EmitTryOrSynchronizedStmt()
3953 llvm::Value *matchArgs[] = { Class, Caught }; in EmitTryOrSynchronizedStmt()
3954 llvm::CallInst *Match = in EmitTryOrSynchronizedStmt()
3958 llvm::BasicBlock *MatchedBlock = CGF.createBasicBlock("match"); in EmitTryOrSynchronizedStmt()
3959 llvm::BasicBlock *NextCatchBlock = CGF.createBasicBlock("catch.next"); in EmitTryOrSynchronizedStmt()
3975 llvm::Value *Tmp = in EmitTryOrSynchronizedStmt()
4012 llvm::CallInst *NewCaught = in EmitTryOrSynchronizedStmt()
4038 llvm::Value *PropagatingExn; in EmitTryOrSynchronizedStmt()
4044 llvm::CallInst *Caught = in EmitTryOrSynchronizedStmt()
4061 llvm::Value *ExceptionAsObject; in EmitThrowStmt()
4064 llvm::Value *Exception = CGF.EmitObjCThrowOperand(ThrowExpr); in EmitThrowStmt()
4085 llvm::Value * CGObjCMac::EmitObjCWeakRead(CodeGen::CodeGenFunction &CGF, in EmitObjCWeakRead()
4086 llvm::Value *AddrWeakObj) { in EmitObjCWeakRead()
4087 llvm::Type* DestTy = in EmitObjCWeakRead()
4088 cast<llvm::PointerType>(AddrWeakObj->getType())->getElementType(); in EmitObjCWeakRead()
4091 llvm::Value *read_weak = in EmitObjCWeakRead()
4102 llvm::Value *src, llvm::Value *dst) { in EmitObjCWeakAssign()
4103 llvm::Type * SrcTy = src->getType(); in EmitObjCWeakAssign()
4104 if (!isa<llvm::PointerType>(SrcTy)) { in EmitObjCWeakAssign()
4113 llvm::Value *args[] = { src, dst }; in EmitObjCWeakAssign()
4123 llvm::Value *src, llvm::Value *dst, in EmitObjCGlobalAssign()
4125 llvm::Type * SrcTy = src->getType(); in EmitObjCGlobalAssign()
4126 if (!isa<llvm::PointerType>(SrcTy)) { in EmitObjCGlobalAssign()
4135 llvm::Value *args[] = { src, dst }; in EmitObjCGlobalAssign()
4149 llvm::Value *src, llvm::Value *dst, in EmitObjCIvarAssign()
4150 llvm::Value *ivarOffset) { in EmitObjCIvarAssign()
4152 llvm::Type * SrcTy = src->getType(); in EmitObjCIvarAssign()
4153 if (!isa<llvm::PointerType>(SrcTy)) { in EmitObjCIvarAssign()
4162 llvm::Value *args[] = { src, dst, ivarOffset }; in EmitObjCIvarAssign()
4171 llvm::Value *src, llvm::Value *dst) { in EmitObjCStrongCastAssign()
4172 llvm::Type * SrcTy = src->getType(); in EmitObjCStrongCastAssign()
4173 if (!isa<llvm::PointerType>(SrcTy)) { in EmitObjCStrongCastAssign()
4182 llvm::Value *args[] = { src, dst }; in EmitObjCStrongCastAssign()
4189 llvm::Value *DestPtr, in EmitGCMemmoveCollectable()
4190 llvm::Value *SrcPtr, in EmitGCMemmoveCollectable()
4191 llvm::Value *size) { in EmitGCMemmoveCollectable()
4194 llvm::Value *args[] = { DestPtr, SrcPtr, size }; in EmitGCMemmoveCollectable()
4202 llvm::Value *BaseValue, in EmitObjCValueForIvar()
4211 llvm::Value *CGObjCMac::EmitIvarOffset(CodeGen::CodeGenFunction &CGF, in EmitIvarOffset()
4215 return llvm::ConstantInt::get( in EmitIvarOffset()
4250 llvm::Module &Mod = CGM.getModule(); in EmitImageInfo()
4253 Mod.addModuleFlag(llvm::Module::Error, "Objective-C Version", ObjCABI); in EmitImageInfo()
4254 Mod.addModuleFlag(llvm::Module::Error, "Objective-C Image Info Version", in EmitImageInfo()
4256 Mod.addModuleFlag(llvm::Module::Error, "Objective-C Image Info Section", in EmitImageInfo()
4257 llvm::MDString::get(VMContext,Section)); in EmitImageInfo()
4261 Mod.addModuleFlag(llvm::Module::Override, in EmitImageInfo()
4265 Mod.addModuleFlag(llvm::Module::Error, in EmitImageInfo()
4271 Mod.addModuleFlag(llvm::Module::Error, "Objective-C GC Only", in EmitImageInfo()
4275 llvm::Metadata *Ops[2] = { in EmitImageInfo()
4276 llvm::MDString::get(VMContext, "Objective-C Garbage Collection"), in EmitImageInfo()
4277 llvm::ConstantAsMetadata::get(llvm::ConstantInt::get( in EmitImageInfo()
4278 llvm::Type::getInt32Ty(VMContext), eImageInfo_GarbageCollected))}; in EmitImageInfo()
4279 Mod.addModuleFlag(llvm::Module::Require, "Objective-C GC Only", in EmitImageInfo()
4280 llvm::MDNode::get(VMContext, Ops)); in EmitImageInfo()
4285 const llvm::Triple &Triple = CGM.getTarget().getTriple(); in EmitImageInfo()
4287 (Triple.getArch() == llvm::Triple::x86 || in EmitImageInfo()
4288 Triple.getArch() == llvm::Triple::x86_64)) in EmitImageInfo()
4289 Mod.addModuleFlag(llvm::Module::Error, "Objective-C Is Simulated", in EmitImageInfo()
4306 llvm::Constant *Values[] = { in EmitModuleInfo()
4307 llvm::ConstantInt::get(ObjCTypes.LongTy, ModuleVersion), in EmitModuleInfo()
4308 llvm::ConstantInt::get(ObjCTypes.LongTy, Size), in EmitModuleInfo()
4314 llvm::ConstantStruct::get(ObjCTypes.ModuleTy, Values), in EmitModuleInfo()
4318 llvm::Constant *CGObjCMac::EmitModuleSymbols() { in EmitModuleSymbols()
4324 return llvm::Constant::getNullValue(ObjCTypes.SymtabPtrTy); in EmitModuleSymbols()
4326 llvm::Constant *Values[5]; in EmitModuleSymbols()
4327 Values[0] = llvm::ConstantInt::get(ObjCTypes.LongTy, 0); in EmitModuleSymbols()
4328 Values[1] = llvm::Constant::getNullValue(ObjCTypes.SelectorPtrTy); in EmitModuleSymbols()
4329 Values[2] = llvm::ConstantInt::get(ObjCTypes.ShortTy, NumClasses); in EmitModuleSymbols()
4330 Values[3] = llvm::ConstantInt::get(ObjCTypes.ShortTy, NumCategories); in EmitModuleSymbols()
4334 SmallVector<llvm::Constant*, 8> Symbols(NumClasses + NumCategories); in EmitModuleSymbols()
4341 DefinedClasses[i]->setLinkage(llvm::GlobalVariable::ExternalLinkage); in EmitModuleSymbols()
4343 Symbols[i] = llvm::ConstantExpr::getBitCast(DefinedClasses[i], in EmitModuleSymbols()
4348 llvm::ConstantExpr::getBitCast(DefinedCategories[i], in EmitModuleSymbols()
4352 llvm::ConstantArray::get(llvm::ArrayType::get(ObjCTypes.Int8PtrTy, in EmitModuleSymbols()
4356 llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values); in EmitModuleSymbols()
4358 llvm::GlobalVariable *GV = CreateMetadataVar( in EmitModuleSymbols()
4360 return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.SymtabPtrTy); in EmitModuleSymbols()
4363 llvm::Value *CGObjCMac::EmitClassRefFromId(CodeGenFunction &CGF, in EmitClassRefFromId()
4367 llvm::GlobalVariable *&Entry = ClassReferences[II]; in EmitClassRefFromId()
4370 llvm::Constant *Casted = in EmitClassRefFromId()
4371 llvm::ConstantExpr::getBitCast(GetClassName(II->getName()), in EmitClassRefFromId()
4381 llvm::Value *CGObjCMac::EmitClassRef(CodeGenFunction &CGF, in EmitClassRef()
4386 llvm::Value *CGObjCMac::EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) { in EmitNSAutoreleasePoolClassRef()
4391 llvm::Value *CGObjCMac::EmitSelector(CodeGenFunction &CGF, Selector Sel, in EmitSelector()
4393 llvm::GlobalVariable *&Entry = SelectorReferences[Sel]; in EmitSelector()
4396 llvm::Constant *Casted = in EmitSelector()
4397 llvm::ConstantExpr::getBitCast(GetMethodVarName(Sel), in EmitSelector()
4410 llvm::Constant *CGObjCCommonMac::GetClassName(StringRef RuntimeName) { in GetClassName()
4411 llvm::GlobalVariable *&Entry = ClassNames[RuntimeName]; in GetClassName()
4415 llvm::ConstantDataArray::getString(VMContext, RuntimeName), in GetClassName()
4422 llvm::Function *CGObjCCommonMac::GetMethodDefinition(const ObjCMethodDecl *MD) { in GetMethodDefinition()
4423 llvm::DenseMap<const ObjCMethodDecl*, llvm::Function*>::iterator in GetMethodDefinition()
4433 llvm::Constant *CGObjCCommonMac::GetIvarLayoutName(IdentifierInfo *Ident, in GetIvarLayoutName()
4435 return llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); in GetIvarLayoutName()
4445 llvm::Type *Ty = CGM.getTypes().ConvertType(QualType(RT, 0)); in BuildAggrIvarRecordLayout()
4446 const llvm::StructLayout *RecLayout = in BuildAggrIvarRecordLayout()
4447 CGM.getDataLayout().getStructLayout(cast<llvm::StructType>(Ty)); in BuildAggrIvarRecordLayout()
4454 const llvm::StructLayout *Layout, in BuildAggrIvarLayout()
4618 llvm::Constant *CGObjCCommonMac::BuildIvarLayoutBitmap(std::string &BitMap) { in BuildIvarLayoutBitmap()
4620 llvm::Type *PtrTy = CGM.Int8PtrTy; in BuildIvarLayoutBitmap()
4733 llvm::GlobalVariable *Entry = CreateMetadataVar( in BuildIvarLayoutBitmap()
4735 llvm::ConstantDataArray::getString(VMContext, BitMap, false), in BuildIvarLayoutBitmap()
4758 llvm::Constant *CGObjCCommonMac::BuildIvarLayout( in BuildIvarLayout()
4763 llvm::Type *PtrTy = CGM.Int8PtrTy; in BuildIvarLayout()
4766 return llvm::Constant::getNullValue(PtrTy); in BuildIvarLayout()
4784 return llvm::Constant::getNullValue(PtrTy); in BuildIvarLayout()
4792 return llvm::Constant::getNullValue(PtrTy); in BuildIvarLayout()
4801 llvm::Constant *C = BuildIvarLayoutBitmap(BitMap); in BuildIvarLayout()
4818 llvm::Constant *CGObjCCommonMac::GetMethodVarName(Selector Sel) { in GetMethodVarName()
4819 llvm::GlobalVariable *&Entry = MethodVarNames[Sel]; in GetMethodVarName()
4825 llvm::ConstantDataArray::getString(VMContext, Sel.getAsString()), in GetMethodVarName()
4834 llvm::Constant *CGObjCCommonMac::GetMethodVarName(IdentifierInfo *ID) { in GetMethodVarName()
4838 llvm::Constant *CGObjCCommonMac::GetMethodVarType(const FieldDecl *Field) { in GetMethodVarType()
4842 llvm::GlobalVariable *&Entry = MethodVarTypes[TypeStr]; in GetMethodVarType()
4847 llvm::ConstantDataArray::getString(VMContext, TypeStr), in GetMethodVarType()
4855 llvm::Constant *CGObjCCommonMac::GetMethodVarType(const ObjCMethodDecl *D, in GetMethodVarType()
4861 llvm::GlobalVariable *&Entry = MethodVarTypes[TypeStr]; in GetMethodVarType()
4866 llvm::ConstantDataArray::getString(VMContext, TypeStr), in GetMethodVarType()
4875 llvm::Constant *CGObjCCommonMac::GetPropertyName(IdentifierInfo *Ident) { in GetPropertyName()
4876 llvm::GlobalVariable *&Entry = PropertyNames[Ident]; in GetPropertyName()
4881 llvm::ConstantDataArray::getString(VMContext, Ident->getName()), in GetPropertyName()
4889 llvm::Constant *
4900 llvm::raw_svector_ostream OS(Name); in GetNameForMethod()
4915 for (llvm::DenseMap<IdentifierInfo*, llvm::GlobalVariable*>::iterator in FinishModule()
4920 llvm::Constant *Values[5]; in FinishModule()
4921 Values[0] = llvm::Constant::getNullValue(ObjCTypes.ProtocolExtensionPtrTy); in FinishModule()
4923 Values[2] = llvm::Constant::getNullValue(ObjCTypes.ProtocolListPtrTy); in FinishModule()
4925 llvm::Constant::getNullValue(ObjCTypes.MethodDescriptionListPtrTy); in FinishModule()
4926 I->second->setInitializer(llvm::ConstantStruct::get(ObjCTypes.ProtocolTy, in FinishModule()
4942 llvm::raw_svector_ostream OS(Asm); in FinishModule()
4943 for (llvm::SetVector<IdentifierInfo*>::iterator I = DefinedSymbols.begin(), in FinishModule()
4947 for (llvm::SetVector<IdentifierInfo*>::iterator I = LazySymbols.begin(), in FinishModule()
4985 if (CGM.getTarget().getTriple().getArch() == llvm::Triple::aarch64) in ObjCCommonTypesHelper()
4991 PtrObjectPtrTy = llvm::PointerType::getUnqual(ObjectPtrTy); in ObjCCommonTypesHelper()
5021 SuperTy = cast<llvm::StructType>(Types.ConvertType(SuperCTy)); in ObjCCommonTypesHelper()
5022 SuperPtrTy = llvm::PointerType::getUnqual(SuperTy); in ObjCCommonTypesHelper()
5028 PropertyTy = llvm::StructType::create("struct._prop_t", in ObjCCommonTypesHelper()
5037 llvm::StructType::create("struct._prop_list_t", IntTy, IntTy, in ObjCCommonTypesHelper()
5038 llvm::ArrayType::get(PropertyTy, 0), nullptr); in ObjCCommonTypesHelper()
5040 PropertyListPtrTy = llvm::PointerType::getUnqual(PropertyListTy); in ObjCCommonTypesHelper()
5047 MethodTy = llvm::StructType::create("struct._objc_method", in ObjCCommonTypesHelper()
5052 CacheTy = llvm::StructType::create(VMContext, "struct._objc_cache"); in ObjCCommonTypesHelper()
5053 CachePtrTy = llvm::PointerType::getUnqual(CacheTy); in ObjCCommonTypesHelper()
5064 llvm::StructType::create("struct._objc_method_description", in ObjCTypesHelper()
5071 MethodDescriptionListTy = llvm::StructType::create( in ObjCTypesHelper()
5073 llvm::ArrayType::get(MethodDescriptionTy, 0), nullptr); in ObjCTypesHelper()
5077 llvm::PointerType::getUnqual(MethodDescriptionListTy); in ObjCTypesHelper()
5089 llvm::StructType::create("struct._objc_protocol_extension", in ObjCTypesHelper()
5095 ProtocolExtensionPtrTy = llvm::PointerType::getUnqual(ProtocolExtensionTy); in ObjCTypesHelper()
5100 llvm::StructType::create(VMContext, "struct._objc_protocol"); in ObjCTypesHelper()
5103 llvm::StructType::create(VMContext, "struct._objc_protocol_list"); in ObjCTypesHelper()
5104 ProtocolListTy->setBody(llvm::PointerType::getUnqual(ProtocolListTy), in ObjCTypesHelper()
5106 llvm::ArrayType::get(ProtocolTy, 0), in ObjCTypesHelper()
5117 llvm::PointerType::getUnqual(ProtocolListTy), in ObjCTypesHelper()
5123 ProtocolListPtrTy = llvm::PointerType::getUnqual(ProtocolListTy); in ObjCTypesHelper()
5125 ProtocolPtrTy = llvm::PointerType::getUnqual(ProtocolTy); in ObjCTypesHelper()
5134 IvarTy = llvm::StructType::create("struct._objc_ivar", in ObjCTypesHelper()
5139 llvm::StructType::create(VMContext, "struct._objc_ivar_list"); in ObjCTypesHelper()
5140 IvarListPtrTy = llvm::PointerType::getUnqual(IvarListTy); in ObjCTypesHelper()
5144 llvm::StructType::create(VMContext, "struct._objc_method_list"); in ObjCTypesHelper()
5145 MethodListPtrTy = llvm::PointerType::getUnqual(MethodListTy); in ObjCTypesHelper()
5149 llvm::StructType::create("struct._objc_class_extension", in ObjCTypesHelper()
5151 ClassExtensionPtrTy = llvm::PointerType::getUnqual(ClassExtensionTy); in ObjCTypesHelper()
5153 ClassTy = llvm::StructType::create(VMContext, "struct._objc_class"); in ObjCTypesHelper()
5169 ClassTy->setBody(llvm::PointerType::getUnqual(ClassTy), in ObjCTypesHelper()
5170 llvm::PointerType::getUnqual(ClassTy), in ObjCTypesHelper()
5183 ClassPtrTy = llvm::PointerType::getUnqual(ClassTy); in ObjCTypesHelper()
5194 llvm::StructType::create("struct._objc_category", in ObjCTypesHelper()
5209 llvm::StructType::create("struct._objc_symtab", in ObjCTypesHelper()
5211 llvm::ArrayType::get(Int8PtrTy, 0), nullptr); in ObjCTypesHelper()
5212 SymtabPtrTy = llvm::PointerType::getUnqual(SymtabTy); in ObjCTypesHelper()
5221 llvm::StructType::create("struct._objc_module", in ObjCTypesHelper()
5230 llvm::Type *StackPtrTy = llvm::ArrayType::get(CGM.Int8PtrTy, 4); in ObjCTypesHelper()
5233 llvm::StructType::create("struct._objc_exception_data", in ObjCTypesHelper()
5234 llvm::ArrayType::get(CGM.Int32Ty,SetJmpBufferSize), in ObjCTypesHelper()
5247 llvm::StructType::create("struct.__method_list_t", IntTy, IntTy, in ObjCNonFragileABITypesHelper()
5248 llvm::ArrayType::get(MethodTy, 0), nullptr); in ObjCNonFragileABITypesHelper()
5250 MethodListnfABIPtrTy = llvm::PointerType::getUnqual(MethodListnfABITy); in ObjCNonFragileABITypesHelper()
5269 llvm::StructType::create(VMContext, "struct._objc_protocol_list"); in ObjCNonFragileABITypesHelper()
5272 llvm::StructType::create("struct._protocol_t", ObjectPtrTy, Int8PtrTy, in ObjCNonFragileABITypesHelper()
5273 llvm::PointerType::getUnqual(ProtocolListnfABITy), in ObjCNonFragileABITypesHelper()
5281 ProtocolnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolnfABITy); in ObjCNonFragileABITypesHelper()
5288 llvm::ArrayType::get(ProtocolnfABIPtrTy, 0), in ObjCNonFragileABITypesHelper()
5292 ProtocolListnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolListnfABITy); in ObjCNonFragileABITypesHelper()
5301 IvarnfABITy = llvm::StructType::create( in ObjCNonFragileABITypesHelper()
5302 "struct._ivar_t", llvm::PointerType::getUnqual(IvarOffsetVarTy), in ObjCNonFragileABITypesHelper()
5311 llvm::StructType::create("struct._ivar_list_t", IntTy, IntTy, in ObjCNonFragileABITypesHelper()
5312 llvm::ArrayType::get(IvarnfABITy, 0), nullptr); in ObjCNonFragileABITypesHelper()
5314 IvarListnfABIPtrTy = llvm::PointerType::getUnqual(IvarListnfABITy); in ObjCNonFragileABITypesHelper()
5331 ClassRonfABITy = llvm::StructType::create("struct._class_ro_t", in ObjCNonFragileABITypesHelper()
5340 llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy }; in ObjCNonFragileABITypesHelper()
5341 ImpnfABITy = llvm::FunctionType::get(ObjectPtrTy, params, false) in ObjCNonFragileABITypesHelper()
5352 ClassnfABITy = llvm::StructType::create(VMContext, "struct._class_t"); in ObjCNonFragileABITypesHelper()
5353 ClassnfABITy->setBody(llvm::PointerType::getUnqual(ClassnfABITy), in ObjCNonFragileABITypesHelper()
5354 llvm::PointerType::getUnqual(ClassnfABITy), in ObjCNonFragileABITypesHelper()
5356 llvm::PointerType::getUnqual(ImpnfABITy), in ObjCNonFragileABITypesHelper()
5357 llvm::PointerType::getUnqual(ClassRonfABITy), in ObjCNonFragileABITypesHelper()
5361 ClassnfABIPtrTy = llvm::PointerType::getUnqual(ClassnfABITy); in ObjCNonFragileABITypesHelper()
5371 CategorynfABITy = llvm::StructType::create("struct._category_t", in ObjCNonFragileABITypesHelper()
5404 MessageRefTy = cast<llvm::StructType>(Types.ConvertType(MessageRefCTy)); in ObjCNonFragileABITypesHelper()
5407 MessageRefPtrTy = llvm::PointerType::getUnqual(MessageRefTy); in ObjCNonFragileABITypesHelper()
5415 llvm::StructType::create("struct._super_message_ref_t", in ObjCNonFragileABITypesHelper()
5419 SuperMessageRefPtrTy = llvm::PointerType::getUnqual(SuperMessageRefTy); in ObjCNonFragileABITypesHelper()
5428 llvm::StructType::create("struct._objc_typeinfo", in ObjCNonFragileABITypesHelper()
5429 llvm::PointerType::getUnqual(Int8PtrTy), in ObjCNonFragileABITypesHelper()
5431 EHTypePtrTy = llvm::PointerType::getUnqual(EHTypeTy); in ObjCNonFragileABITypesHelper()
5434 llvm::Function *CGObjCNonFragileABIMac::ModuleInitFunction() { in ModuleInitFunction()
5441 AddModuleClassList(ArrayRef<llvm::GlobalValue*> Container, in AddModuleClassList()
5449 SmallVector<llvm::Constant*, 8> Symbols(NumClasses); in AddModuleClassList()
5451 Symbols[i] = llvm::ConstantExpr::getBitCast(Container[i], in AddModuleClassList()
5453 llvm::Constant *Init = in AddModuleClassList()
5454 llvm::ConstantArray::get(llvm::ArrayType::get(ObjCTypes.Int8PtrTy, in AddModuleClassList()
5458 llvm::GlobalVariable *GV = in AddModuleClassList()
5459 new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false, in AddModuleClassList()
5460 llvm::GlobalValue::PrivateLinkage, in AddModuleClassList()
5480 DefinedClasses[i]->setLinkage(llvm::GlobalVariable::ExternalLinkage); in FinishNonFragileABIModule()
5481 DefinedMetaClasses[i]->setLinkage(llvm::GlobalVariable::ExternalLinkage); in FinishNonFragileABIModule()
5578 llvm::GlobalVariable * CGObjCNonFragileABIMac::BuildClassRoTInitializer( in BuildClassRoTInitializer()
5584 llvm::Constant *Values[10]; // 11 for 64bit targets! in BuildClassRoTInitializer()
5589 Values[ 0] = llvm::ConstantInt::get(ObjCTypes.IntTy, flags); in BuildClassRoTInitializer()
5590 Values[ 1] = llvm::ConstantInt::get(ObjCTypes.IntTy, InstanceStart); in BuildClassRoTInitializer()
5591 Values[ 2] = llvm::ConstantInt::get(ObjCTypes.IntTy, InstanceSize); in BuildClassRoTInitializer()
5598 std::vector<llvm::Constant*> Methods; in BuildClassRoTInitializer()
5618 if (llvm::Constant *C = GetMethodConstant(MD)) in BuildClassRoTInitializer()
5621 if (llvm::Constant *C = GetMethodConstant(MD)) in BuildClassRoTInitializer()
5637 Values[ 7] = llvm::Constant::getNullValue(ObjCTypes.IvarListnfABIPtrTy); in BuildClassRoTInitializer()
5639 Values[ 9] = llvm::Constant::getNullValue(ObjCTypes.PropertyListPtrTy); in BuildClassRoTInitializer()
5646 llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ClassRonfABITy, in BuildClassRoTInitializer()
5648 llvm::GlobalVariable *CLASS_RO_GV = in BuildClassRoTInitializer()
5649 new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassRonfABITy, false, in BuildClassRoTInitializer()
5650 llvm::GlobalValue::PrivateLinkage, in BuildClassRoTInitializer()
5672 llvm::GlobalVariable *CGObjCNonFragileABIMac::BuildClassMetaData( in BuildClassMetaData()
5673 const std::string &ClassName, llvm::Constant *IsAGV, llvm::Constant *SuperClassGV, in BuildClassMetaData()
5674 llvm::Constant *ClassRoGV, bool HiddenVisibility, bool Weak) { in BuildClassMetaData()
5675 llvm::Constant *Values[] = { in BuildClassMetaData()
5683 Values[1] = llvm::Constant::getNullValue(ObjCTypes.ClassnfABIPtrTy); in BuildClassMetaData()
5685 Values[3] = llvm::Constant::getNullValue( in BuildClassMetaData()
5686 llvm::PointerType::getUnqual(ObjCTypes.ImpnfABITy)); in BuildClassMetaData()
5687 llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ClassnfABITy, in BuildClassMetaData()
5689 llvm::GlobalVariable *GV = GetClassGlobal(ClassName, Weak); in BuildClassMetaData()
5695 GV->setVisibility(llvm::GlobalValue::HiddenVisibility); in BuildClassMetaData()
5723 ObjCEmptyCacheVar = new llvm::GlobalVariable( in GenerateClass()
5727 llvm::GlobalValue::ExternalLinkage, in GenerateClass()
5733 const llvm::Triple &Triple = CGM.getTarget().getTriple(); in GenerateClass()
5738 ObjCEmptyVtableVar = new llvm::GlobalVariable( in GenerateClass()
5742 llvm::GlobalValue::ExternalLinkage, in GenerateClass()
5753 llvm::SmallString<64> ObjCMetaClassName(getMetaclassSymbolPrefix()); in GenerateClass()
5754 llvm::SmallString<64> ObjCClassName(getClassSymbolPrefix()); in GenerateClass()
5755 llvm::SmallString<64> TClassName; in GenerateClass()
5757 llvm::GlobalVariable *SuperClassGV, *IsAGV; in GenerateClass()
5801 llvm::GlobalVariable *CLASS_RO_GV = BuildClassRoTInitializer(flags, in GenerateClass()
5806 llvm::GlobalVariable *MetaTClass = BuildClassMetaData( in GenerateClass()
5851 llvm::GlobalVariable *ClassMD = in GenerateClass()
5877 llvm::Value *CGObjCNonFragileABIMac::GenerateProtocolRef(CodeGenFunction &CGF, in GenerateProtocolRef()
5883 llvm::Constant *Init = in GenerateProtocolRef()
5884 llvm::ConstantExpr::getBitCast(GetOrEmitProtocol(PD), in GenerateProtocolRef()
5890 llvm::GlobalVariable *PTGV = CGM.getModule().getGlobalVariable(ProtocolName); in GenerateProtocolRef()
5893 PTGV = new llvm::GlobalVariable( in GenerateProtocolRef()
5896 llvm::GlobalValue::WeakAnyLinkage, in GenerateProtocolRef()
5900 PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility); in GenerateProtocolRef()
5919 llvm::SmallString<64> ExtCatName(Prefix); in GenerateCategory()
5924 llvm::SmallString<64> ExtClassName(getClassSymbolPrefix()); in GenerateCategory()
5927 llvm::Constant *Values[6]; in GenerateCategory()
5930 llvm::GlobalVariable *ClassGV = in GenerateCategory()
5934 std::vector<llvm::Constant*> Methods; in GenerateCategory()
5935 llvm::SmallString<64> MethodListName(Prefix); in GenerateCategory()
5968 llvm::raw_svector_ostream(ExtName) << Interface->getObjCRuntimeNameAsString() << "_$_" in GenerateCategory()
5978 Values[4] = llvm::Constant::getNullValue(ObjCTypes.ProtocolListnfABIPtrTy); in GenerateCategory()
5979 Values[5] = llvm::Constant::getNullValue(ObjCTypes.PropertyListPtrTy); in GenerateCategory()
5982 llvm::Constant *Init = in GenerateCategory()
5983 llvm::ConstantStruct::get(ObjCTypes.CategorynfABITy, in GenerateCategory()
5985 llvm::GlobalVariable *GCATV in GenerateCategory()
5986 = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.CategorynfABITy, in GenerateCategory()
5988 llvm::GlobalValue::PrivateLinkage, in GenerateCategory()
6007 llvm::Constant *CGObjCNonFragileABIMac::GetMethodConstant( in GetMethodConstant()
6009 llvm::Function *Fn = GetMethodDefinition(MD); in GetMethodConstant()
6013 llvm::Constant *Method[] = { in GetMethodConstant()
6014 llvm::ConstantExpr::getBitCast(GetMethodVarName(MD->getSelector()), in GetMethodConstant()
6017 llvm::ConstantExpr::getBitCast(Fn, ObjCTypes.Int8PtrTy) in GetMethodConstant()
6019 return llvm::ConstantStruct::get(ObjCTypes.MethodTy, Method); in GetMethodConstant()
6029 llvm::Constant *
6032 ArrayRef<llvm::Constant*> Methods) { in EmitMethodList()
6035 return llvm::Constant::getNullValue(ObjCTypes.MethodListnfABIPtrTy); in EmitMethodList()
6037 llvm::Constant *Values[3]; in EmitMethodList()
6040 Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size); in EmitMethodList()
6042 Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size()); in EmitMethodList()
6043 llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy, in EmitMethodList()
6045 Values[2] = llvm::ConstantArray::get(AT, Methods); in EmitMethodList()
6046 llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values); in EmitMethodList()
6048 llvm::GlobalVariable *GV = in EmitMethodList()
6049 new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false, in EmitMethodList()
6050 llvm::GlobalValue::PrivateLinkage, Init, Name); in EmitMethodList()
6054 return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.MethodListnfABIPtrTy); in EmitMethodList()
6059 llvm::GlobalVariable *
6064 llvm::SmallString<64> Name("OBJC_IVAR_$_"); in ObjCIvarOffsetVariable()
6068 llvm::GlobalVariable *IvarOffsetGV = in ObjCIvarOffsetVariable()
6071 IvarOffsetGV = new llvm::GlobalVariable( in ObjCIvarOffsetVariable()
6073 llvm::GlobalValue::ExternalLinkage, nullptr, Name.str()); in ObjCIvarOffsetVariable()
6077 llvm::Constant *
6081 llvm::GlobalVariable *IvarOffsetGV = ObjCIvarOffsetVariable(ID, Ivar); in EmitIvarOffsetVar()
6083 llvm::ConstantInt::get(ObjCTypes.IvarOffsetVarTy, Offset)); in EmitIvarOffsetVar()
6092 IvarOffsetGV->setVisibility(llvm::GlobalValue::HiddenVisibility); in EmitIvarOffsetVar()
6094 IvarOffsetGV->setVisibility(llvm::GlobalValue::DefaultVisibility); in EmitIvarOffsetVar()
6116 llvm::Constant *CGObjCNonFragileABIMac::EmitIvarList( in EmitIvarList()
6119 std::vector<llvm::Constant*> Ivars; in EmitIvarList()
6131 llvm::Constant *Ivar[5]; in EmitIvarList()
6136 llvm::Type *FieldTy = in EmitIvarList()
6141 Align = llvm::Log2_32(Align); in EmitIvarList()
6142 Ivar[3] = llvm::ConstantInt::get(ObjCTypes.IntTy, Align); in EmitIvarList()
6148 Ivar[4] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size); in EmitIvarList()
6149 Ivars.push_back(llvm::ConstantStruct::get(ObjCTypes.IvarnfABITy, Ivar)); in EmitIvarList()
6153 return llvm::Constant::getNullValue(ObjCTypes.IvarListnfABIPtrTy); in EmitIvarList()
6155 llvm::Constant *Values[3]; in EmitIvarList()
6157 Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size); in EmitIvarList()
6158 Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size()); in EmitIvarList()
6159 llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarnfABITy, in EmitIvarList()
6161 Values[2] = llvm::ConstantArray::get(AT, Ivars); in EmitIvarList()
6162 llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values); in EmitIvarList()
6164 llvm::GlobalVariable *GV = in EmitIvarList()
6165 new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false, in EmitIvarList()
6166 llvm::GlobalValue::PrivateLinkage, in EmitIvarList()
6174 return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.IvarListnfABIPtrTy); in EmitIvarList()
6177 llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocolRef( in GetOrEmitProtocolRef()
6179 llvm::GlobalVariable *&Entry = Protocols[PD->getIdentifier()]; in GetOrEmitProtocolRef()
6186 new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABITy, in GetOrEmitProtocolRef()
6187 false, llvm::GlobalValue::ExternalLinkage, in GetOrEmitProtocolRef()
6215 llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( in GetOrEmitProtocol()
6217 llvm::GlobalVariable *Entry = Protocols[PD->getIdentifier()]; in GetOrEmitProtocol()
6228 std::vector<llvm::Constant*> InstanceMethods, ClassMethods; in GetOrEmitProtocol()
6229 std::vector<llvm::Constant*> OptInstanceMethods, OptClassMethods; in GetOrEmitProtocol()
6230 std::vector<llvm::Constant*> MethodTypesExt, OptMethodTypesExt; in GetOrEmitProtocol()
6232 llvm::Constant *C = GetMethodDescriptionConstant(MD); in GetOrEmitProtocol()
6246 llvm::Constant *C = GetMethodDescriptionConstant(MD); in GetOrEmitProtocol()
6262 llvm::Constant *Values[12]; in GetOrEmitProtocol()
6264 Values[0] = llvm::Constant::getNullValue(ObjCTypes.ObjectPtrTy); in GetOrEmitProtocol()
6290 Values[8] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size); in GetOrEmitProtocol()
6291 Values[9] = llvm::Constant::getNullValue(ObjCTypes.IntTy); in GetOrEmitProtocol()
6296 Values[11] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); in GetOrEmitProtocol()
6298 llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ProtocolnfABITy, in GetOrEmitProtocol()
6303 Entry->setLinkage(llvm::GlobalValue::WeakAnyLinkage); in GetOrEmitProtocol()
6307 new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABITy, in GetOrEmitProtocol()
6308 false, llvm::GlobalValue::WeakAnyLinkage, Init, in GetOrEmitProtocol()
6316 Entry->setVisibility(llvm::GlobalValue::HiddenVisibility); in GetOrEmitProtocol()
6321 llvm::GlobalVariable *PTGV = in GetOrEmitProtocol()
6322 new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABIPtrTy, in GetOrEmitProtocol()
6323 false, llvm::GlobalValue::WeakAnyLinkage, Entry, in GetOrEmitProtocol()
6328 PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility); in GetOrEmitProtocol()
6341 llvm::Constant *
6345 SmallVector<llvm::Constant *, 16> ProtocolRefs; in EmitProtocolList()
6349 return llvm::Constant::getNullValue(ObjCTypes.ProtocolListnfABIPtrTy); in EmitProtocolList()
6354 llvm::GlobalVariable *GV = in EmitProtocolList()
6357 return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.ProtocolListnfABIPtrTy); in EmitProtocolList()
6363 ProtocolRefs.push_back(llvm::Constant::getNullValue( in EmitProtocolList()
6366 llvm::Constant *Values[2]; in EmitProtocolList()
6368 llvm::ConstantInt::get(ObjCTypes.LongTy, ProtocolRefs.size() - 1); in EmitProtocolList()
6370 llvm::ConstantArray::get(llvm::ArrayType::get(ObjCTypes.ProtocolnfABIPtrTy, in EmitProtocolList()
6374 llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values); in EmitProtocolList()
6375 GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false, in EmitProtocolList()
6376 llvm::GlobalValue::PrivateLinkage, in EmitProtocolList()
6382 return llvm::ConstantExpr::getBitCast(GV, in EmitProtocolList()
6393 llvm::Constant *
6395 llvm::Constant *Desc[3]; in GetMethodDescriptionConstant()
6397 llvm::ConstantExpr::getBitCast(GetMethodVarName(MD->getSelector()), in GetMethodDescriptionConstant()
6404 Desc[2] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); in GetMethodDescriptionConstant()
6405 return llvm::ConstantStruct::get(ObjCTypes.MethodTy, Desc); in GetMethodDescriptionConstant()
6417 llvm::Value *BaseValue, in EmitObjCValueForIvar()
6421 llvm::Value *Offset = EmitIvarOffset(CGF, ID, Ivar); in EmitObjCValueForIvar()
6426 llvm::Value *CGObjCNonFragileABIMac::EmitIvarOffset( in EmitIvarOffset()
6430 llvm::Value *IvarOffsetValue = ObjCIvarOffsetVariable(Interface, Ivar); in EmitIvarOffset()
6433 cast<llvm::LoadInst>(IvarOffsetValue) in EmitIvarOffset()
6435 llvm::MDNode::get(VMContext, None)); in EmitIvarOffset()
6474 llvm::Value *arg0, in EmitVTableMessageSend()
6504 llvm::Constant *fn = nullptr; in EmitVTableMessageSend()
6534 llvm::GlobalVariable *messageRef in EmitVTableMessageSend()
6538 llvm::Constant *values[] = { fn, GetMethodVarName(selector) }; in EmitVTableMessageSend()
6539 llvm::Constant *init = llvm::ConstantStruct::getAnon(values); in EmitVTableMessageSend()
6540 messageRef = new llvm::GlobalVariable(CGM.getModule(), in EmitVTableMessageSend()
6543 llvm::GlobalValue::WeakAnyLinkage, in EmitVTableMessageSend()
6546 messageRef->setVisibility(llvm::GlobalValue::HiddenVisibility); in EmitVTableMessageSend()
6562 llvm::Value *mref = in EmitVTableMessageSend()
6569 llvm::Value *callee = in EmitVTableMessageSend()
6586 llvm::Value *Receiver, in GenerateMessageSend()
6600 llvm::GlobalVariable *
6602 llvm::GlobalValue::LinkageTypes L = in GetClassGlobal()
6603 Weak ? llvm::GlobalValue::ExternalWeakLinkage in GetClassGlobal()
6604 : llvm::GlobalValue::ExternalLinkage; in GetClassGlobal()
6606 llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name); in GetClassGlobal()
6609 GV = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABITy, in GetClassGlobal()
6616 llvm::Value *CGObjCNonFragileABIMac::EmitClassRefFromId(CodeGenFunction &CGF, in EmitClassRefFromId()
6620 llvm::GlobalVariable *&Entry = ClassReferences[II]; in EmitClassRefFromId()
6626 llvm::GlobalVariable *ClassGV = GetClassGlobal(ClassName, Weak); in EmitClassRefFromId()
6627 Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABIPtrTy, in EmitClassRefFromId()
6628 false, llvm::GlobalValue::PrivateLinkage, in EmitClassRefFromId()
6639 llvm::Value *CGObjCNonFragileABIMac::EmitClassRef(CodeGenFunction &CGF, in EmitClassRef()
6644 llvm::Value *CGObjCNonFragileABIMac::EmitNSAutoreleasePoolClassRef( in EmitNSAutoreleasePoolClassRef()
6650 llvm::Value *
6653 llvm::GlobalVariable *&Entry = SuperClassReferences[ID->getIdentifier()]; in EmitSuperClassRef()
6656 llvm::SmallString<64> ClassName(getClassSymbolPrefix()); in EmitSuperClassRef()
6658 llvm::GlobalVariable *ClassGV = GetClassGlobal(ClassName.str(), in EmitSuperClassRef()
6660 Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABIPtrTy, in EmitSuperClassRef()
6661 false, llvm::GlobalValue::PrivateLinkage, in EmitSuperClassRef()
6675 llvm::Value *CGObjCNonFragileABIMac::EmitMetaClassRef(CodeGenFunction &CGF, in EmitMetaClassRef()
6678 llvm::GlobalVariable * &Entry = MetaClassReferences[ID->getIdentifier()]; in EmitMetaClassRef()
6680 llvm::SmallString<64> MetaClassName(getMetaclassSymbolPrefix()); in EmitMetaClassRef()
6682 llvm::GlobalVariable *MetaClassGV = in EmitMetaClassRef()
6685 Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABIPtrTy, in EmitMetaClassRef()
6686 false, llvm::GlobalValue::PrivateLinkage, in EmitMetaClassRef()
6700 llvm::Value *CGObjCNonFragileABIMac::GetClass(CodeGenFunction &CGF, in GetClass()
6703 llvm::SmallString<64> ClassName(getClassSymbolPrefix()); in GetClass()
6705 llvm::GlobalVariable *ClassGV = GetClassGlobal(ClassName.str(), true); in GetClass()
6723 llvm::Value *Receiver, in GenerateMessageSendSuper()
6730 llvm::Value *ObjCSuper = in GenerateMessageSendSuper()
6733 llvm::Value *ReceiverAsObject = in GenerateMessageSendSuper()
6740 llvm::Value *Target; in GenerateMessageSendSuper()
6748 llvm::Type *ClassTy = in GenerateMessageSendSuper()
6764 llvm::Value *CGObjCNonFragileABIMac::EmitSelector(CodeGenFunction &CGF, in EmitSelector()
6766 llvm::GlobalVariable *&Entry = SelectorReferences[Sel]; in EmitSelector()
6769 llvm::Constant *Casted = in EmitSelector()
6770 llvm::ConstantExpr::getBitCast(GetMethodVarName(Sel), in EmitSelector()
6772 Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.SelectorPtrTy, in EmitSelector()
6773 false, llvm::GlobalValue::PrivateLinkage, in EmitSelector()
6782 llvm::LoadInst* LI = CGF.Builder.CreateLoad(Entry); in EmitSelector()
6785 llvm::MDNode::get(VMContext, None)); in EmitSelector()
6792 llvm::Value *src, in EmitObjCIvarAssign()
6793 llvm::Value *dst, in EmitObjCIvarAssign()
6794 llvm::Value *ivarOffset) { in EmitObjCIvarAssign()
6795 llvm::Type * SrcTy = src->getType(); in EmitObjCIvarAssign()
6796 if (!isa<llvm::PointerType>(SrcTy)) { in EmitObjCIvarAssign()
6805 llvm::Value *args[] = { src, dst, ivarOffset }; in EmitObjCIvarAssign()
6814 llvm::Value *src, llvm::Value *dst) { in EmitObjCStrongCastAssign()
6815 llvm::Type * SrcTy = src->getType(); in EmitObjCStrongCastAssign()
6816 if (!isa<llvm::PointerType>(SrcTy)) { in EmitObjCStrongCastAssign()
6825 llvm::Value *args[] = { src, dst }; in EmitObjCStrongCastAssign()
6832 llvm::Value *DestPtr, in EmitGCMemmoveCollectable()
6833 llvm::Value *SrcPtr, in EmitGCMemmoveCollectable()
6834 llvm::Value *Size) { in EmitGCMemmoveCollectable()
6837 llvm::Value *args[] = { DestPtr, SrcPtr, Size }; in EmitGCMemmoveCollectable()
6844 llvm::Value * CGObjCNonFragileABIMac::EmitObjCWeakRead( in EmitObjCWeakRead()
6846 llvm::Value *AddrWeakObj) { in EmitObjCWeakRead()
6847 llvm::Type* DestTy = in EmitObjCWeakRead()
6848 cast<llvm::PointerType>(AddrWeakObj->getType())->getElementType(); in EmitObjCWeakRead()
6850 llvm::Value *read_weak = in EmitObjCWeakRead()
6861 llvm::Value *src, llvm::Value *dst) { in EmitObjCWeakAssign()
6862 llvm::Type * SrcTy = src->getType(); in EmitObjCWeakAssign()
6863 if (!isa<llvm::PointerType>(SrcTy)) { in EmitObjCWeakAssign()
6872 llvm::Value *args[] = { src, dst }; in EmitObjCWeakAssign()
6881 llvm::Value *src, llvm::Value *dst, in EmitObjCGlobalAssign()
6883 llvm::Type * SrcTy = src->getType(); in EmitObjCGlobalAssign()
6884 if (!isa<llvm::PointerType>(SrcTy)) { in EmitObjCGlobalAssign()
6893 llvm::Value *args[] = { src, dst }; in EmitObjCGlobalAssign()
6906 cast<llvm::Function>(ObjCTypes.getSyncEnterFn()), in EmitSynchronizedStmt()
6907 cast<llvm::Function>(ObjCTypes.getSyncExitFn())); in EmitSynchronizedStmt()
6910 llvm::Constant *
6915 llvm::Constant *IDEHType = in GetEHType()
6919 new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.EHTypeTy, in GetEHType()
6921 llvm::GlobalValue::ExternalLinkage, in GetEHType()
6938 cast<llvm::Function>(ObjCTypes.getObjCBeginCatchFn()), in EmitTryStmt()
6939 cast<llvm::Function>(ObjCTypes.getObjCEndCatchFn()), in EmitTryStmt()
6940 cast<llvm::Function>(ObjCTypes.getExceptionRethrowFn())); in EmitTryStmt()
6948 llvm::Value *Exception = CGF.EmitObjCThrowOperand(ThrowExpr); in EmitThrowStmt()
6962 llvm::Constant *
6965 llvm::GlobalVariable * &Entry = EHTypeReferences[ID->getIdentifier()]; in GetInterfaceEHType()
6977 new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.EHTypeTy, false, in GetInterfaceEHType()
6978 llvm::GlobalValue::ExternalLinkage, in GetInterfaceEHType()
6987 llvm::SmallString<64> ClassName(getClassSymbolPrefix()); in GetInterfaceEHType()
6990 llvm::GlobalVariable *VTableGV = in GetInterfaceEHType()
6993 VTableGV = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.Int8PtrTy, in GetInterfaceEHType()
6995 llvm::GlobalValue::ExternalLinkage, in GetInterfaceEHType()
6998 llvm::Value *VTableIdx = llvm::ConstantInt::get(CGM.Int32Ty, 2); in GetInterfaceEHType()
7000 llvm::Constant *Values[] = { in GetInterfaceEHType()
7001 llvm::ConstantExpr::getGetElementPtr(VTableGV->getValueType(), VTableGV, in GetInterfaceEHType()
7005 llvm::Constant *Init = in GetInterfaceEHType()
7006 llvm::ConstantStruct::get(ObjCTypes.EHTypeTy, Values); in GetInterfaceEHType()
7008 llvm::GlobalValue::LinkageTypes L = ForDefinition in GetInterfaceEHType()
7009 ? llvm::GlobalValue::ExternalLinkage in GetInterfaceEHType()
7010 : llvm::GlobalValue::WeakAnyLinkage; in GetInterfaceEHType()
7014 llvm::SmallString<64> EHTYPEName("OBJC_EHTYPE_$_"); in GetInterfaceEHType()
7016 Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.EHTypeTy, false, in GetInterfaceEHType()
7024 Entry->setVisibility(llvm::GlobalValue::HiddenVisibility); in GetInterfaceEHType()