Home | History | Annotate | Download | only in CodeGen

Lines Matching full:cgf

62   CodeGenFunction &CGF;
68 ScalarExprEmitter(CodeGenFunction &cgf, bool ira=false)
69 : CGF(cgf), Builder(CGF.Builder), IgnoreResultAssign(ira),
70 VMContext(cgf.getLLVMContext()) {
83 llvm::Type *ConvertType(QualType T) { return CGF.ConvertType(T); }
84 LValue EmitLValue(const Expr *E) { return CGF.EmitLValue(E); }
86 return CGF.EmitCheckedLValue(E, TCK);
93 return CGF.EmitLoadOfLValue(LV, Loc).getScalarVal();
123 Value *AlignmentValue = CGF.EmitScalarExpr(AVAttr->getAlignment());
125 CGF.EmitAlignmentAssumption(V, AlignmentCI->getZExtValue());
204 ApplyDebugLocation DL(CGF, E);
209 S->dump(CGF.getContext().getSourceManager());
249 llvm::Value *V = CGF.GetAddrOfLabel(E->getLabel());
258 return CGF.EmitPseudoObjectRValue(E).getScalarVal();
263 return EmitLoadOfLValue(CGF.getOpaqueLValueMapping(E), E->getExprLoc());
266 return CGF.getOpaqueRValueMapping(E).getScalarVal();
271 if (CodeGenFunction::ConstantEmission result = CGF.tryEmitAsConstant(E)) {
273 return EmitLoadOfLValue(result.getReferenceLValue(CGF, E),
281 return CGF.EmitObjCSelectorExpr(E);
284 return CGF.EmitObjCProtocolExpr(E);
293 return CGF.EmitObjCMessageExpr(E).getScalarVal();
297 LValue LV = CGF.EmitObjCIsaExpr(E);
298 Value *V = CGF.EmitLoadOfLValue(LV, E->getExprLoc()).getScalarVal();
317 CGF.CGM.EmitExplicitCastExprType(E, &CGF);
323 if (E->getCallReturnType(CGF.getContext())->isReferenceType())
326 Value *V = CGF.EmitCallExpr(E).getScalarVal();
362 return CGF.CGM.getMemberPointerConstant(E);
394 CodeGenFunction::CXXDefaultInitExprScope Scope(CGF);
398 return CGF.LoadCXXThis();
402 CGF.enterFullExpression(E);
403 CodeGenFunction::RunCleanupsScope Scope(CGF);
407 return CGF.EmitCXXNewExpr(E);
410 CGF.EmitCXXDeleteExpr(E);
432 CGF.EmitScalarExpr(E->getBase());
441 CGF.EmitCXXThrowExpr(E);
452 switch (CGF.getLangOpts().getSignedOverflowBehavior()) {
456 if (!CGF.SanOpts.has(SanitizerKind::SignedIntegerOverflow))
465 CGF.SanOpts.has(SanitizerKind::UnsignedIntegerOverflow))
556 return CGF.EmitObjCStringLiteral(E);
559 return CGF.EmitObjCBoxedExpr(E);
562 return CGF.EmitObjCArrayLiteral(E);
565 return CGF.EmitObjCDictionaryLiteral(E);
585 return CGF.CGM.getCXXABI().EmitMemberPointerIsNotNull(CGF, Src, MPT);
600 CodeGenFunction::SanitizerScope SanScope(&CGF);
614 APFloat::getLargest(CGF.getContext().getFloatTypeSemantics(DstType));
635 CGF.getContext().getFloatTypeSemantics(OrigSrcType);
640 unsigned Width = CGF.getContext().getIntWidth(DstType);
671 CGF.getContext().getFloatTypeSemantics(SrcType);
698 if (CGF.getContext().getFloatingTypeOrder(OrigSrcType, DstType) != 1)
705 CGF.getContext().getFloatTypeSemantics(DstType);
713 Value *AbsSrc = CGF.EmitNounwindRuntimeCall(
714 CGF.CGM.getIntrinsic(llvm::Intrinsic::fabs, Src->getType()), Src);
723 llvm::Constant *StaticArgs[] = {CGF.EmitCheckSourceLocation(Loc),
724 CGF.EmitCheckTypeDescriptor(OrigSrcType),
725 CGF.EmitCheckTypeDescriptor(DstType)};
726 CGF.EmitCheck(std::make_pair(Check, SanitizerKind::FloatCastOverflow),
742 SrcType = CGF.getContext().getCanonicalType(SrcType);
743 DstType = CGF.getContext().getCanonicalType(DstType);
759 if (SrcType->isHalfType() && !CGF.getContext().getLangOpts().NativeHalfType) {
762 if (!CGF.getContext().getLangOpts().HalfArgsAndReturns)
764 CGF.CGM.getIntrinsic(llvm::Intrinsic::convert_from_fp16, DstTy),
770 if (!CGF.getContext().getLangOpts().HalfArgsAndReturns) {
772 CGF.CGM.getIntrinsic(llvm::Intrinsic::convert_from_fp16,
773 CGF.CGM.FloatTy),
776 Src = Builder.CreateFPExt(Src, CGF.CGM.FloatTy, "conv");
778 SrcType = CGF.getContext().FloatTy;
779 SrcTy = CGF.FloatTy;
798 llvm::Type *MiddleTy = CGF.IntPtrTy;
836 if (CGF.SanOpts.has(SanitizerKind::FloatCastOverflow) &&
842 if (DstType->isHalfType() && !CGF.getContext().getLangOpts().NativeHalfType) {
847 if (!CGF.getContext().getLangOpts().HalfArgsAndReturns)
849 CGF.CGM.getIntrinsic(llvm::Intrinsic::convert_to_fp16, SrcTy), Src);
853 DstTy = CGF.FloatTy;
883 if (!CGF.getContext().getLangOpts().HalfArgsAndReturns) {
886 CGF.CGM.getIntrinsic(llvm::Intrinsic::convert_to_fp16, CGF.CGM.FloatTy),
920 return CGF.EmitFromMemory(CGF.CGM.EmitNullConstant(Ty), Ty);
929 assert(CGF.IsSanitizerScope);
938 StaticData.push_back(CGF.EmitCheckSourceLocation(Info.E->getExprLoc()));
942 StaticData.push_back(CGF.EmitCheckTypeDescriptor(UO->getType()));
950 CGF.EmitCheckTypeDescriptor(BO->getLHS()->getType()));
952 CGF.EmitCheckTypeDescriptor(BO->getRHS()->getType()));
956 StaticData.push_back(CGF.EmitCheckTypeDescriptor(Info.Ty));
965 StaticData.push_back(CGF.EmitCheckTypeDescriptor(Info.Ty));
971 CGF.EmitCheck(Checks, CheckName, StaticData, DynamicData);
979 CGF.ErrorUnsupported(E, "scalar expression");
982 return llvm::UndefValue::get(CGF.ConvertType(E->getType()));
988 Value *LHS = CGF.EmitScalarExpr(E->getExpr(0));
989 Value *RHS = CGF.EmitScalarExpr(E->getExpr(1));
1014 Value *IIndx = llvm::ConstantInt::get(CGF.SizeTy, i);
1023 Value* V1 = CGF.EmitScalarExpr(E->getExpr(0));
1024 Value* V2 = CGF.EmitScalarExpr(E->getExpr(1));
1028 llvm::APSInt Idx = E->getShuffleMaskIdx(CGF.getContext(), i-2);
1031 indices.push_back(llvm::UndefValue::get(CGF.Int32Ty));
1044 Value *Src = CGF.EmitScalarExpr(E->getSrcExpr());
1046 SrcType = CGF.getContext().getCanonicalType(SrcType);
1047 DstType = CGF.getContext().getCanonicalType(DstType);
1116 if (E->EvaluateAsInt(Value, CGF.getContext(), Expr::SE_AllowSideEffects)) {
1118 CGF.EmitScalarExpr(E->getBase());
1143 if (CGF.SanOpts.has(SanitizerKind::ArrayBounds))
1144 CGF.EmitBoundsCheck(E, E->getBase(), Idx, IdxTy, /*Accessed*/true);
1174 CGF.ErrorUnsupported(E, "GNU array range designator extension");
1218 Args.push_back(getAsInt32(C, CGF.Int32Ty));
1219 Args.resize(ResElts, llvm::UndefValue::get(CGF.Int32Ty));
1228 Args.push_back(getMaskElt(SVV, j, 0, CGF.Int32Ty));
1230 Args.resize(ResElts, llvm::UndefValue::get(CGF.Int32Ty));
1268 CGF.Int32Ty));
1274 Args.push_back(getMaskElt(SVI, j, Offset, CGF.Int32Ty));
1275 Args.resize(ResElts, llvm::UndefValue::get(CGF.Int32Ty));
1289 Args.resize(ResElts, llvm::UndefValue::get(CGF.Int32Ty));
1299 Args.resize(ResElts, llvm::UndefValue::get(CGF.Int32Ty));
1368 Addr = Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(DestTy));
1369 LValue LV = CGF.MakeAddrLValue(Addr, DestTy);
1386 if (CGF.SanOpts.has(SanitizerKind::CFIUnrelatedCast)) {
1388 CGF.EmitVTablePtrCheckForCast(PT->getPointeeType(), Src,
1413 Address Base = CGF.EmitPointerWithAlignment(E);
1415 CGF.GetAddressOfDerivedClass(Base, DerivedClassDecl,
1417 CGF.ShouldNullCheckClassCastValue(CE));
1421 if (CGF.sanitizePerformTypeCheck())
1422 CGF.EmitTypeCheck(CodeGenFunction::TCK_DowncastPointer, CE->getExprLoc(),
1425 if (CGF.SanOpts.has(SanitizerKind::CFIDerivedCast))
1426 CGF.EmitVTablePtrCheckForCast(DestTy->getPointeeType(),
1438 return CGF.EmitPointerWithAlignment(CE).getPointer();
1442 Address V = CGF.EmitPointerWithAlignment(E);
1444 return CGF.EmitDynamicCast(V, DCE);
1448 return CGF.EmitArrayToPointerDecay(E).getPointer();
1464 return CGF.CGM.getCXXABI().EmitNullMemberPointer(MPT);
1478 return CGF.CGM.getCXXABI().EmitMemberPointerConversion(CGF, CE, Src);
1482 return CGF.EmitARCRetainScalarExpr(E);
1484 return CGF.EmitObjCConsumeObject(E->getType(), Visit(E));
1486 return CGF.EmitARCReclaimReturnedObject(E, /*allowUnsafe*/ Ignored);
1488 return CGF.EmitARCExtendBlockObject(E);
1491 return CGF.EmitBlockCopyAndAutorelease(Visit(E), E->getType());
1504 assert(CGF.getContext().hasSameUnqualifiedType(E->getType(), DestTy));
1513 llvm::Type *MiddleTy = CGF.IntPtrTy;
1525 CGF.EmitIgnoredExpr(E);
1555 return CGF.CGM.getCXXABI().EmitMemberPointerIsNotNull(CGF, MemPtr, MPT);
1560 return CGF.EmitComplexExpr(E, false, true).first;
1564 CodeGenFunction::ComplexPairTy V = CGF.EmitComplexExpr(E);
1582 CodeGenFunction::StmtExprEvaluation eval(CGF);
1583 Address RetAlloca = CGF.EmitCompoundStmt(*E->getSubStmt(),
1587 return CGF.EmitLoadOfScalar(CGF.MakeAddrLValue(RetAlloca, E->getType()),
1612 switch (CGF.getLangOpts().getSignedOverflowBehavior()) {
1616 if (!CGF.SanOpts.has(SanitizerKind::SignedIntegerOverflow))
1639 llvm::Value *True = CGF.EmitToMemory(Builder.getTrue(), type);
1656 CGF.SanOpts.has(SanitizerKind::UnsignedIntegerOverflow)) &&
1657 CGF.getLangOpts().getSignedOverflowBehavior() !=
1663 llvm::Value *amt = CGF.EmitToMemory(
1673 llvm::BasicBlock *opBB = CGF.createBasicBlock("atomic_op", CGF.CurFn);
1674 value = CGF.EmitToMemory(value, type);
1700 CGF.IntTy->getIntegerBitWidth();
1704 CGF.SanOpts.has(SanitizerKind::UnsignedIntegerOverflow)) {
1718 = CGF.getContext().getAsVariableArrayType(type)) {
1719 llvm::Value *numElts = CGF.getVLASize(vla).first;
1721 if (CGF.getLangOpts().isSignedOverflowDefined())
1730 value = CGF.EmitCastToVoidPtr(value);
1731 if (CGF.getLangOpts().isSignedOverflowDefined())
1740 if (CGF.getLangOpts().isSignedOverflowDefined())
1764 if (type->isHalfType() && !CGF.getContext().getLangOpts().NativeHalfType) {
1766 if (!CGF.getContext().getLangOpts().HalfArgsAndReturns) {
1768 CGF.CGM.getIntrinsic(llvm::Intrinsic::convert_from_fp16,
1769 CGF.CGM.FloatTy),
1772 value = Builder.CreateFPExt(input, CGF.CGM.FloatTy, "incdec.conv");
1790 FS = &CGF.getTarget().getFloat128Format();
1792 FS = &CGF.getTarget().getHalfFormat();
1794 FS = &CGF.getTarget().getLongDoubleFormat();
1800 if (type->isHalfType() && !CGF.getContext().getLangOpts().NativeHalfType) {
1801 if (!CGF.getContext().getLangOpts().HalfArgsAndReturns) {
1803 CGF.CGM.getIntrinsic(llvm::Intrinsic::convert_to_fp16,
1804 CGF.CGM.FloatTy),
1814 value = CGF.EmitCastToVoidPtr(value);
1816 CharUnits size = CGF.getContext().getTypeSizeInChars(OPT->getObjectType());
1819 llvm::ConstantInt::get(CGF.SizeTy, size.getQuantity());
1821 if (CGF.getLangOpts().isSignedOverflowDefined())
1830 llvm::BasicBlock *contBB = CGF.createBasicBlock("atomic_cont", CGF.CurFn);
1831 auto Pair = CGF.EmitAtomicCompareExchange(
1833 llvm::Value *old = CGF.EmitToMemory(Pair.first.getScalarVal(), type);
1843 CGF.EmitStoreThroughBitfieldLValue(RValue::get(value), LV, &value);
1845 CGF.EmitStoreThroughLValue(RValue::get(value), LV);
1891 Value *BoolVal = CGF.EvaluateExprAsBool(E->getSubExpr());
1905 if (E->EvaluateAsInt(Value, CGF.getContext()))
1920 llvm::Value* Idx = CGF.EmitScalarExpr(IdxExpr);
1926 CGF.getContext().getAsArrayType(CurrentType)->getElementType();
1930 CGF.getContext().getTypeSizeInChars(CurrentType).getQuantity());
1940 const ASTRecordLayout &RL = CGF.getContext().getASTRecordLayout(RD);
1955 CGF.getContext().getCharWidth();
1968 CGF.ErrorUnsupported(E, "virtual base in offsetof");
1973 const ASTRecordLayout &RL = CGF.getContext().getASTRecordLayout(RD);
1999 CGF.getContext().getAsVariableArrayType(TypeToSize)) {
2002 CGF.EmitVariablyModifiedType(TypeToSize);
2006 CGF.EmitIgnoredExpr(E->getArgumentExpr());
2011 std::tie(numElts, eltType) = CGF.getVLASize(VAT);
2016 CharUnits eltSize = CGF.getContext().getTypeSizeInChars(eltType);
2018 size = CGF.Builder.CreateNUWMul(CGF.CGM.getSize(eltSize), numElts);
2024 CGF.getContext()
2025 .toCharUnitsFromBits(CGF.getContext().getOpenMPDefaultSimdAlign(
2028 return llvm::ConstantInt::get(CGF.SizeTy, Alignment);
2033 return Builder.getInt(E->EvaluateKnownConstInt(CGF.getContext()));
2043 return CGF.EmitLoadOfLValue(CGF.EmitLValue(E),
2047 return CGF.EmitComplexExpr(Op, false, true).first;
2060 return CGF.EmitLoadOfLValue(CGF.EmitLValue(E),
2064 return CGF.EmitComplexExpr(Op, true, false).second;
2070 CGF.EmitLValue(Op);
2072 CGF.EmitScalarExpr(Op, true);
2100 return CGF.EmitScalarCompoundAssignWithComplex(E, Result);
2117 CGF.SanOpts.has(SanitizerKind::UnsignedIntegerOverflow)) &&
2118 CGF.getLangOpts().getSignedOverflowBehavior() !=
2147 llvm::Value *amt = CGF.EmitToMemory(
2159 llvm::BasicBlock *opBB = CGF.createBasicBlock("atomic_op", CGF.CurFn);
2161 OpInfo.LHS = CGF.EmitToMemory(OpInfo.LHS, type);
2184 llvm::BasicBlock *contBB = CGF.createBasicBlock("atomic_cont", CGF.CurFn);
2185 auto Pair = CGF.EmitAtomicCompareExchange(
2187 llvm::Value *old = CGF.EmitToMemory(Pair.first.getScalarVal(), LHSTy);
2200 CGF.EmitStoreThroughBitfieldLValue(RValue::get(Result), LHSLV, &Result);
2202 CGF.EmitStoreThroughLValue(RValue::get(Result), LHSLV);
2218 if (!CGF.getLangOpts().CPlusPlus)
2233 if (CGF.SanOpts.has(SanitizerKind::IntegerDivideByZero)) {
2238 if (CGF.SanOpts.has(SanitizerKind::SignedIntegerOverflow) &&
2259 CodeGenFunction::SanitizerScope SanScope(&CGF);
2260 if ((CGF.SanOpts.has(SanitizerKind::IntegerDivideByZero) ||
2261 CGF.SanOpts.has(SanitizerKind::SignedIntegerOverflow)) &&
2265 } else if (CGF.SanOpts.has(SanitizerKind::FloatDivideByZero) &&
2276 if (CGF.getLangOpts().OpenCL) {
2282 CGF.SetFPAccuracy(Val, 2.5);
2294 if (CGF.SanOpts.has(SanitizerKind::IntegerDivideByZero)) {
2295 CodeGenFunction::SanitizerScope SanScope(&CGF);
2339 llvm::Type *opTy = CGF.CGM.getTypes().ConvertType(Ops.Ty);
2341 llvm::Function *intrinsic = CGF.CGM.getIntrinsic(IID, opTy);
2349 &CGF.getLangOpts().OverflowHandler;
2353 if (!isSigned || CGF.SanOpts.has(SanitizerKind::SignedIntegerOverflow)) {
2354 CodeGenFunction::SanitizerScope SanScope(&CGF);
2360 CGF.EmitTrapCheck(Builder.CreateNot(overflow));
2367 llvm::BasicBlock *continueBB = CGF.createBasicBlock("nooverflow", CGF.CurFn,
2369 llvm::BasicBlock *overflowBB = CGF.createBasicBlock("overflow", CGF.CurFn);
2378 llvm::Type *Int8Ty = CGF.Int8Ty;
2379 llvm::Type *argTypes[] = { CGF.Int64Ty, CGF.Int64Ty, Int8Ty, Int8Ty };
2381 llvm::FunctionType::get(CGF.Int64Ty, argTypes, true);
2382 llvm::Value *handler = CGF.CGM.CreateRuntimeFunction(handlerTy, *handlerName);
2386 llvm::Value *lhs = Builder.CreateSExt(Ops.LHS, CGF.Int64Ty);
2387 llvm::Value *rhs = Builder.CreateSExt(Ops.RHS, CGF.Int64Ty);
2398 CGF.EmitNounwindRuntimeCall(handler, handlerArgs);
2413 static Value *emitPointerArithmetic(CodeGenFunction &CGF,
2432 if (width != CGF.PointerWidthInBits) {
2436 index = CGF.Builder.CreateIntCast(index, CGF.PtrDiffTy, isSigned,
2442 index = CGF.Builder.CreateNeg(index, "idx.neg");
2444 if (CGF.SanOpts.has(SanitizerKind::ArrayBounds))
2445 CGF.EmitBoundsCheck(op.E, pointerOperand, index, indexOperand->getType(),
2455 = CGF.CGM.getSize(CGF.getContext().getTypeSizeInChars(objectType));
2457 index = CGF.Builder.CreateMul(index, objectSize);
2459 Value *result = CGF.Builder.CreateBitCast(pointer, CGF.VoidPtrTy);
2460 result = CGF.Builder.CreateGEP(result, index, "add.ptr");
2461 return CGF.Builder.CreateBitCast(result, pointer->getType());
2466 = CGF.getContext().getAsVariableArrayType(elementType)) {
2468 llvm::Value *numElements = CGF.getVLASize(vla).first;
2474 if (CGF.getLangOpts().isSignedOverflowDefined()) {
2475 index = CGF.Builder.CreateMul(index, numElements, "vla.index");
2476 pointer = CGF.Builder.CreateGEP(pointer, index, "add.ptr");
2478 index = CGF.Builder.CreateNSWMul(index, numElements, "vla.index");
2479 pointer = CGF.Builder.CreateInBoundsGEP(pointer, index, "add.ptr");
2488 Value *result = CGF.Builder.CreateBitCast(pointer, CGF.VoidPtrTy);
2489 result = CGF.Builder.CreateGEP(result, index, "add.ptr");
2490 return CGF.Builder.CreateBitCast(result, pointer->getType());
2493 if (CGF.getLangOpts().isSignedOverflowDefined())
2494 return CGF.Builder.CreateGEP(pointer, index, "add.ptr");
2496 return CGF.Builder.CreateInBoundsGEP(pointer, index, "add.ptr");
2505 const CodeGenFunction &CGF, CGBuilderTy &Builder,
2524 CGF.CGM.getIntrinsic(llvm::Intrinsic::fmuladd, Addend->getType()),
2538 CGF, CGBuilderTy &Builder,
2551 if (CGF.CGM.getCodeGenOpts().getFPContractMode() != CodeGenOptions::FPC_On)
2560 return buildFMulAdd(LHSBinOp, op.RHS, CGF, Builder, false, isSub);
2565 return buildFMulAdd(RHSBinOp, op.LHS, CGF, Builder, isSub, false);
2574 return emitPointerArithmetic(CGF, op, /*subtraction*/ false);
2577 switch (CGF.getLangOpts().getSignedOverflowBehavior()) {
2581 if (!CGF.SanOpts.has(SanitizerKind::SignedIntegerOverflow))
2590 CGF.SanOpts.has(SanitizerKind::UnsignedIntegerOverflow))
2595 if (Value *FMulAdd = tryEmitFMulAdd(op, CGF, Builder))
2608 switch (CGF.getLangOpts().getSignedOverflowBehavior()) {
2612 if (!CGF.SanOpts.has(SanitizerKind::SignedIntegerOverflow))
2621 CGF.SanOpts.has(SanitizerKind::UnsignedIntegerOverflow))
2626 if (Value *FMulAdd = tryEmitFMulAdd(op, CGF, Builder, true))
2637 return emitPointerArithmetic(CGF, op, /*subtraction*/ true);
2643 = Builder.CreatePtrToInt(op.LHS, CGF.PtrDiffTy, "sub.ptr.lhs.cast");
2645 = Builder.CreatePtrToInt(op.RHS, CGF.PtrDiffTy, "sub.ptr.rhs.cast");
2656 = CGF.getContext().getAsVariableArrayType(elementType)) {
2658 std::tie(numElements, elementType) = CGF.getVLASize(vla);
2663 CharUnits eltSize = CGF.getContext().getTypeSizeInChars(elementType);
2665 divisor = CGF.Builder.CreateNUWMul(CGF.CGM.getSize(eltSize), divisor);
2677 elementSize = CGF.getContext().getTypeSizeInChars(elementType);
2683 divisor = CGF.CGM.getSize(elementSize);
2708 bool SanitizeBase = CGF.SanOpts.has(SanitizerKind::ShiftBase) &&
2710 bool SanitizeExponent = CGF.SanOpts.has(SanitizerKind::ShiftExponent);
2712 if (CGF.getLangOpts().OpenCL)
2717 CodeGenFunction::SanitizerScope SanScope(&CGF);
2732 llvm::BasicBlock *Cont = CGF.createBasicBlock("cont");
2733 llvm::BasicBlock *CheckShiftBase = CGF.createBasicBlock("check");
2735 CGF.EmitBlock(CheckShiftBase);
2741 if (CGF.getLangOpts().CPlusPlus) {
2751 CGF.EmitBlock(Cont);
2773 if (CGF.getLangOpts().OpenCL)
2776 else if (CGF.SanOpts.has(SanitizerKind::ShiftExponent) &&
2778 CodeGenFunction::SanitizerScope SanScope(&CGF);
2834 Value *LHS = CGF.EmitScalarExpr(E->getLHS());
2835 Value *RHS = CGF.EmitScalarExpr(E->getRHS());
2836 Result = CGF.CGM.getCXXABI().EmitMemberPointerComparison(
2837 CGF, LHS, RHS, MPT, E->getOpcode() == BO_NE);
2902 llvm::Function *F = CGF.CGM.getIntrinsic(ID);
2904 return EmitScalarConversion(Result, CGF.getContext().BoolTy, E->getType(),
2927 LHS = CGF.EmitComplexExpr(E->getLHS());
2935 RHS = CGF.EmitComplexExpr(E->getRHS());
2936 assert(CGF.getContext().hasSameUnqualifiedType(CETy,
2943 CGF.getContext().hasSameUnqualifiedType(CETy, RHSTy) &&
2967 return EmitScalarConversion(Result, CGF.getContext().BoolTy, E->getType(),
2979 std::tie(LHS, RHS) = CGF.EmitARCStoreStrong(E, Ignore);
2983 std::tie(LHS, RHS) = CGF.EmitARCStoreAutoreleasing(E);
2987 std::tie(LHS, RHS) = CGF.EmitARCStoreUnsafeUnretained(E, Ignore);
2993 RHS = CGF.EmitARCStoreWeak(LHS.getAddress(), RHS, Ignore);
3007 CGF.EmitStoreThroughBitfieldLValue(RValue::get(RHS), LHS, &RHS);
3009 CGF.EmitStoreThroughLValue(RValue::get(RHS), LHS);
3017 if (!CGF.getLangOpts().CPlusPlus)
3031 CGF.incrementProfileCounter(E);
3052 if (CGF.ConstantFoldsToSimpleInteger(E->getLHS(), LHSCondVal)) {
3054 CGF.incrementProfileCounter(E);
3056 Value *RHSCond = CGF.EvaluateExprAsBool(E->getRHS());
3062 if (!CGF.ContainsLabel(E->getRHS()))
3066 llvm::BasicBlock *ContBlock = CGF.createBasicBlock("land.end");
3067 llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("land.rhs");
3069 CodeGenFunction::ConditionalEvaluation eval(CGF);
3072 CGF.EmitBranchOnBoolExpr(E->getLHS(), RHSBlock, ContBlock,
3073 CGF.getProfileCount(E->getRHS()));
3084 eval.begin(CGF);
3085 CGF.EmitBlock(RHSBlock);
3086 CGF.incrementProfileCounter(E);
3087 Value *RHSCond = CGF.EvaluateExprAsBool(E->getRHS());
3088 eval.end(CGF);
3096 auto NL = ApplyDebugLocation::CreateEmpty(CGF);
3097 CGF.EmitBlock(ContBlock);
3109 CGF.incrementProfileCounter(E);
3130 if (CGF.ConstantFoldsToSimpleInteger(E->getLHS(), LHSCondVal)) {
3132 CGF.incrementProfileCounter(E);
3134 Value *RHSCond = CGF.EvaluateExprAsBool(E->getRHS());
3140 if (!CGF.ContainsLabel(E->getRHS()))
3144 llvm::BasicBlock *ContBlock = CGF.createBasicBlock("lor.end");
3145 llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("lor.rhs");
3147 CodeGenFunction::ConditionalEvaluation eval(CGF);
3150 CGF.EmitBranchOnBoolExpr(E->getLHS(), ContBlock, RHSBlock,
3151 CGF.getCurrentProfileCount() -
3152 CGF.getProfileCount(E->getRHS()));
3163 eval.begin(CGF);
3166 CGF.EmitBlock(RHSBlock);
3167 CGF.incrementProfileCounter(E);
3168 Value *RHSCond = CGF.EvaluateExprAsBool(E->getRHS());
3170 eval.end(CGF);
3177 CGF.EmitBlock(ContBlock);
3185 CGF.EmitIgnoredExpr(E->getLHS());
3186 CGF.EnsureInsertPoint();
3199 CodeGenFunction &CGF) {
3201 return E->IgnoreParens()->isEvaluatable(CGF.getContext());
3217 CodeGenFunction::OpaqueValueMapping binding(CGF, E);
3226 if (CGF.ConstantFoldsToSimpleInteger(condExpr, CondExprBool)) {
3231 if (!CGF.ContainsLabel(dead)) {
3233 CGF.incrementProfileCounter(E);
3240 Result = llvm::UndefValue::get(CGF.ConvertType(E->getType()));
3248 if (CGF.getLangOpts().OpenCL
3250 CGF.incrementProfileCounter(E);
3252 llvm::Value *CondV = CGF.EmitScalarExpr(condExpr);
3293 if (isCheapEnoughToEvaluateUnconditionally(lhsExpr, CGF) &&
3294 isCheapEnoughToEvaluateUnconditionally(rhsExpr, CGF)) {
3295 CGF.incrementProfileCounter(E);
3297 llvm::Value *CondV = CGF.EvaluateExprAsBool(condExpr);
3308 llvm::BasicBlock *LHSBlock = CGF.createBasicBlock("cond.true");
3309 llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("cond.false");
3310 llvm::BasicBlock *ContBlock = CGF.createBasicBlock("cond.end");
3312 CodeGenFunction::ConditionalEvaluation eval(CGF);
3313 CGF.EmitBranchOnBoolExpr(condExpr, LHSBlock, RHSBlock,
3314 CGF.getProfileCount(lhsExpr));
3316 CGF.EmitBlock(LHSBlock);
3317 CGF.incrementProfileCounter(E);
3318 eval.begin(CGF);
3320 eval.end(CGF);
3325 CGF.EmitBlock(RHSBlock);
3326 eval.begin(CGF);
3328 eval.end(CGF);
3331 CGF.EmitBlock(ContBlock);
3354 CGF.EmitVariablyModifiedType(Ty);
3357 Address ArgPtr = CGF.EmitVAArg(VE, ArgValue);
3363 CGF.ErrorUnsupported(VE, "va_arg expression");
3382 return CGF.EmitBlockLiteral(block);
3386 static Value *ConvertVec3AndVec4(CGBuilderTy &Builder, CodeGenFunction &CGF,
3394 Args.push_back(llvm::UndefValue::get(CGF.Int32Ty));
3400 Value *Src = CGF.EmitScalarExpr(E->getSrcExpr());
3412 Src = ConvertVec3AndVec4(Builder, CGF, Src, 4);
3424 Src = ConvertVec3AndVec4(Builder, CGF, Src, 3);
3433 return CGF.EmitAtomicExpr(E).getScalarVal();