Lines Matching refs:llvm

49   std::vector<llvm::Type*> ArgTys;
51 llvm::Constant *Function;
63 llvm::Type *RetTy, ...) { in init()
70 while (llvm::Type *ArgTy = va_arg(Args, llvm::Type*)) in init()
78 operator llvm::Constant*() { in operator llvm::Constant*()
82 llvm::Type *RetTy = ArgTys.back(); in operator llvm::Constant*()
84 llvm::FunctionType *FTy = llvm::FunctionType::get(RetTy, ArgTys, false); in operator llvm::Constant*()
86 cast<llvm::Constant>(CGM->CreateRuntimeFunction(FTy, FunctionName)); in operator llvm::Constant*()
93 operator llvm::Function*() { in operator llvm::Function*()
94 return cast<llvm::Function>((llvm::Constant*)*this); in operator llvm::Function*()
106 llvm::Module &TheModule;
109 llvm::StructType *ObjCSuperTy;
112 llvm::PointerType *PtrToObjCSuperTy;
116 llvm::PointerType *SelectorTy;
119 llvm::IntegerType *Int8Ty;
122 llvm::PointerType *PtrToInt8Ty;
128 llvm::PointerType *IMPTy;
133 llvm::PointerType *IdTy;
136 llvm::PointerType *PtrToIdTy;
141 llvm::IntegerType *IntTy;
145 llvm::PointerType *PtrTy;
149 llvm::IntegerType *LongTy;
151 llvm::IntegerType *SizeTy;
153 llvm::IntegerType *IntPtrTy;
155 llvm::IntegerType *PtrDiffTy;
158 llvm::PointerType *PtrToIntTy;
160 llvm::Type *BoolTy;
162 llvm::IntegerType *Int32Ty;
164 llvm::IntegerType *Int64Ty;
172 llvm::Constant *MakeConstantString(const std::string &Str, in MakeConstantString()
175 return llvm::ConstantExpr::getGetElementPtr(ConstStr->getValueType(), in MakeConstantString()
182 llvm::Constant *ExportUniqueString(const std::string &Str, in ExportUniqueString()
187 llvm::Constant *value = llvm::ConstantDataArray::getString(VMContext,Str); in ExportUniqueString()
188 ConstStr = new llvm::GlobalVariable(TheModule, value->getType(), true, in ExportUniqueString()
189 llvm::GlobalValue::LinkOnceODRLinkage, value, prefix + Str); in ExportUniqueString()
191 return llvm::ConstantExpr::getGetElementPtr(ConstStr->getValueType(), in ExportUniqueString()
197 llvm::GlobalVariable *MakeGlobal(llvm::StructType *Ty, in MakeGlobal()
198 ArrayRef<llvm::Constant *> V, in MakeGlobal()
200 llvm::GlobalValue::LinkageTypes linkage in MakeGlobal()
201 =llvm::GlobalValue::InternalLinkage) { in MakeGlobal()
202 llvm::Constant *C = llvm::ConstantStruct::get(Ty, V); in MakeGlobal()
203 return new llvm::GlobalVariable(TheModule, Ty, false, in MakeGlobal()
209 llvm::GlobalVariable *MakeGlobal(llvm::ArrayType *Ty, in MakeGlobal()
210 ArrayRef<llvm::Constant *> V, in MakeGlobal()
212 llvm::GlobalValue::LinkageTypes linkage in MakeGlobal()
213 =llvm::GlobalValue::InternalLinkage) { in MakeGlobal()
214 llvm::Constant *C = llvm::ConstantArray::get(Ty, V); in MakeGlobal()
215 return new llvm::GlobalVariable(TheModule, Ty, false, in MakeGlobal()
220 llvm::GlobalVariable *MakeGlobalArray(llvm::Type *Ty, in MakeGlobalArray()
221 ArrayRef<llvm::Constant *> V, in MakeGlobalArray()
223 llvm::GlobalValue::LinkageTypes linkage in MakeGlobalArray()
224 =llvm::GlobalValue::InternalLinkage) { in MakeGlobalArray()
225 llvm::ArrayType *ArrayTy = llvm::ArrayType::get(Ty, V.size()); in MakeGlobalArray()
229 llvm::Constant *MakePropertyEncodingString(const ObjCPropertyDecl *PD, in MakePropertyEncodingString()
243 return llvm::ConstantExpr::getGetElementPtr(ConstStr->getValueType(), in MakePropertyEncodingString()
249 void PushPropertyAttributes(std::vector<llvm::Constant*> &Fields, in PushPropertyAttributes()
261 Fields.push_back(llvm::ConstantInt::get(Int8Ty, attrs & 0xff)); in PushPropertyAttributes()
271 Fields.push_back(llvm::ConstantInt::get(Int8Ty, attrs & 0xff)); in PushPropertyAttributes()
273 Fields.push_back(llvm::ConstantInt::get(Int8Ty, 0)); in PushPropertyAttributes()
274 Fields.push_back(llvm::ConstantInt::get(Int8Ty, 0)); in PushPropertyAttributes()
279 llvm::Value* EnforceType(CGBuilderTy &B, llvm::Value *V, llvm::Type *Ty) { in EnforceType()
284 llvm::Constant *Zeros[2];
286 llvm::Constant *NULLPtr;
288 llvm::LLVMContext &VMContext;
294 llvm::GlobalAlias *ClassPtrAlias;
299 llvm::GlobalAlias *MetaClassPtrAlias;
301 std::vector<llvm::Constant*> Classes;
303 std::vector<llvm::Constant*> Categories;
306 std::vector<llvm::Constant*> ConstantStrings;
310 llvm::StringMap<llvm::Constant*> ObjCStrings;
312 llvm::StringMap<llvm::Constant*> ExistingProtocols;
318 typedef std::pair<std::string, llvm::GlobalAlias*> TypedSelector;
322 typedef llvm::DenseMap<Selector, SmallVector<TypedSelector, 2> >
389 llvm::Constant *GenerateIvarList(ArrayRef<llvm::Constant *> IvarNames,
390 ArrayRef<llvm::Constant *> IvarTypes,
391 ArrayRef<llvm::Constant *> IvarOffsets);
397 llvm::Constant *GenerateMethodList(StringRef ClassName,
400 ArrayRef<llvm::Constant *> MethodTypes,
405 llvm::Constant *GenerateEmptyProtocol(const std::string &ProtocolName);
408 llvm::Constant *GeneratePropertyList(const ObjCImplementationDecl *OID,
410 SmallVectorImpl<llvm::Constant*> &InstanceMethodTypes);
413 llvm::Constant *GenerateProtocolList(ArrayRef<std::string> Protocols);
420 llvm::Constant *GenerateClassStructure(
421 llvm::Constant *MetaClass,
422 llvm::Constant *SuperClass,
425 llvm::Constant *Version,
426 llvm::Constant *InstanceSize,
427 llvm::Constant *IVars,
428 llvm::Constant *Methods,
429 llvm::Constant *Protocols,
430 llvm::Constant *IvarOffsets,
431 llvm::Constant *Properties,
432 llvm::Constant *StrongIvarBitmap,
433 llvm::Constant *WeakIvarBitmap,
437 llvm::Constant *GenerateProtocolMethodList(
438 ArrayRef<llvm::Constant *> MethodNames,
439 ArrayRef<llvm::Constant *> MethodTypes);
442 llvm::Value *GetSelector(CodeGenFunction &CGF, Selector Sel,
445 llvm::GlobalVariable *ObjCIvarOffsetVariable(const ObjCInterfaceDecl *ID,
452 virtual llvm::Value *GetClassNamed(CodeGenFunction &CGF,
457 virtual llvm::Value *LookupIMP(CodeGenFunction &CGF,
458 llvm::Value *&Receiver,
459 llvm::Value *cmd,
460 llvm::MDNode *node,
465 virtual llvm::Value *LookupIMPSuper(CodeGenFunction &CGF,
466 llvm::Value *ObjCSuper,
467 llvm::Value *cmd,
480 llvm::Constant *MakeBitField(ArrayRef<bool> bits);
485 llvm::Constant *GenerateConstantString(const StringLiteral *) override;
490 llvm::Value *Receiver, const CallArgList &CallArgs,
497 bool isCategoryImpl, llvm::Value *Receiver,
500 llvm::Value *GetClass(CodeGenFunction &CGF,
502 llvm::Value *GetSelector(CodeGenFunction &CGF, Selector Sel,
504 llvm::Value *GetSelector(CodeGenFunction &CGF,
506 llvm::Constant *GetEHType(QualType T) override;
508 llvm::Function *GenerateMethod(const ObjCMethodDecl *OMD,
513 llvm::Value *GenerateProtocolRef(CodeGenFunction &CGF,
516 llvm::Function *ModuleInitFunction() override;
517 llvm::Constant *GetPropertyGetFunction() override;
518 llvm::Constant *GetPropertySetFunction() override;
519 llvm::Constant *GetOptimizedPropertySetFunction(bool atomic,
521 llvm::Constant *GetSetStructFunction() override;
522 llvm::Constant *GetGetStructFunction() override;
523 llvm::Constant *GetCppAtomicObjectGetFunction() override;
524 llvm::Constant *GetCppAtomicObjectSetFunction() override;
525 llvm::Constant *EnumerationMutationFunction() override;
534 llvm::Value * EmitObjCWeakRead(CodeGenFunction &CGF,
535 llvm::Value *AddrWeakObj) override;
537 llvm::Value *src, llvm::Value *dst) override;
539 llvm::Value *src, llvm::Value *dest,
541 void EmitObjCIvarAssign(CodeGenFunction &CGF, llvm::Value *src,
542 llvm::Value *dest, llvm::Value *ivarOffset) override;
544 llvm::Value *src, llvm::Value *dest) override;
545 void EmitGCMemmoveCollectable(CodeGenFunction &CGF, llvm::Value *DestPtr,
546 llvm::Value *SrcPtr,
547 llvm::Value *Size) override;
549 llvm::Value *BaseValue, const ObjCIvarDecl *Ivar,
551 llvm::Value *EmitIvarOffset(CodeGenFunction &CGF,
554 llvm::Value *EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) override;
555 llvm::Constant *BuildGCBlockLayout(CodeGenModule &CGM, in BuildGCBlockLayout()
559 llvm::Constant *BuildRCBlockLayout(CodeGenModule &CGM, in BuildRCBlockLayout()
564 llvm::Constant *BuildByrefLayout(CodeGenModule &CGM, QualType T) override { in BuildByrefLayout()
568 llvm::GlobalVariable *GetClassGlobal(const std::string &Name, in GetClassGlobal()
590 llvm::Value *LookupIMP(CodeGenFunction &CGF, llvm::Value *&Receiver, in LookupIMP()
591 llvm::Value *cmd, llvm::MDNode *node, in LookupIMP()
594 llvm::Value *args[] = { in LookupIMP()
597 llvm::CallSite imp = CGF.EmitRuntimeCallOrInvoke(MsgLookupFn, args); in LookupIMP()
601 llvm::Value *LookupIMPSuper(CodeGenFunction &CGF, llvm::Value *ObjCSuper, in LookupIMPSuper()
602 llvm::Value *cmd, MessageSendInfo &MSI) override { in LookupIMPSuper()
604 llvm::Value *lookupArgs[] = {EnforceType(Builder, ObjCSuper, in LookupIMPSuper()
644 llvm::Type *SlotTy;
646 llvm::Constant *GetEHType(QualType T) override;
648 llvm::Value *LookupIMP(CodeGenFunction &CGF, llvm::Value *&Receiver, in LookupIMP()
649 llvm::Value *cmd, llvm::MDNode *node, in LookupIMP()
652 llvm::Function *LookupFn = SlotLookupFn; in LookupIMP()
655 llvm::Value *ReceiverPtr = CGF.CreateTempAlloca(Receiver->getType()); in LookupIMP()
658 llvm::Value *self; in LookupIMP()
663 self = llvm::ConstantPointerNull::get(IdTy); in LookupIMP()
669 llvm::Value *args[] = { in LookupIMP()
673 llvm::CallSite slot = CGF.EmitRuntimeCallOrInvoke(LookupFn, args); in LookupIMP()
678 llvm::Value *imp = Builder.CreateLoad( in LookupIMP()
686 llvm::Value *LookupIMPSuper(CodeGenFunction &CGF, llvm::Value *ObjCSuper, in LookupIMPSuper()
687 llvm::Value *cmd, in LookupIMPSuper()
690 llvm::Value *lookupArgs[] = {ObjCSuper, cmd}; in LookupIMPSuper()
692 llvm::CallInst *slot = in LookupIMPSuper()
702 llvm::StructType *SlotStructTy = llvm::StructType::get(PtrTy, in CGObjCGNUstep()
704 SlotTy = llvm::PointerType::getUnqual(SlotStructTy); in CGObjCGNUstep()
713 llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext); in CGObjCGNUstep()
722 llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext); in CGObjCGNUstep()
731 llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext); in CGObjCGNUstep()
749 llvm::Constant *GetCppAtomicObjectGetFunction() override { in GetCppAtomicObjectGetFunction()
756 llvm::Constant *GetCppAtomicObjectSetFunction() override { in GetCppAtomicObjectSetFunction()
763 llvm::Constant *GetOptimizedPropertySetFunction(bool atomic, in GetOptimizedPropertySetFunction()
797 llvm::Value *LookupIMP(CodeGenFunction &CGF, llvm::Value *&Receiver, in LookupIMP()
798 llvm::Value *cmd, llvm::MDNode *node, in LookupIMP()
801 llvm::Value *args[] = { in LookupIMP()
805 llvm::CallSite imp; in LookupIMP()
815 llvm::Value *LookupIMPSuper(CodeGenFunction &CGF, llvm::Value *ObjCSuper, in LookupIMPSuper()
816 llvm::Value *cmd, MessageSendInfo &MSI) override { in LookupIMPSuper()
818 llvm::Value *lookupArgs[] = {EnforceType(Builder, ObjCSuper, in LookupIMPSuper()
827 llvm::Value *GetClassNamed(CodeGenFunction &CGF, in GetClassNamed()
836 llvm::GlobalVariable *ClassSymbol = TheModule.getGlobalVariable(SymbolName); in GetClassNamed()
839 ClassSymbol = new llvm::GlobalVariable(TheModule, LongTy, false, in GetClassNamed()
840 llvm::GlobalValue::ExternalLinkage, in GetClassNamed()
871 llvm::GlobalVariable *ClassSymbol = TheModule.getGlobalVariable(symbolName); in EmitClassRef()
873 ClassSymbol = new llvm::GlobalVariable(TheModule, LongTy, false, in EmitClassRef()
874 llvm::GlobalValue::ExternalLinkage, in EmitClassRef()
877 new llvm::GlobalVariable(TheModule, ClassSymbol->getType(), true, in EmitClassRef()
878 llvm::GlobalValue::WeakAnyLinkage, ClassSymbol, symbolRef); in EmitClassRef()
901 IntTy = cast<llvm::IntegerType>( in CGObjCGNU()
903 LongTy = cast<llvm::IntegerType>( in CGObjCGNU()
905 SizeTy = cast<llvm::IntegerType>( in CGObjCGNU()
907 PtrDiffTy = cast<llvm::IntegerType>( in CGObjCGNU()
911 Int8Ty = llvm::Type::getInt8Ty(VMContext); in CGObjCGNU()
913 PtrToInt8Ty = llvm::PointerType::getUnqual(Int8Ty); in CGObjCGNU()
915 Zeros[0] = llvm::ConstantInt::get(LongTy, 0); in CGObjCGNU()
917 NULLPtr = llvm::ConstantPointerNull::get(PtrToInt8Ty); in CGObjCGNU()
923 SelectorTy = cast<llvm::PointerType>(CGM.getTypes().ConvertType(selTy)); in CGObjCGNU()
926 PtrToIntTy = llvm::PointerType::getUnqual(IntTy); in CGObjCGNU()
929 Int32Ty = llvm::Type::getInt32Ty(VMContext); in CGObjCGNU()
930 Int64Ty = llvm::Type::getInt64Ty(VMContext); in CGObjCGNU()
940 IdTy = cast<llvm::PointerType>(CGM.getTypes().ConvertType(ASTIdTy)); in CGObjCGNU()
944 PtrToIdTy = llvm::PointerType::getUnqual(IdTy); in CGObjCGNU()
946 ObjCSuperTy = llvm::StructType::get(IdTy, IdTy, nullptr); in CGObjCGNU()
947 PtrToObjCSuperTy = llvm::PointerType::getUnqual(ObjCSuperTy); in CGObjCGNU()
949 llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext); in CGObjCGNU()
977 llvm::Type *IMPArgs[] = { IdTy, SelectorTy }; in CGObjCGNU()
978 IMPTy = llvm::PointerType::getUnqual(llvm::FunctionType::get(IdTy, IMPArgs, in CGObjCGNU()
1016 llvm::Value *CGObjCGNU::GetClassNamed(CodeGenFunction &CGF, in GetClassNamed()
1019 llvm::GlobalVariable *ClassNameGV = CGM.GetAddrOfConstantCString(Name); in GetClassNamed()
1029 llvm::Value *ClassName = in GetClassNamed()
1032 llvm::Constant *ClassLookupFn = in GetClassNamed()
1033 CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy, PtrToInt8Ty, true), in GetClassNamed()
1040 llvm::Value *CGObjCGNU::GetClass(CodeGenFunction &CGF, in GetClass()
1044 llvm::Value *CGObjCGNU::EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) { in EmitNSAutoreleasePoolClassRef()
1048 llvm::Value *CGObjCGNU::GetSelector(CodeGenFunction &CGF, Selector Sel, in GetSelector()
1052 llvm::GlobalAlias *SelValue = nullptr; in GetSelector()
1062 SelValue = llvm::GlobalAlias::create( in GetSelector()
1063 SelectorTy->getElementType(), 0, llvm::GlobalValue::PrivateLinkage, in GetSelector()
1069 llvm::Value *tmp = CGF.CreateTempAlloca(SelValue->getType()); in GetSelector()
1076 llvm::Value *CGObjCGNU::GetSelector(CodeGenFunction &CGF, Selector Sel, in GetSelector()
1081 llvm::Value *CGObjCGNU::GetSelector(CodeGenFunction &CGF, in GetSelector()
1088 llvm::Constant *CGObjCGNU::GetEHType(QualType T) { in GetEHType()
1109 llvm::Constant *CGObjCGNUstep::GetEHType(QualType T) { in GetEHType()
1119 llvm::Constant *IDEHType = in GetEHType()
1123 new llvm::GlobalVariable(CGM.getModule(), PtrToInt8Ty, in GetEHType()
1125 llvm::GlobalValue::ExternalLinkage, in GetEHType()
1127 return llvm::ConstantExpr::getBitCast(IDEHType, PtrToInt8Ty); in GetEHType()
1140 llvm::Constant *typeinfo = TheModule.getGlobalVariable(typeinfoName); in GetEHType()
1142 return llvm::ConstantExpr::getBitCast(typeinfo, PtrToInt8Ty); in GetEHType()
1152 Vtable = new llvm::GlobalVariable(TheModule, PtrToInt8Ty, true, in GetEHType()
1153 llvm::GlobalValue::ExternalLinkage, in GetEHType()
1156 llvm::Constant *Two = llvm::ConstantInt::get(IntTy, 2); in GetEHType()
1157 auto *BVtable = llvm::ConstantExpr::getBitCast( in GetEHType()
1158 llvm::ConstantExpr::getGetElementPtr(Vtable->getValueType(), Vtable, Two), in GetEHType()
1161 llvm::Constant *typeName = in GetEHType()
1164 std::vector<llvm::Constant*> fields; in GetEHType()
1167 llvm::Constant *TI = in GetEHType()
1168 MakeGlobal(llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, in GetEHType()
1170 llvm::GlobalValue::LinkOnceODRLinkage); in GetEHType()
1171 return llvm::ConstantExpr::getBitCast(TI, PtrToInt8Ty); in GetEHType()
1175 llvm::Constant *CGObjCGNU::GenerateConstantString(const StringLiteral *SL) { in GenerateConstantString()
1180 llvm::StringMap<llvm::Constant*>::iterator old = ObjCStrings.find(Str); in GenerateConstantString()
1191 llvm::Constant *isa = TheModule.getNamedGlobal(Sym); in GenerateConstantString()
1194 isa = new llvm::GlobalVariable(TheModule, IdTy, /* isConstant */false, in GenerateConstantString()
1195 llvm::GlobalValue::ExternalWeakLinkage, nullptr, Sym); in GenerateConstantString()
1197 isa = llvm::ConstantExpr::getBitCast(isa, PtrToIdTy); in GenerateConstantString()
1199 std::vector<llvm::Constant*> Ivars; in GenerateConstantString()
1202 Ivars.push_back(llvm::ConstantInt::get(IntTy, Str.size())); in GenerateConstantString()
1203 llvm::Constant *ObjCStr = MakeGlobal( in GenerateConstantString()
1204 llvm::StructType::get(PtrToIdTy, PtrToInt8Ty, IntTy, nullptr), in GenerateConstantString()
1206 ObjCStr = llvm::ConstantExpr::getBitCast(ObjCStr, PtrToInt8Ty); in GenerateConstantString()
1222 llvm::Value *Receiver, in GenerateMessageSendSuper()
1237 llvm::Value *cmd = GetSelector(CGF, Sel); in GenerateMessageSendSuper()
1248 llvm::Value *ReceiverClass = nullptr; in GenerateMessageSendSuper()
1250 llvm::Constant *classLookupFunction = nullptr; in GenerateMessageSendSuper()
1252 classLookupFunction = CGM.CreateRuntimeFunction(llvm::FunctionType::get( in GenerateMessageSendSuper()
1255 classLookupFunction = CGM.CreateRuntimeFunction(llvm::FunctionType::get( in GenerateMessageSendSuper()
1268 MetaClassPtrAlias = llvm::GlobalAlias::create( in GenerateMessageSendSuper()
1269 IdTy->getElementType(), 0, llvm::GlobalValue::InternalLinkage, in GenerateMessageSendSuper()
1275 ClassPtrAlias = llvm::GlobalAlias::create( in GenerateMessageSendSuper()
1276 IdTy->getElementType(), 0, llvm::GlobalValue::InternalLinkage, in GenerateMessageSendSuper()
1283 llvm::Type *CastTy = llvm::StructType::get(IdTy, IdTy, nullptr); in GenerateMessageSendSuper()
1285 llvm::PointerType::getUnqual(CastTy)); in GenerateMessageSendSuper()
1291 llvm::StructType *ObjCSuperTy = llvm::StructType::get( in GenerateMessageSendSuper()
1293 llvm::Value *ObjCSuper = Builder.CreateAlloca(ObjCSuperTy); in GenerateMessageSendSuper()
1303 llvm::Value *imp = LookupIMPSuper(CGF, ObjCSuper, cmd, MSI); in GenerateMessageSendSuper()
1306 llvm::Metadata *impMD[] = { in GenerateMessageSendSuper()
1307 llvm::MDString::get(VMContext, Sel.getAsString()), in GenerateMessageSendSuper()
1308 llvm::MDString::get(VMContext, Class->getSuperClass()->getNameAsString()), in GenerateMessageSendSuper()
1309 llvm::ConstantAsMetadata::get(llvm::ConstantInt::get( in GenerateMessageSendSuper()
1310 llvm::Type::getInt1Ty(VMContext), IsClassMessage))}; in GenerateMessageSendSuper()
1311 llvm::MDNode *node = llvm::MDNode::get(VMContext, impMD); in GenerateMessageSendSuper()
1313 llvm::Instruction *call; in GenerateMessageSendSuper()
1326 llvm::Value *Receiver, in GenerateMessageSend()
1357 llvm::BasicBlock *startBB = nullptr; in GenerateMessageSend()
1358 llvm::BasicBlock *messageBB = nullptr; in GenerateMessageSend()
1359 llvm::BasicBlock *continueBB = nullptr; in GenerateMessageSend()
1366 llvm::Value *isNil = Builder.CreateICmpEQ(Receiver, in GenerateMessageSend()
1367 llvm::Constant::getNullValue(Receiver->getType())); in GenerateMessageSend()
1372 IdTy = cast<llvm::PointerType>(CGM.getTypes().ConvertType(ASTIdTy)); in GenerateMessageSend()
1373 llvm::Value *cmd; in GenerateMessageSend()
1381 llvm::Metadata *impMD[] = { in GenerateMessageSend()
1382 llvm::MDString::get(VMContext, Sel.getAsString()), in GenerateMessageSend()
1383 llvm::MDString::get(VMContext, Class ? Class->getNameAsString() : ""), in GenerateMessageSend()
1384 llvm::ConstantAsMetadata::get(llvm::ConstantInt::get( in GenerateMessageSend()
1385 llvm::Type::getInt1Ty(VMContext), Class != nullptr))}; in GenerateMessageSend()
1386 llvm::MDNode *node = llvm::MDNode::get(VMContext, impMD); in GenerateMessageSend()
1396 llvm::Value *imp; in GenerateMessageSend()
1408 imp = CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy, IdTy, true), in GenerateMessageSend()
1413 imp = CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy, IdTy, true), in GenerateMessageSend()
1416 imp = CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy, IdTy, true), in GenerateMessageSend()
1426 llvm::Instruction *call; in GenerateMessageSend()
1437 llvm::Value *v = msgRet.getScalarVal(); in GenerateMessageSend()
1438 llvm::PHINode *phi = Builder.CreatePHI(v->getType(), 2); in GenerateMessageSend()
1440 phi->addIncoming(llvm::Constant::getNullValue(v->getType()), startBB); in GenerateMessageSend()
1443 llvm::Value *v = msgRet.getAggregateAddr(); in GenerateMessageSend()
1444 llvm::PHINode *phi = Builder.CreatePHI(v->getType(), 2); in GenerateMessageSend()
1445 llvm::PointerType *RetTy = cast<llvm::PointerType>(v->getType()); in GenerateMessageSend()
1446 llvm::AllocaInst *NullVal = in GenerateMessageSend()
1449 llvm::Constant::getNullValue(RetTy->getElementType())); in GenerateMessageSend()
1454 std::pair<llvm::Value*,llvm::Value*> v = msgRet.getComplexVal(); in GenerateMessageSend()
1455 llvm::PHINode *phi = Builder.CreatePHI(v.first->getType(), 2); in GenerateMessageSend()
1457 phi->addIncoming(llvm::Constant::getNullValue(v.first->getType()), in GenerateMessageSend()
1459 llvm::PHINode *phi2 = Builder.CreatePHI(v.second->getType(), 2); in GenerateMessageSend()
1461 phi2->addIncoming(llvm::Constant::getNullValue(v.second->getType()), in GenerateMessageSend()
1471 llvm::Constant *CGObjCGNU::
1475 ArrayRef<llvm::Constant *> MethodTypes, in GenerateMethodList()
1480 llvm::StructType *ObjCMethodTy = llvm::StructType::get( in GenerateMethodList()
1485 std::vector<llvm::Constant*> Methods; in GenerateMethodList()
1486 std::vector<llvm::Constant*> Elements; in GenerateMethodList()
1489 llvm::Constant *Method = in GenerateMethodList()
1494 llvm::Constant *C = MakeConstantString(MethodSels[i].getAsString()); in GenerateMethodList()
1497 Method = llvm::ConstantExpr::getBitCast(Method, in GenerateMethodList()
1500 Methods.push_back(llvm::ConstantStruct::get(ObjCMethodTy, Elements)); in GenerateMethodList()
1504 llvm::ArrayType *ObjCMethodArrayTy = llvm::ArrayType::get(ObjCMethodTy, in GenerateMethodList()
1506 llvm::Constant *MethodArray = llvm::ConstantArray::get(ObjCMethodArrayTy, in GenerateMethodList()
1510 llvm::StructType *ObjCMethodListTy = llvm::StructType::create(VMContext); in GenerateMethodList()
1511 llvm::Type *NextPtrTy = llvm::PointerType::getUnqual(ObjCMethodListTy); in GenerateMethodList()
1519 Methods.push_back(llvm::ConstantPointerNull::get( in GenerateMethodList()
1520 llvm::PointerType::getUnqual(ObjCMethodListTy))); in GenerateMethodList()
1521 Methods.push_back(llvm::ConstantInt::get(Int32Ty, MethodTypes.size())); in GenerateMethodList()
1529 llvm::Constant *CGObjCGNU::
1530 GenerateIvarList(ArrayRef<llvm::Constant *> IvarNames, in GenerateIvarList()
1531 ArrayRef<llvm::Constant *> IvarTypes, in GenerateIvarList()
1532 ArrayRef<llvm::Constant *> IvarOffsets) { in GenerateIvarList()
1536 llvm::StructType *ObjCIvarTy = llvm::StructType::get( in GenerateIvarList()
1541 std::vector<llvm::Constant*> Ivars; in GenerateIvarList()
1542 std::vector<llvm::Constant*> Elements; in GenerateIvarList()
1548 Ivars.push_back(llvm::ConstantStruct::get(ObjCIvarTy, Elements)); in GenerateIvarList()
1552 llvm::ArrayType *ObjCIvarArrayTy = llvm::ArrayType::get(ObjCIvarTy, in GenerateIvarList()
1557 Elements.push_back(llvm::ConstantInt::get(IntTy, (int)IvarNames.size())); in GenerateIvarList()
1558 Elements.push_back(llvm::ConstantArray::get(ObjCIvarArrayTy, Ivars)); in GenerateIvarList()
1560 llvm::StructType *ObjCIvarListTy = llvm::StructType::get(IntTy, in GenerateIvarList()
1569 llvm::Constant *CGObjCGNU::GenerateClassStructure( in GenerateClassStructure()
1570 llvm::Constant *MetaClass, in GenerateClassStructure()
1571 llvm::Constant *SuperClass, in GenerateClassStructure()
1574 llvm::Constant *Version, in GenerateClassStructure()
1575 llvm::Constant *InstanceSize, in GenerateClassStructure()
1576 llvm::Constant *IVars, in GenerateClassStructure()
1577 llvm::Constant *Methods, in GenerateClassStructure()
1578 llvm::Constant *Protocols, in GenerateClassStructure()
1579 llvm::Constant *IvarOffsets, in GenerateClassStructure()
1580 llvm::Constant *Properties, in GenerateClassStructure()
1581 llvm::Constant *StrongIvarBitmap, in GenerateClassStructure()
1582 llvm::Constant *WeakIvarBitmap, in GenerateClassStructure()
1591 llvm::StructType *ClassTy = llvm::StructType::get( in GenerateClassStructure()
1613 llvm::Constant *Zero = llvm::ConstantInt::get(LongTy, 0); in GenerateClassStructure()
1615 std::vector<llvm::Constant*> Elements; in GenerateClassStructure()
1616 Elements.push_back(llvm::ConstantExpr::getBitCast(MetaClass, PtrToInt8Ty)); in GenerateClassStructure()
1620 Elements.push_back(llvm::ConstantInt::get(LongTy, info)); in GenerateClassStructure()
1622 llvm::DataLayout td(&TheModule); in GenerateClassStructure()
1624 llvm::ConstantInt::get(LongTy, in GenerateClassStructure()
1634 Elements.push_back(llvm::ConstantExpr::getBitCast(Protocols, PtrTy)); in GenerateClassStructure()
1636 Elements.push_back(llvm::ConstantInt::get(LongTy, 1)); in GenerateClassStructure()
1647 llvm::GlobalVariable *ClassRef = TheModule.getNamedGlobal(ClassSym); in GenerateClassStructure()
1648 llvm::Constant *Class = MakeGlobal(ClassTy, Elements, ClassSym, in GenerateClassStructure()
1649 llvm::GlobalValue::ExternalLinkage); in GenerateClassStructure()
1651 ClassRef->replaceAllUsesWith(llvm::ConstantExpr::getBitCast(Class, in GenerateClassStructure()
1659 llvm::Constant *CGObjCGNU::
1660 GenerateProtocolMethodList(ArrayRef<llvm::Constant *> MethodNames, in GenerateProtocolMethodList()
1661 ArrayRef<llvm::Constant *> MethodTypes) { in GenerateProtocolMethodList()
1663 llvm::StructType *ObjCMethodDescTy = llvm::StructType::get( in GenerateProtocolMethodList()
1667 std::vector<llvm::Constant*> Methods; in GenerateProtocolMethodList()
1668 std::vector<llvm::Constant*> Elements; in GenerateProtocolMethodList()
1673 Methods.push_back(llvm::ConstantStruct::get(ObjCMethodDescTy, Elements)); in GenerateProtocolMethodList()
1675 llvm::ArrayType *ObjCMethodArrayTy = llvm::ArrayType::get(ObjCMethodDescTy, in GenerateProtocolMethodList()
1677 llvm::Constant *Array = llvm::ConstantArray::get(ObjCMethodArrayTy, in GenerateProtocolMethodList()
1679 llvm::StructType *ObjCMethodDescListTy = llvm::StructType::get( in GenerateProtocolMethodList()
1682 Methods.push_back(llvm::ConstantInt::get(IntTy, MethodNames.size())); in GenerateProtocolMethodList()
1688 llvm::Constant *CGObjCGNU::GenerateProtocolList(ArrayRef<std::string>Protocols){ in GenerateProtocolList()
1689 llvm::ArrayType *ProtocolArrayTy = llvm::ArrayType::get(PtrToInt8Ty, in GenerateProtocolList()
1691 llvm::StructType *ProtocolListTy = llvm::StructType::get( in GenerateProtocolList()
1696 std::vector<llvm::Constant*> Elements; in GenerateProtocolList()
1699 llvm::Constant *protocol = nullptr; in GenerateProtocolList()
1700 llvm::StringMap<llvm::Constant*>::iterator value = in GenerateProtocolList()
1707 llvm::Constant *Ptr = llvm::ConstantExpr::getBitCast(protocol, in GenerateProtocolList()
1711 llvm::Constant * ProtocolArray = llvm::ConstantArray::get(ProtocolArrayTy, in GenerateProtocolList()
1715 Elements.push_back(llvm::ConstantInt::get(LongTy, Protocols.size())); in GenerateProtocolList()
1720 llvm::Value *CGObjCGNU::GenerateProtocolRef(CodeGenFunction &CGF, in GenerateProtocolRef()
1722 llvm::Value *protocol = ExistingProtocols[PD->getNameAsString()]; in GenerateProtocolRef()
1723 llvm::Type *T = in GenerateProtocolRef()
1725 return CGF.Builder.CreateBitCast(protocol, llvm::PointerType::getUnqual(T)); in GenerateProtocolRef()
1728 llvm::Constant *CGObjCGNU::GenerateEmptyProtocol( in GenerateEmptyProtocol()
1731 SmallVector<llvm::Constant*, 0> EmptyConstantVector; in GenerateEmptyProtocol()
1733 llvm::Constant *ProtocolList = GenerateProtocolList(EmptyStringVector); in GenerateEmptyProtocol()
1734 llvm::Constant *MethodList = in GenerateEmptyProtocol()
1738 llvm::StructType *ProtocolTy = llvm::StructType::get(IdTy, in GenerateEmptyProtocol()
1746 std::vector<llvm::Constant*> Elements; in GenerateEmptyProtocol()
1749 Elements.push_back(llvm::ConstantExpr::getIntToPtr( in GenerateEmptyProtocol()
1750 llvm::ConstantInt::get(Int32Ty, ProtocolVersion), IdTy)); in GenerateEmptyProtocol()
1771 SmallVector<llvm::Constant*, 16> InstanceMethodNames; in GenerateProtocol()
1772 SmallVector<llvm::Constant*, 16> InstanceMethodTypes; in GenerateProtocol()
1773 SmallVector<llvm::Constant*, 16> OptionalInstanceMethodNames; in GenerateProtocol()
1774 SmallVector<llvm::Constant*, 16> OptionalInstanceMethodTypes; in GenerateProtocol()
1789 SmallVector<llvm::Constant*, 16> ClassMethodNames; in GenerateProtocol()
1790 SmallVector<llvm::Constant*, 16> ClassMethodTypes; in GenerateProtocol()
1791 SmallVector<llvm::Constant*, 16> OptionalClassMethodNames; in GenerateProtocol()
1792 SmallVector<llvm::Constant*, 16> OptionalClassMethodTypes; in GenerateProtocol()
1807 llvm::Constant *ProtocolList = GenerateProtocolList(Protocols); in GenerateProtocol()
1808 llvm::Constant *InstanceMethodList = in GenerateProtocol()
1810 llvm::Constant *ClassMethodList = in GenerateProtocol()
1812 llvm::Constant *OptionalInstanceMethodList = in GenerateProtocol()
1815 llvm::Constant *OptionalClassMethodList = in GenerateProtocol()
1824 llvm::StructType *PropertyMetadataTy = llvm::StructType::get( in GenerateProtocol()
1827 std::vector<llvm::Constant*> Properties; in GenerateProtocol()
1828 std::vector<llvm::Constant*> OptionalProperties; in GenerateProtocol()
1833 std::vector<llvm::Constant*> Fields; in GenerateProtocol()
1841 llvm::Constant *TypeEncoding = MakeConstantString(TypeStr); in GenerateProtocol()
1852 llvm::Constant *TypeEncoding = MakeConstantString(TypeStr); in GenerateProtocol()
1861 OptionalProperties.push_back(llvm::ConstantStruct::get(PropertyMetadataTy, Fields)); in GenerateProtocol()
1863 Properties.push_back(llvm::ConstantStruct::get(PropertyMetadataTy, Fields)); in GenerateProtocol()
1866 llvm::Constant *PropertyArray = llvm::ConstantArray::get( in GenerateProtocol()
1867 llvm::ArrayType::get(PropertyMetadataTy, Properties.size()), Properties); in GenerateProtocol()
1868 llvm::Constant* PropertyListInitFields[] = in GenerateProtocol()
1869 {llvm::ConstantInt::get(IntTy, Properties.size()), NULLPtr, PropertyArray}; in GenerateProtocol()
1871 llvm::Constant *PropertyListInit = in GenerateProtocol()
1872 llvm::ConstantStruct::getAnon(PropertyListInitFields); in GenerateProtocol()
1873 llvm::Constant *PropertyList = new llvm::GlobalVariable(TheModule, in GenerateProtocol()
1874 PropertyListInit->getType(), false, llvm::GlobalValue::InternalLinkage, in GenerateProtocol()
1877 llvm::Constant *OptionalPropertyArray = in GenerateProtocol()
1878 llvm::ConstantArray::get(llvm::ArrayType::get(PropertyMetadataTy, in GenerateProtocol()
1880 llvm::Constant* OptionalPropertyListInitFields[] = { in GenerateProtocol()
1881 llvm::ConstantInt::get(IntTy, OptionalProperties.size()), NULLPtr, in GenerateProtocol()
1884 llvm::Constant *OptionalPropertyListInit = in GenerateProtocol()
1885 llvm::ConstantStruct::getAnon(OptionalPropertyListInitFields); in GenerateProtocol()
1886 llvm::Constant *OptionalPropertyList = new llvm::GlobalVariable(TheModule, in GenerateProtocol()
1888 llvm::GlobalValue::InternalLinkage, OptionalPropertyListInit, in GenerateProtocol()
1893 llvm::StructType *ProtocolTy = llvm::StructType::get(IdTy, in GenerateProtocol()
1903 std::vector<llvm::Constant*> Elements; in GenerateProtocol()
1906 Elements.push_back(llvm::ConstantExpr::getIntToPtr( in GenerateProtocol()
1907 llvm::ConstantInt::get(Int32Ty, ProtocolVersion), IdTy)); in GenerateProtocol()
1917 llvm::ConstantExpr::getBitCast(MakeGlobal(ProtocolTy, Elements, in GenerateProtocol()
1923 SmallVector<llvm::Constant*, 1> MethodTypes; in GenerateProtocolHolderCategory()
1925 std::vector<llvm::Constant*> Elements; in GenerateProtocolHolderCategory()
1931 Elements.push_back(llvm::ConstantExpr::getBitCast(GenerateMethodList( in GenerateProtocolHolderCategory()
1934 Elements.push_back(llvm::ConstantExpr::getBitCast(GenerateMethodList( in GenerateProtocolHolderCategory()
1937 llvm::ArrayType *ProtocolArrayTy = llvm::ArrayType::get(PtrTy, in GenerateProtocolHolderCategory()
1939 llvm::StructType *ProtocolListTy = llvm::StructType::get( in GenerateProtocolHolderCategory()
1944 std::vector<llvm::Constant*> ProtocolElements; in GenerateProtocolHolderCategory()
1945 for (llvm::StringMapIterator<llvm::Constant*> iter = in GenerateProtocolHolderCategory()
1948 llvm::Constant *Ptr = llvm::ConstantExpr::getBitCast(iter->getValue(), in GenerateProtocolHolderCategory()
1952 llvm::Constant * ProtocolArray = llvm::ConstantArray::get(ProtocolArrayTy, in GenerateProtocolHolderCategory()
1956 ProtocolElements.push_back(llvm::ConstantInt::get(LongTy, in GenerateProtocolHolderCategory()
1959 Elements.push_back(llvm::ConstantExpr::getBitCast(MakeGlobal(ProtocolListTy, in GenerateProtocolHolderCategory()
1961 Categories.push_back(llvm::ConstantExpr::getBitCast( in GenerateProtocolHolderCategory()
1962 MakeGlobal(llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, in GenerateProtocolHolderCategory()
1977 llvm::Constant *CGObjCGNU::MakeBitField(ArrayRef<bool> bits) { in MakeBitField()
1985 return llvm::ConstantInt::get(IntPtrTy, val); in MakeBitField()
1987 SmallVector<llvm::Constant *, 8> values; in MakeBitField()
1995 values.push_back(llvm::ConstantInt::get(Int32Ty, word)); in MakeBitField()
1997 llvm::ArrayType *arrayTy = llvm::ArrayType::get(Int32Ty, values.size()); in MakeBitField()
1998 llvm::Constant *array = llvm::ConstantArray::get(arrayTy, values); in MakeBitField()
1999 llvm::Constant *fields[2] = { in MakeBitField()
2000 llvm::ConstantInt::get(Int32Ty, values.size()), in MakeBitField()
2002 llvm::Constant *GS = MakeGlobal(llvm::StructType::get(Int32Ty, arrayTy, in MakeBitField()
2004 llvm::Constant *ptr = llvm::ConstantExpr::getPtrToInt(GS, IntPtrTy); in MakeBitField()
2013 SmallVector<llvm::Constant*, 16> InstanceMethodTypes; in GenerateCategory()
2023 SmallVector<llvm::Constant*, 16> ClassMethodTypes; in GenerateCategory()
2039 std::vector<llvm::Constant*> Elements; in GenerateCategory()
2043 Elements.push_back(llvm::ConstantExpr::getBitCast(GenerateMethodList( in GenerateCategory()
2047 Elements.push_back(llvm::ConstantExpr::getBitCast(GenerateMethodList( in GenerateCategory()
2051 Elements.push_back(llvm::ConstantExpr::getBitCast( in GenerateCategory()
2053 Categories.push_back(llvm::ConstantExpr::getBitCast( in GenerateCategory()
2054 MakeGlobal(llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, in GenerateCategory()
2058 llvm::Constant *CGObjCGNU::GeneratePropertyList(const ObjCImplementationDecl *OID, in GeneratePropertyList()
2060 SmallVectorImpl<llvm::Constant*> &InstanceMethodTypes) { in GeneratePropertyList()
2064 llvm::StructType *PropertyMetadataTy = llvm::StructType::get( in GeneratePropertyList()
2067 std::vector<llvm::Constant*> Properties; in GeneratePropertyList()
2072 std::vector<llvm::Constant*> Fields; in GeneratePropertyList()
2084 llvm::Constant *TypeEncoding = MakeConstantString(TypeStr); in GeneratePropertyList()
2098 llvm::Constant *TypeEncoding = MakeConstantString(TypeStr); in GeneratePropertyList()
2109 Properties.push_back(llvm::ConstantStruct::get(PropertyMetadataTy, Fields)); in GeneratePropertyList()
2111 llvm::ArrayType *PropertyArrayTy = in GeneratePropertyList()
2112 llvm::ArrayType::get(PropertyMetadataTy, Properties.size()); in GeneratePropertyList()
2113 llvm::Constant *PropertyArray = llvm::ConstantArray::get(PropertyArrayTy, in GeneratePropertyList()
2115 llvm::Constant* PropertyListInitFields[] = in GeneratePropertyList()
2116 {llvm::ConstantInt::get(IntTy, Properties.size()), NULLPtr, PropertyArray}; in GeneratePropertyList()
2118 llvm::Constant *PropertyListInit = in GeneratePropertyList()
2119 llvm::ConstantStruct::getAnon(PropertyListInitFields); in GeneratePropertyList()
2120 return new llvm::GlobalVariable(TheModule, PropertyListInit->getType(), false, in GeneratePropertyList()
2121 llvm::GlobalValue::InternalLinkage, PropertyListInit, in GeneratePropertyList()
2153 if (llvm::GlobalVariable *symbol = in GenerateClass()
2155 symbol->setInitializer(llvm::ConstantInt::get(LongTy, 0)); in GenerateClass()
2157 new llvm::GlobalVariable(TheModule, LongTy, false, in GenerateClass()
2158 llvm::GlobalValue::ExternalLinkage, llvm::ConstantInt::get(LongTy, 0), in GenerateClass()
2167 SmallVector<llvm::Constant*, 16> IvarNames; in GenerateClass()
2168 SmallVector<llvm::Constant*, 16> IvarTypes; in GenerateClass()
2169 SmallVector<llvm::Constant*, 16> IvarOffsets; in GenerateClass()
2171 std::vector<llvm::Constant*> IvarOffsetValues; in GenerateClass()
2197 llvm::Constant *OffsetValue = llvm::ConstantInt::get(IntTy, Offset); in GenerateClass()
2201 llvm::GlobalVariable *OffsetVar = TheModule.getGlobalVariable(OffsetName); in GenerateClass()
2207 OffsetVar->setLinkage(llvm::GlobalValue::ExternalLinkage); in GenerateClass()
2209 OffsetVar = new llvm::GlobalVariable(TheModule, IntTy, in GenerateClass()
2210 false, llvm::GlobalValue::ExternalLinkage, in GenerateClass()
2231 llvm::Constant *StrongIvarBitmap = MakeBitField(StrongIvars); in GenerateClass()
2232 llvm::Constant *WeakIvarBitmap = MakeBitField(WeakIvars); in GenerateClass()
2233 llvm::GlobalVariable *IvarOffsetArray = in GenerateClass()
2239 SmallVector<llvm::Constant*, 16> InstanceMethodTypes; in GenerateClass()
2247 llvm::Constant *Properties = GeneratePropertyList(OID, InstanceMethodSels, in GenerateClass()
2253 SmallVector<llvm::Constant*, 16> ClassMethodTypes; in GenerateClass()
2266 llvm::Constant *SuperClass; in GenerateClass()
2270 SuperClass = llvm::ConstantPointerNull::get(PtrToInt8Ty); in GenerateClass()
2273 SmallVector<llvm::Constant*, 1> empty; in GenerateClass()
2275 llvm::Constant *MethodList = GenerateMethodList(ClassName, "", in GenerateClass()
2277 llvm::Constant *ClassMethodList = GenerateMethodList(ClassName, "", in GenerateClass()
2279 llvm::Constant *IvarList = GenerateIvarList(IvarNames, IvarTypes, in GenerateClass()
2291 llvm::Type *IndexTy = Int32Ty; in GenerateClass()
2292 llvm::Constant *offsetPointerIndexes[] = {Zeros[0], in GenerateClass()
2293 llvm::ConstantInt::get(IndexTy, 1), nullptr, in GenerateClass()
2294 llvm::ConstantInt::get(IndexTy, 2) }; in GenerateClass()
2301 offsetPointerIndexes[2] = llvm::ConstantInt::get(IndexTy, ivarIndex); in GenerateClass()
2303 llvm::Constant *offsetValue = llvm::ConstantExpr::getGetElementPtr( in GenerateClass()
2304 cast<llvm::GlobalVariable>(IvarList)->getValueType(), IvarList, in GenerateClass()
2307 llvm::GlobalVariable *offset = TheModule.getNamedGlobal(Name); in GenerateClass()
2313 offset->setLinkage(llvm::GlobalValue::ExternalLinkage); in GenerateClass()
2316 offset = new llvm::GlobalVariable(TheModule, offsetValue->getType(), in GenerateClass()
2317 false, llvm::GlobalValue::ExternalLinkage, offsetValue, Name); in GenerateClass()
2322 llvm::Constant *ZeroPtr = llvm::ConstantInt::get(IntPtrTy, 0); in GenerateClass()
2324 llvm::Constant *MetaClassStruct = GenerateClassStructure(NULLPtr, in GenerateClass()
2330 llvm::Constant *ClassStruct = in GenerateClass()
2333 llvm::ConstantInt::get(LongTy, instanceSize), IvarList, in GenerateClass()
2340 llvm::ConstantExpr::getBitCast(ClassStruct, IdTy)); in GenerateClass()
2346 llvm::ConstantExpr::getBitCast(MetaClassStruct, IdTy)); in GenerateClass()
2352 ClassStruct = llvm::ConstantExpr::getBitCast(ClassStruct, PtrToInt8Ty); in GenerateClass()
2357 llvm::Function *CGObjCGNU::ModuleInitFunction() { in ModuleInitFunction()
2366 llvm::StructType *SelStructTy = dyn_cast<llvm::StructType>( in ModuleInitFunction()
2368 llvm::Type *SelStructPtrTy = SelectorTy; in ModuleInitFunction()
2370 SelStructTy = llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, nullptr); in ModuleInitFunction()
2371 SelStructPtrTy = llvm::PointerType::getUnqual(SelStructTy); in ModuleInitFunction()
2374 std::vector<llvm::Constant*> Elements; in ModuleInitFunction()
2375 llvm::Constant *Statics = NULLPtr; in ModuleInitFunction()
2378 llvm::ArrayType *StaticsArrayTy = llvm::ArrayType::get(PtrToInt8Ty, in ModuleInitFunction()
2388 Elements.push_back(llvm::ConstantArray::get(StaticsArrayTy, in ModuleInitFunction()
2390 llvm::StructType *StaticsListTy = in ModuleInitFunction()
2391 llvm::StructType::get(PtrToInt8Ty, StaticsArrayTy, nullptr); in ModuleInitFunction()
2392 llvm::Type *StaticsListPtrTy = in ModuleInitFunction()
2393 llvm::PointerType::getUnqual(StaticsListTy); in ModuleInitFunction()
2395 llvm::ArrayType *StaticsListArrayTy = in ModuleInitFunction()
2396 llvm::ArrayType::get(StaticsListPtrTy, 2); in ModuleInitFunction()
2399 Elements.push_back(llvm::Constant::getNullValue(StaticsListPtrTy)); in ModuleInitFunction()
2401 Statics = llvm::ConstantExpr::getBitCast(Statics, PtrTy); in ModuleInitFunction()
2404 llvm::ArrayType *ClassListTy = llvm::ArrayType::get(PtrToInt8Ty, in ModuleInitFunction()
2406 llvm::StructType *SymTabTy = llvm::StructType::get(LongTy, SelStructPtrTy, in ModuleInitFunction()
2407 llvm::Type::getInt16Ty(VMContext), in ModuleInitFunction()
2408 llvm::Type::getInt16Ty(VMContext), in ModuleInitFunction()
2413 std::vector<llvm::Constant*> Selectors; in ModuleInitFunction()
2414 std::vector<llvm::GlobalAlias*> SelectorAliases; in ModuleInitFunction()
2419 llvm::Constant *SelName = ExportUniqueString(SelNameStr, ".objc_sel_name"); in ModuleInitFunction()
2425 llvm::Constant *SelectorTypeEncoding = NULLPtr; in ModuleInitFunction()
2431 Selectors.push_back(llvm::ConstantStruct::get(SelStructTy, Elements)); in ModuleInitFunction()
2445 Selectors.push_back(llvm::ConstantStruct::get(SelStructTy, Elements)); in ModuleInitFunction()
2449 Elements.push_back(llvm::ConstantInt::get(LongTy, SelectorCount)); in ModuleInitFunction()
2450 llvm::GlobalVariable *SelectorList = in ModuleInitFunction()
2452 Elements.push_back(llvm::ConstantExpr::getBitCast(SelectorList, in ModuleInitFunction()
2458 llvm::Constant *Idxs[] = {Zeros[0], in ModuleInitFunction()
2459 llvm::ConstantInt::get(Int32Ty, i), Zeros[0]}; in ModuleInitFunction()
2461 llvm::Constant *SelPtr = llvm::ConstantExpr::getGetElementPtr( in ModuleInitFunction()
2465 SelPtr = llvm::ConstantExpr::getBitCast(SelPtr, SelectorTy); in ModuleInitFunction()
2471 Elements.push_back(llvm::ConstantInt::get(llvm::Type::getInt16Ty(VMContext), in ModuleInitFunction()
2474 Elements.push_back(llvm::ConstantInt::get(llvm::Type::getInt16Ty(VMContext), in ModuleInitFunction()
2481 llvm::Constant *ClassList = llvm::ConstantArray::get(ClassListTy, Classes); in ModuleInitFunction()
2484 llvm::Constant *SymTab= MakeGlobal(SymTabTy, Elements); in ModuleInitFunction()
2488 llvm::StructType * ModuleTy = llvm::StructType::get(LongTy, LongTy, in ModuleInitFunction()
2489 PtrToInt8Ty, llvm::PointerType::getUnqual(SymTabTy), in ModuleInitFunction()
2493 Elements.push_back(llvm::ConstantInt::get(LongTy, RuntimeVersion)); in ModuleInitFunction()
2495 llvm::DataLayout td(&TheModule); in ModuleInitFunction()
2497 llvm::ConstantInt::get(LongTy, in ModuleInitFunction()
2512 Elements.push_back(llvm::ConstantInt::get(IntTy, 2)); in ModuleInitFunction()
2516 Elements.push_back(llvm::ConstantInt::get(IntTy, 1)); in ModuleInitFunction()
2518 Elements.push_back(llvm::ConstantInt::get(IntTy, 0)); in ModuleInitFunction()
2521 Elements.push_back(llvm::ConstantInt::get(IntTy, 1)); in ModuleInitFunction()
2525 llvm::Value *Module = MakeGlobal(ModuleTy, Elements); in ModuleInitFunction()
2529 llvm::Function * LoadFunction = llvm::Function::Create( in ModuleInitFunction()
2530 llvm::FunctionType::get(llvm::Type::getVoidTy(VMContext), false), in ModuleInitFunction()
2531 llvm::GlobalValue::InternalLinkage, ".objc_load_function", in ModuleInitFunction()
2533 llvm::BasicBlock *EntryBB = in ModuleInitFunction()
2534 llvm::BasicBlock::Create(VMContext, "entry", LoadFunction); in ModuleInitFunction()
2538 llvm::FunctionType *FT = in ModuleInitFunction()
2539 llvm::FunctionType::get(Builder.getVoidTy(), in ModuleInitFunction()
2540 llvm::PointerType::getUnqual(ModuleTy), true); in ModuleInitFunction()
2541 llvm::Value *Register = CGM.CreateRuntimeFunction(FT, "__objc_exec_class"); in ModuleInitFunction()
2545 llvm::Type *ArgTypes[2] = {PtrTy, PtrToInt8Ty}; in ModuleInitFunction()
2546 llvm::FunctionType *RegisterAliasTy = in ModuleInitFunction()
2547 llvm::FunctionType::get(Builder.getVoidTy(), in ModuleInitFunction()
2549 llvm::Function *RegisterAlias = llvm::Function::Create( in ModuleInitFunction()
2551 llvm::GlobalValue::ExternalWeakLinkage, "class_registerAlias_np", in ModuleInitFunction()
2553 llvm::BasicBlock *AliasBB = in ModuleInitFunction()
2554 llvm::BasicBlock::Create(VMContext, "alias", LoadFunction); in ModuleInitFunction()
2555 llvm::BasicBlock *NoAliasBB = in ModuleInitFunction()
2556 llvm::BasicBlock::Create(VMContext, "no_alias", LoadFunction); in ModuleInitFunction()
2559 llvm::Value *HasRegisterAlias = Builder.CreateICmpNE(RegisterAlias, in ModuleInitFunction()
2560 llvm::Constant::getNullValue(RegisterAlias->getType())); in ModuleInitFunction()
2568 llvm::Constant *TheClass = in ModuleInitFunction()
2572 TheClass = llvm::ConstantExpr::getBitCast(TheClass, PtrTy); in ModuleInitFunction()
2588 llvm::Function *CGObjCGNU::GenerateMethod(const ObjCMethodDecl *OMD, in GenerateMethod()
2598 llvm::FunctionType *MethodTy = in GenerateMethod()
2603 llvm::Function *Method in GenerateMethod()
2604 = llvm::Function::Create(MethodTy, in GenerateMethod()
2605 llvm::GlobalValue::InternalLinkage, in GenerateMethod()
2611 llvm::Constant *CGObjCGNU::GetPropertyGetFunction() { in GetPropertyGetFunction()
2615 llvm::Constant *CGObjCGNU::GetPropertySetFunction() { in GetPropertySetFunction()
2619 llvm::Constant *CGObjCGNU::GetOptimizedPropertySetFunction(bool atomic, in GetOptimizedPropertySetFunction()
2624 llvm::Constant *CGObjCGNU::GetGetStructFunction() { in GetGetStructFunction()
2627 llvm::Constant *CGObjCGNU::GetSetStructFunction() { in GetSetStructFunction()
2630 llvm::Constant *CGObjCGNU::GetCppAtomicObjectGetFunction() { in GetCppAtomicObjectGetFunction()
2633 llvm::Constant *CGObjCGNU::GetCppAtomicObjectSetFunction() { in GetCppAtomicObjectSetFunction()
2637 llvm::Constant *CGObjCGNU::EnumerationMutationFunction() { in EnumerationMutationFunction()
2667 llvm::Value *ExceptionAsObject; in EmitThrowStmt()
2670 llvm::Value *Exception = CGF.EmitObjCThrowOperand(ThrowExpr); in EmitThrowStmt()
2678 llvm::CallSite Throw = in EmitThrowStmt()
2686 llvm::Value * CGObjCGNU::EmitObjCWeakRead(CodeGenFunction &CGF, in EmitObjCWeakRead()
2687 llvm::Value *AddrWeakObj) { in EmitObjCWeakRead()
2694 llvm::Value *src, llvm::Value *dst) { in EmitObjCWeakAssign()
2702 llvm::Value *src, llvm::Value *dst, in EmitObjCGlobalAssign()
2715 llvm::Value *src, llvm::Value *dst, in EmitObjCIvarAssign()
2716 llvm::Value *ivarOffset) { in EmitObjCIvarAssign()
2724 llvm::Value *src, llvm::Value *dst) { in EmitObjCStrongCastAssign()
2732 llvm::Value *DestPtr, in EmitGCMemmoveCollectable()
2733 llvm::Value *SrcPtr, in EmitGCMemmoveCollectable()
2734 llvm::Value *Size) { in EmitGCMemmoveCollectable()
2742 llvm::GlobalVariable *CGObjCGNU::ObjCIvarOffsetVariable( in ObjCIvarOffsetVariable()
2750 llvm::GlobalVariable *IvarOffsetPointer = TheModule.getNamedGlobal(Name); in ObjCIvarOffsetVariable()
2766 llvm::ConstantInt *OffsetGuess = llvm::ConstantInt::get(Int32Ty, Offset, in ObjCIvarOffsetVariable()
2773 llvm::GlobalVariable *IvarOffsetGV = new llvm::GlobalVariable(TheModule, in ObjCIvarOffsetVariable()
2775 llvm::GlobalValue::PrivateLinkage, OffsetGuess, Name+".guess"); in ObjCIvarOffsetVariable()
2776 IvarOffsetPointer = new llvm::GlobalVariable(TheModule, in ObjCIvarOffsetVariable()
2777 IvarOffsetGV->getType(), false, llvm::GlobalValue::LinkOnceAnyLinkage, in ObjCIvarOffsetVariable()
2780 IvarOffsetPointer = new llvm::GlobalVariable(TheModule, in ObjCIvarOffsetVariable()
2781 llvm::Type::getInt32PtrTy(VMContext), false, in ObjCIvarOffsetVariable()
2782 llvm::GlobalValue::ExternalLinkage, nullptr, Name); in ObjCIvarOffsetVariable()
2790 llvm::Value *BaseValue, in EmitObjCValueForIvar()
2815 llvm::Value *CGObjCGNU::EmitIvarOffset(CodeGenFunction &CGF, in EmitIvarOffset()
2827 llvm::Value *Offset = TheModule.getGlobalVariable(name); in EmitIvarOffset()
2829 Offset = new llvm::GlobalVariable(TheModule, IntTy, in EmitIvarOffset()
2830 false, llvm::GlobalValue::LinkOnceAnyLinkage, in EmitIvarOffset()
2831 llvm::Constant::getNullValue(IntTy), name); in EmitIvarOffset()
2838 return llvm::ConstantInt::get(PtrDiffTy, Offset, /*isSigned*/true); in EmitIvarOffset()