Home | History | Annotate | Download | only in CodeGen

Lines Matching refs:CGF

31 tryEmitARCRetainScalarExpr(CodeGenFunction &CGF, const Expr *e);
32 static RValue AdjustRelatedResultType(CodeGenFunction &CGF,
204 static RValue AdjustRelatedResultType(CodeGenFunction &CGF,
212 CGF.getContext().hasSameType(ExpT, Method->getResultType()) ||
217 return RValue::get(CGF.Builder.CreateBitCast(Result.getScalarVal(),
218 CGF.ConvertType(ExpT)));
409 void Emit(CodeGenFunction &CGF
410 const ObjCMethodDecl *method = cast<ObjCMethodDecl>(CGF.CurCodeDecl);
419 llvm::Value *self = CGF.LoadObjCSelf();
422 CGF.CGM.getObjCRuntime().GenerateMessageSendSuper(CGF, ReturnValueSlot(),
423 CGF.getContext().VoidTy,
473 static llvm::Value *emitARCRetainLoadOfScalar(CodeGenFunction &CGF,
486 static void emitStructGetterCall(CodeGenFunction &CGF, ObjCIvarDecl *ivar,
488 ASTContext &Context = CGF.getContext();
491 CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(), CGF.LoadObjCSelf(),
498 llvm::Value *dest = CGF.Builder.CreateBitCast(CGF.ReturnValue, CGF.VoidPtrTy);
501 src = CGF.Builder.CreateBitCast(src, CGF.VoidPtrTy);
504 CharUnits size = CGF.getContext().getTypeSizeInChars(ivar->getType());
505 args.add(RValue::get(CGF.CGM.getSize(size)), Context.getSizeType());
506 args.add(RValue::get(CGF.Builder.getInt1(isAtomic)), Context.BoolTy);
507 args.add(RValue::get(CGF.Builder.getInt1(hasStrong)), Context.BoolTy);
509 llvm::Value *fn = CGF.CGM.getObjCRuntime().GetGetStructFunction();
510 CGF.EmitCall(CGF.getTypes().arrangeFreeFunctionCall(Context.VoidTy, args,
753 static void emitCPPObjectAtomicGetterCall(CodeGenFunction &CGF,
762 args.add(RValue::get(returnAddr), CGF.getContext().VoidPtrTy);
766 CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(),
767 CGF.LoadObjCSelf(), ivar, 0).getAddress();
768 ivarAddr = CGF.Builder.CreateBitCast(ivarAddr, CGF.Int8PtrTy);
769 args.add(RValue::get(ivarAddr), CGF.getContext().VoidPtrTy);
772 args.add(RValue::get(AtomicHelperFn), CGF.getContext().VoidPtrTy);
775 CGF.CGM.getObjCRuntime().GetCppAtomicObjectGetFunction();
776 CGF.EmitCall(CGF.getTypes().arrangeFreeFunctionCall(CGF.getContext().VoidTy,
946 static void emitStructSetterCall(CodeGenFunction &CGF, ObjCMethodDecl *OMD,
953 llvm::Value *ivarAddr = CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(),
954 CGF.LoadObjCSelf(), ivar, 0)
956 ivarAddr = CGF.Builder.CreateBitCast(ivarAddr, CGF.Int8PtrTy);
957 args.add(RValue::get(ivarAddr), CGF.getContext().VoidPtrTy);
963 llvm::Value *argAddr = CGF.EmitLValue(&argRef).getAddress();
964 argAddr = CGF.Builder.CreateBitCast(argAddr, CGF.Int8PtrTy);
965 args.add(RValue::get(argAddr), CGF.getContext().VoidPtrTy);
969 CGF.CGM.getSize(CGF.getContext().getTypeSizeInChars(ivar->getType()));
970 args.add(RValue::get(size), CGF.getContext().getSizeType());
973 args.add(RValue::get(CGF.Builder.getTrue()), CGF.getContext().BoolTy);
977 args.add(RValue::get(CGF.Builder.getFalse()), CGF.getContext().BoolTy);
979 llvm::Value *copyStructFn = CGF.CGM.getObjCRuntime().GetSetStructFunction();
980 CGF.EmitCall(CGF.getTypes().arrangeFreeFunctionCall(CGF.getContext().VoidTy,
990 static void emitCPPObjectAtomicSetterCall(CodeGenFunction &CGF,
1000 CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(),
1001 CGF.LoadObjCSelf(), ivar, 0).getAddress();
1002 ivarAddr = CGF.Builder.CreateBitCast(ivarAddr, CGF.Int8PtrTy);
1003 args.add(RValue::get(ivarAddr), CGF.getContext().VoidPtrTy);
1009 llvm::Value *argAddr = CGF.EmitLValue(&argRef).getAddress();
1010 argAddr = CGF.Builder.CreateBitCast(argAddr, CGF.Int8PtrTy);
1011 args.add(RValue::get(argAddr), CGF.getContext().VoidPtrTy);
1014 args.add(RValue::get(AtomicHelperFn), CGF.getContext().VoidPtrTy);
1017 CGF.CGM.getObjCRuntime().GetCppAtomicObjectSetFunction();
1018 CGF.EmitCall(CGF.getTypes().arrangeFreeFunctionCall(CGF.getContext().VoidTy,
1267 void Emit(CodeGenFunction &CGF, Flags flags) {
1269 = CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(), addr, ivar, /*CVR*/ 0);
1270 CGF.emitDestroy(lvalue.getAddress(), ivar->getType(), destroyer,
1277 static void destroyARCStrongWithStore(CodeGenFunction &CGF,
1281 CGF.EmitARCStoreStrongCall(addr, null, /*ignored*/ true);
1284 static void emitCXXDestructMethod(CodeGenFunction &CGF,
1286 CodeGenFunction::RunCleanupsScope scope(CGF);
1288 llvm::Value *self = CGF.LoadObjCSelf();
1308 destroyer = CGF.getDestroyer(dtorKind);
1311 CleanupKind cleanupKind = CGF.getCleanupKind(dtorKind);
1313 CGF.EHStack.pushCleanup<DestroyIvar>(cleanupKind, self, ivar, destroyer,
1688 void Emit(CodeGenFunction &CGF, Flags flags) {
1690 CGF.EmitARCRelease(object, ARCImpreciseLifetime);
1735 static llvm::Value *emitARCValueOperation(CodeGenFunction &CGF,
1744 llvm::FunctionType::get(CGF.Int8PtrTy, CGF.Int8PtrTy, false);
1745 fn = createARCRuntimeFunction(CGF.CGM, fnType, fnName);
1750 value = CGF.Builder.CreateBitCast(value, CGF.Int8PtrTy);
1753 llvm::CallInst *call = CGF.EmitNounwindRuntimeCall(fn, value);
1758 return CGF.Builder.CreateBitCast(call, origType);
1763 static llvm::Value *emitARCLoadOperation(CodeGenFunction &CGF,
1769 llvm::FunctionType::get(CGF.Int8PtrTy, CGF.Int8PtrPtrTy, false);
1770 fn = createARCRuntimeFunction(CGF.CGM, fnType, fnName);
1775 addr = CGF.Builder.CreateBitCast(addr, CGF.Int8PtrPtrTy);
1778 llvm::Value *result = CGF.EmitNounwindRuntimeCall(fn, addr);
1781 if (origType != CGF.Int8PtrPtrTy)
1782 result = CGF.Builder.CreateBitCast(result,
1790 static llvm::Value *emitARCStoreOperation(CodeGenFunction &CGF,
1800 llvm::Type *argTypes[] = { CGF.Int8PtrPtrTy, CGF.Int8PtrTy };
1803 = llvm::FunctionType::get(CGF.Int8PtrTy, argTypes, false);
1804 fn = createARCRuntimeFunction(CGF.CGM, fnType, fnName);
1810 CGF.Builder.CreateBitCast(addr, CGF.Int8PtrPtrTy),
1811 CGF.Builder.CreateBitCast(value, CGF.Int8PtrTy)
1813 llvm::CallInst *result = CGF.EmitNounwindRuntimeCall(fn, args);
1817 return CGF.Builder.CreateBitCast(result, origType);
1822 static void emitARCCopyOperation(CodeGenFunction &CGF,
1830 llvm::Type *argTypes[] = { CGF.Int8PtrPtrTy, CGF.Int8PtrPtrTy };
1833 = llvm::FunctionType::get(CGF.Builder.getVoidTy(), argTypes, false);
1834 fn = createARCRuntimeFunction(CGF.CGM, fnType, fnName);
1838 CGF.Builder.CreateBitCast(dst, CGF.Int8PtrPtrTy),
1839 CGF.Builder.CreateBitCast(src, CGF.Int8PtrPtrTy)
1841 CGF.EmitNounwindRuntimeCall(fn, args);
2257 void CodeGenFunction::destroyARCStrongPrecise(CodeGenFunction &CGF,
2260 CGF.EmitARCDestroyStrong(addr, ARCPreciseLifetime);
2263 void CodeGenFunction::destroyARCStrongImprecise(CodeGenFunction &CGF,
2266 CGF.EmitARCDestroyStrong(addr, ARCImpreciseLifetime);
2269 void CodeGenFunction::destroyARCWeak(CodeGenFunction &CGF,
2272 CGF.EmitARCDestroyWeak(addr);
2281 void Emit(CodeGenFunction &CGF, Flags flags) {
2282 CGF.EmitObjCAutoreleasePoolPop(Token);
2290 void Emit(CodeGenFunction &CGF, Flags flags) {
2291 CGF.EmitObjCMRRAutoreleasePoolPop(Token);
2303 static TryEmitResult tryEmitARCRetainLoadOfScalar(CodeGenFunction &CGF,
2311 return TryEmitResult(CGF.EmitLoadOfLValue(lvalue).getScalarVal(),
2315 return TryEmitResult(CGF.EmitARCLoadWeakRetained(lvalue.getAddress()),
2322 static TryEmitResult tryEmitARCRetainLoadOfScalar(CodeGenFunction &CGF,
2334 LValue lv = CGF.EmitLValue(e);
2337 llvm::Value *result = CGF.EmitLoadOfLValue(lv).getScalarVal();
2340 CGF.EmitStoreOfScalar(getNullForVariable(lv.getAddress()), lv);
2348 if (CGF.getLangOpts().CPlusPlus &&
2353 return TryEmitResult(CGF.EmitScalarExpr(e), false);
2355 return tryEmitARCRetainLoadOfScalar(CGF, CGF.EmitLValue(e), type);
2358 static llvm::Value *emitARCRetainAfterCall(CodeGenFunction &CGF,
2363 static llvm::Value *emitARCRetainCall(CodeGenFunction &CGF, const Expr *e) {
2364 llvm::Value *value = CGF.EmitScalarExpr(e);
2365 return emitARCRetainAfterCall(CGF, value);
2368 static llvm::Value *emitARCRetainAfterCall(CodeGenFunction &CGF,
2371 CGBuilderTy::InsertPoint ip = CGF.Builder.saveIP();
2374 CGF.Builder.SetInsertPoint(call->getParent(),
2376 value = CGF.EmitARCRetainAutoreleasedReturnValue(value);
2378 CGF.Builder.restoreIP(ip);
2381 CGBuilderTy::InsertPoint ip = CGF.Builder.saveIP();
2385 CGF.Builder.SetInsertPoint(BB, BB->begin());
2386 value = CGF.EmitARCRetainAutoreleasedReturnValue(value);
2388 CGF.Builder.restoreIP(ip);
2395 operand = emitARCRetainAfterCall(CGF, operand);
2403 return CGF.EmitARCRetainNonBlock(value);
2446 static TryEmitResult tryEmitARCRetainPseudoObject(CodeGenFunction &CGF,
2469 result = tryEmitARCRetainScalarExpr(CGF, ov->getSourceExpr());
2470 opaqueData = OVMA::bind(CGF, ov, RValue::get(result.getPointer()));
2474 opaqueData = OVMA::bind(CGF, ov, ov->getSourceExpr());
2481 result = tryEmitARCRetainScalarExpr(CGF, semantic);
2485 CGF.EmitIgnoredExpr(semantic);
2491 opaques[i].unbind(CGF);
2497 tryEmitARCRetainScalarExpr(CodeGenFunction &CGF, const Expr *e) {
2521 = tryEmitARCRetainLoadOfScalar(CGF, ce->getSubExpr());
2524 value = CGF.Builder.CreateBitCast(value, resultType);
2538 resultType = CGF.ConvertType(ce->getType());
2546 llvm::Value *result = CGF.EmitScalarExpr(ce->getSubExpr());
2547 if (resultType) result = CGF.Builder.CreateBitCast(result, resultType);
2560 result = CGF.EmitScalarExpr(ce->getSubExpr());
2565 = tryEmitARCRetainScalarExpr(CGF, ce->getSubExpr());
2572 result = CGF.Builder.CreateBitCast(result, resultType);
2580 result = CGF.EmitARCRetainBlock(result, /*mandatory*/ true);
2581 if (resultType) result = CGF.Builder.CreateBitCast(result, resultType);
2588 llvm::Value *result = emitARCRetainCall(CGF, ce->getSubExpr());
2589 if (resultType) result = CGF.Builder.CreateBitCast(result, resultType);
2611 llvm::Value *result = emitARCRetainCall(CGF, e);
2612 if (resultType) result = CGF.Builder.CreateBitCast(result, resultType);
2618 = tryEmitARCRetainPseudoObject(CGF, pseudo);
2621 value = CGF.Builder.CreateBitCast(value, resultType);
2633 llvm::Value *result = CGF.EmitScalarExpr(e);
2634 if (resultType) result = CGF.Builder.CreateBitCast(result, resultType);
2638 static llvm::Value *emitARCRetainLoadOfScalar(CodeGenFunction &CGF,
2641 TryEmitResult result = tryEmitARCRetainLoadOfScalar(CGF, lvalue, type);
2644 value = CGF.EmitARCRetain(type, value);