Lines Matching defs:Value
36 using llvm::Value;
44 Value *LHS;
45 Value *RHS;
59 : public StmtVisitor<ScalarExprEmitter, Value*> {
87 Value *EmitLoadOfLValue(LValue LV) {
94 Value *EmitLoadOfLValue(const Expr *E) {
100 Value *EmitConversionToBool(Value *Src, QualType DstTy);
104 Value *EmitScalarConversion(Value *Src, QualType SrcTy, QualType DstTy);
109 Value *EmitComplexToScalarConversion(CodeGenFunction::ComplexPairTy Src,
113 Value *EmitNullValue(QualType Ty);
116 Value *EmitFloatToBoolConversion(Value *V) {
118 llvm::Value *Zero = llvm::Constant::getNullValue(V->getType());
123 Value *EmitPointerToBoolConversion(Value *V) {
124 Value *Zero = llvm::ConstantPointerNull::get(
129 Value *EmitIntToBoolConversion(Value *V) {
135 Value *Result = ZI->getOperand(0);
152 Value *Visit(Expr *E) {
153 return StmtVisitor<ScalarExprEmitter, Value*>::Visit(E);
156 Value *VisitStmt(Stmt *S) {
160 Value *VisitExpr(Expr *S);
162 Value *VisitParenExpr(ParenExpr *PE) {
165 Value *VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *E) {
168 Value *VisitGenericSelectionExpr(GenericSelectionExpr *GE) {
173 Value *VisitIntegerLiteral(const IntegerLiteral *E) {
176 Value *VisitFloatingLiteral(const FloatingLiteral *E) {
179 Value *VisitCharacterLiteral(const CharacterLiteral *E) {
182 Value *VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *E) {
185 Value *VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *E) {
188 Value *VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *E) {
191 Value *VisitGNUNullExpr(const GNUNullExpr *E) {
194 Value *VisitOffsetOfExpr(OffsetOfExpr *E);
195 Value *VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *E);
196 Value *VisitAddrLabelExpr(const AddrLabelExpr *E) {
197 llvm::Value *V = CGF.GetAddrOfLabel(E->getLabel());
201 Value *VisitSizeOfPackExpr(SizeOfPackExpr *E) {
205 Value *VisitPseudoObjectExpr(PseudoObjectExpr *E) {
209 Value *VisitOpaqueValueExpr(OpaqueValueExpr *E) {
218 Value *VisitDeclRefExpr(DeclRefExpr *E) {
227 Value *VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
230 Value *VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
233 Value *VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
236 Value *VisitObjCMessageExpr(ObjCMessageExpr *E) {
243 Value *VisitObjCIsaExpr(ObjCIsaExpr *E) {
245 Value *V = CGF.EmitLoadOfLValue(LV).getScalarVal();
249 Value *VisitArraySubscriptExpr(ArraySubscriptExpr *E);
250 Value *VisitShuffleVectorExpr(ShuffleVectorExpr *E);
251 Value *VisitMemberExpr(MemberExpr *E);
252 Value *VisitExtVectorElementExpr(Expr *E) { return EmitLoadOfLValue(E); }
253 Value *VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
257 Value *VisitInitListExpr(InitListExpr *E);
259 Value *VisitImplicitValueInitExpr(const ImplicitValueInitExpr *E) {
262 Value *VisitExplicitCastExpr(ExplicitCastExpr *E) {
267 Value *VisitCastExpr(CastExpr *E);
269 Value *VisitCallExpr(const CallExpr *E) {
276 Value *VisitStmtExpr(const StmtExpr *E);
279 Value *VisitUnaryPostDec(const UnaryOperator *E) {
283 Value *VisitUnaryPostInc(const UnaryOperator *E) {
287 Value *VisitUnaryPreDec(const UnaryOperator *E) {
291 Value *VisitUnaryPreInc(const UnaryOperator *E) {
296 llvm::Value *EmitAddConsiderOverflowBehavior(const UnaryOperator *E,
297 llvm::Value *InVal,
298 llvm::Value *NextVal,
301 llvm::Value *EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
305 Value *VisitUnaryAddrOf(const UnaryOperator *E) {
311 Value *VisitUnaryDeref(const UnaryOperator *E) {
316 Value *VisitUnaryPlus(const UnaryOperator *E) {
321 Value *VisitUnaryMinus (const UnaryOperator *E);
322 Value *VisitUnaryNot (const UnaryOperator *E);
323 Value *VisitUnaryLNot (const UnaryOperator *E);
324 Value *VisitUnaryReal (const UnaryOperator *E);
325 Value *VisitUnaryImag (const UnaryOperator *E);
326 Value *VisitUnaryExtension(const UnaryOperator *E) {
331 Value *VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *E) {
335 Value *VisitCXXDefaultArgExpr(CXXDefaultArgExpr *DAE) {
338 Value *VisitCXXThisExpr(CXXThisExpr *TE) {
342 Value *VisitExprWithCleanups(ExprWithCleanups *E) {
347 Value *VisitCXXNewExpr(const CXXNewExpr *E) {
350 Value *VisitCXXDeleteExpr(const CXXDeleteExpr *E) {
354 Value *VisitUnaryTypeTraitExpr(const UnaryTypeTraitExpr *E) {
358 Value *VisitBinaryTypeTraitExpr(const BinaryTypeTraitExpr *E) {
362 Value *VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *E) {
366 Value *VisitExpressionTraitExpr(const ExpressionTraitExpr *E) {
370 Value *VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *E) {
380 Value *VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *E) {
384 Value *VisitCXXThrowExpr(const CXXThrowExpr *E) {
389 Value *VisitCXXNoexceptExpr(const CXXNoexceptExpr *E) {
394 Value *EmitMul(const BinOpInfo &Ops) {
418 Value *EmitOverflowCheckedBinOp(const BinOpInfo &Ops);
422 llvm::Value *Zero,bool isDiv);
423 Value *EmitDiv(const BinOpInfo &Ops);
424 Value *EmitRem(const BinOpInfo &Ops);
425 Value *EmitAdd(const BinOpInfo &Ops);
426 Value *EmitSub(const BinOpInfo &Ops);
427 Value *EmitShl(const BinOpInfo &Ops);
428 Value *EmitShr(const BinOpInfo &Ops);
429 Value *EmitAnd(const BinOpInfo &Ops) {
432 Value *EmitXor(const BinOpInfo &Ops) {
435 Value *EmitOr (const BinOpInfo &Ops) {
441 Value *(ScalarExprEmitter::*F)(const BinOpInfo &),
442 Value *&Result);
444 Value *EmitCompoundAssign(const CompoundAssignOperator *E,
445 Value *(ScalarExprEmitter::*F)(const BinOpInfo &));
449 Value *VisitBin ## OP(const BinaryOperator *E) { \
452 Value *VisitBin ## OP ## Assign(const CompoundAssignOperator *E) { \
468 Value *EmitCompare(const BinaryOperator *E, unsigned UICmpOpc,
471 Value *VisitBin##CODE(const BinaryOperator *E) { \
482 Value *VisitBinAssign (const BinaryOperator *E);
484 Value *VisitBinLAnd (const BinaryOperator *E);
485 Value *VisitBinLOr (const BinaryOperator *E);
486 Value *VisitBinComma (const BinaryOperator *E);
488 Value *VisitBinPtrMemD(const Expr *E) { return EmitLoadOfLValue(E); }
489 Value *VisitBinPtrMemI(const Expr *E) { return EmitLoadOfLValue(E); }
492 Value *VisitBlockExpr(const BlockExpr *BE);
493 Value *VisitAbstractConditionalOperator(const AbstractConditionalOperator *);
494 Value *VisitChooseExpr(ChooseExpr *CE);
495 Value *VisitVAArgExpr(VAArgExpr *VE);
496 Value *VisitObjCStringLiteral(const ObjCStringLiteral *E) {
499 Value *VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
502 Value *VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
505 Value *VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
508 Value *VisitAsTypeExpr(AsTypeExpr *CE);
509 Value *VisitAtomicExpr(AtomicExpr *AE);
519 Value *ScalarExprEmitter::EmitConversionToBool(Value *Src, QualType SrcType) {
540 Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType,
581 llvm::Value* IntResult =
597 llvm::Value *Elt = EmitScalarConversion(Src, SrcType, EltTy);
600 llvm::Value *UnV = llvm::UndefValue::get(DstTy);
601 llvm::Value *Idx = Builder.getInt32(0);
608 llvm::Value *Yay = Builder.CreateShuffleVector(UnV, UnV, Mask, "splat");
618 Value *Res = NULL;
659 Value *ScalarExprEmitter::
680 Value *ScalarExprEmitter::EmitNullValue(QualType Ty) {
691 Value *ScalarExprEmitter::VisitExpr(Expr *E) {
698 Value *ScalarExprEmitter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
702 Value *LHS = CGF.EmitScalarExpr(E->getExpr(0));
703 Value *RHS = CGF.EmitScalarExpr(E->getExpr(1));
704 Value *Mask;
719 Value* CV = llvm::ConstantVector::get(concat);
741 Value *MaskBits = llvm::ConstantVector::getSplat(MTy->getNumElements(),
753 Value* NewV = llvm::UndefValue::get(RTy);
755 Value *IIndx = Builder.getInt32(i);
756 Value *Indx = Builder.CreateExtractElement(Mask, IIndx, "shuf_idx");
761 Value *cmpIndx, *newIndx;
767 Value *VExt = Builder.CreateExtractElement(LHS, Indx, "shuf_elt");
773 Value* V1 = CGF.EmitScalarExpr(E->getExpr(0));
774 Value* V2 = CGF.EmitScalarExpr(E->getExpr(1));
786 Value *SV = llvm::ConstantVector::get(indices);
789 Value *ScalarExprEmitter::VisitMemberExpr(MemberExpr *E) {
790 llvm::APSInt Value;
791 if (E->EvaluateAsInt(Value, CGF.getContext(), Expr::SE_AllowSideEffects)) {
796 return Builder.getInt(Value);
813 Value *ScalarExprEmitter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
825 Value *Base = Visit(E->getBase());
826 Value *Idx = Visit(E->getIdx());
840 Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
863 // Loop over initializers collecting the Value for each, and remembering
870 llvm::Value *V = llvm::UndefValue::get(VType);
873 Value *Init = Visit(IE);
887 Value *LHS = 0, *RHS = 0;
931 Value *SVOp = SVI->getOperand(0);
990 Value *Idx = Builder.getInt32(CurIdx);
991 llvm::Value *Init = llvm::Constant::getNullValue(EltTy);
1020 Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
1038 Value *V = EmitLValue(E).getAddress();
1048 Value *Src = Visit(const_cast<Expr*>(E));
1077 Value *V = Visit(const_cast<Expr*>(E));
1086 Value *V = EmitLValue(E).getAddress(); // Bitfields can't be arrays.
1123 Value *Src = Visit(E);
1139 llvm::Value *value = Visit(E);
1165 Value *Src = Visit(const_cast<Expr*>(E));
1171 llvm::Value* IntResult =
1186 Value *Elt = Visit(const_cast<Expr*>(E));
1191 llvm::Value *UnV = llvm::UndefValue::get(DstTy);
1192 llvm::Value *Idx = Builder.getInt32(0);
1199 llvm::Value *Yay = Builder.CreateShuffleVector(UnV, UnV, Mask, "splat");
1215 llvm::Value *MemPtr = Visit(E);
1237 Value *ScalarExprEmitter::VisitStmtExpr(const StmtExpr *E) {
1247 llvm::Value *ScalarExprEmitter::
1249 llvm::Value *InVal,
1250 llvm::Value *NextVal, bool IsInc) {
1270 llvm::Value *
1275 llvm::Value *value = EmitLoadOfLValue(LV);
1276 llvm::Value *input = value;
1305 llvm::Value *amt = llvm::ConstantInt::get(value->getType(), amount, true);
1323 llvm::Value *numElts = CGF.getVLASize(vla).first;
1332 llvm::Value *amt = Builder.getInt32(amount);
1343 llvm::Value *amt = Builder.getInt32(amount);
1353 llvm::Value *amt = llvm::ConstantInt::get(value->getType(), amount);
1366 llvm::Value *amt;
1402 llvm::Value *sizeValue =
1415 llvm::Value *old = Builder.CreateAtomicCmpXchg(LV.getAddress(), atomicPHI,
1418 llvm::Value *success = Builder.CreateICmpEQ(old, atomicPHI);
1437 Value *ScalarExprEmitter::VisitUnaryMinus(const UnaryOperator *E) {
1453 Value *ScalarExprEmitter::VisitUnaryNot(const UnaryOperator *E) {
1455 Value *Op = Visit(E->getSubExpr());
1459 Value *ScalarExprEmitter::VisitUnaryLNot(const UnaryOperator *E) {
1463 Value *Oper = Visit(E->getSubExpr());
1464 Value *Zero = llvm::Constant::getNullValue(Oper->getType());
1465 Value *Result = Builder.CreateICmp(llvm::CmpInst::ICMP_EQ, Oper, Zero, "cmp");
1470 Value *BoolVal = CGF.EvaluateExprAsBool(E->getSubExpr());
1481 Value *ScalarExprEmitter::VisitOffsetOfExpr(OffsetOfExpr *E) {
1483 llvm::APSInt Value;
1484 if (E->EvaluateAsInt(Value, CGF.getContext()))
1485 return Builder.getInt(Value);
1490 llvm::Value* Result = llvm::Constant::getNullValue(ResultType);
1494 llvm::Value *Offset = 0;
1499 llvm::Value* Idx = CGF.EmitScalarExpr(IdxExpr);
1508 llvm::Value* ElemSize = llvm::ConstantInt::get(ResultType,
1572 Value *
1589 llvm::Value *numElts;
1592 llvm::Value *size = numElts;
1608 Value *ScalarExprEmitter::VisitUnaryReal(const UnaryOperator *E) {
1624 Value *ScalarExprEmitter::VisitUnaryImag(const UnaryOperator *E) {
1663 Value *(ScalarExprEmitter::*Func)(const BinOpInfo &),
1664 Value *&Result) {
1713 llvm::Value *old = Builder.CreateAtomicCmpXchg(LHSLV.getAddress(), atomicPHI,
1716 llvm::Value *success = Builder.CreateICmpEQ(old, atomicPHI);
1734 Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E,
1735 Value *(ScalarExprEmitter::*Func)(const BinOpInfo &)) {
1737 Value *RHS;
1757 const BinOpInfo &Ops, llvm::Value *Zero, bool isDiv) {
1761 llvm::Value *IntMin =
1763 llvm::Value *NegOne = llvm::ConstantInt::get(Ty, -1ULL);
1765 llvm::Value *Cond1 = Builder.CreateICmpNE(Ops.RHS, Zero);
1766 llvm::Value *LHSCmp = Builder.CreateICmpNE(Ops.LHS, IntMin);
1767 llvm::Value *RHSCmp = Builder.CreateICmpNE(Ops.RHS, NegOne);
1768 llvm::Value *Cond2 = Builder.CreateOr(LHSCmp, RHSCmp, "or");
1775 Value *ScalarExprEmitter::EmitDiv(const BinOpInfo &Ops) {
1777 llvm::Value *Zero = llvm::Constant::getNullValue(ConvertType(Ops.Ty));
1785 llvm::Value *Val = Builder.CreateFDiv(Ops.LHS, Ops.RHS, "div");
1802 Value *ScalarExprEmitter::EmitRem(const BinOpInfo &Ops) {
1805 llvm::Value *Zero = llvm::Constant::getNullValue(ConvertType(Ops.Ty));
1817 Value *ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) {
1847 Value *resultAndOverflow = Builder.CreateCall2(intrinsic, Ops.LHS, Ops.RHS);
1848 Value *result = Builder.CreateExtractValue(resultAndOverflow, 0);
1849 Value *overflow = Builder.CreateExtractValue(resultAndOverflow, 1);
1877 llvm::Value *handler = CGF.CGM.CreateRuntimeFunction(handlerTy, *handlerName);
1881 llvm::Value *lhs = Builder.CreateSExt(Ops.LHS, CGF.Int64Ty);
1882 llvm::Value *rhs = Builder.CreateSExt(Ops.RHS, CGF.Int64Ty);
1886 llvm::Value *handlerResult = Builder.CreateCall4(handler, lhs, rhs,
1903 static Value *emitPointerArithmetic(CodeGenFunction &CGF,
1910 Value *pointer = op.LHS;
1912 Value *index = op.RHS;
1940 llvm::Value *objectSize
1945 Value *result = CGF.Builder.CreateBitCast(pointer, CGF.VoidPtrTy);
1954 llvm::Value *numElements = CGF.getVLASize(vla).first;
1974 Value *result = CGF.Builder.CreateBitCast(pointer, CGF.VoidPtrTy);
1985 Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &op) {
2009 Value *ScalarExprEmitter::EmitSub(const BinOpInfo &op) {
2039 llvm::Value *LHS
2041 llvm::Value *RHS
2043 Value *diffInChars = Builder.CreateSub(LHS, RHS, "sub.ptr.sub");
2049 llvm::Value *divisor = 0;
2054 llvm::Value *numElements;
2089 Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) {
2092 Value *RHS = Ops.RHS;
2098 llvm::Value *WidthMinusOne =
2105 llvm::Value *BitsShiftedOff =
2115 llvm::Value *One = llvm::ConstantInt::get(BitsShiftedOff->getType(), 1);
2118 llvm::Value *Zero = llvm::ConstantInt::get(BitsShiftedOff->getType(), 0);
2126 Value *ScalarExprEmitter::EmitShr(const BinOpInfo &Ops) {
2129 Value *RHS = Ops.RHS;
2135 llvm::Value *WidthVal = llvm::ConstantInt::get(RHS->getType(), Width);
2178 Value *ScalarExprEmitter::EmitCompare(const BinaryOperator *E,unsigned UICmpOpc,
2181 Value *Result;
2186 Value *LHS = CGF.EmitScalarExpr(E->getLHS());
2187 Value *RHS = CGF.EmitScalarExpr(E->getRHS());
2191 Value *LHS = Visit(E->getLHS());
2192 Value *RHS = Visit(E->getRHS());
2203 Value *FirstVecArg = LHS,
2253 Value *CR6Param = Builder.getInt32(CR6);
2283 Value *ResultR, *ResultI;
2310 Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) {
2313 Value *RHS;
2365 Value *ScalarExprEmitter::VisitBinLAnd(const BinaryOperator *E) {
2369 Value *LHS = Visit(E->getLHS());
2370 Value *RHS = Visit(E->getRHS());
2371 Value *Zero = llvm::ConstantAggregateZero::get(LHS->getType());
2374 Value *And = Builder.CreateAnd(LHS, RHS);
2385 Value *RHSCond = CGF.EvaluateExprAsBool(E->getRHS());
2414 Value *RHSCond = CGF.EvaluateExprAsBool(E->getRHS());
2432 Value *ScalarExprEmitter::VisitBinLOr(const BinaryOperator *E) {
2436 Value *LHS = Visit(E->getLHS());
2437 Value *RHS = Visit(E->getRHS());
2438 Value *Zero = llvm::ConstantAggregateZero::get(LHS->getType());
2441 Value *Or = Builder.CreateOr(LHS, RHS);
2452 Value *RHSCond = CGF.EvaluateExprAsBool(E->getRHS());
2483 Value *RHSCond = CGF.EvaluateExprAsBool(E->getRHS());
2499 Value *ScalarExprEmitter::VisitBinComma(const BinaryOperator *E) {
2534 Value *ScalarExprEmitter::
2554 Value *Result = Visit(live);
2557 // type, so evaluating it returns a null Value*. However, a conditional
2558 // with non-void type must return a non-null Value*.
2570 llvm::Value *CondV = CGF.EmitScalarExpr(condExpr);
2571 llvm::Value *LHS = Visit(lhsExpr);
2572 llvm::Value *RHS = Visit(rhsExpr);
2580 llvm::Value *zeroVec = llvm::Constant::getNullValue(vecTy);
2581 llvm::Value *TestMSB = Builder.CreateICmpSLT(CondV, zeroVec);
2582 llvm::Value *tmp = Builder.CreateSExt(TestMSB,
2586 llvm::Value *tmp2 = Builder.CreateNot(tmp);
2589 llvm::Value *RHSTmp = RHS;
2590 llvm::Value *LHSTmp = LHS;
2599 llvm::Value *tmp3 = Builder.CreateAnd(RHSTmp, tmp2);
2600 llvm::Value *tmp4 = Builder.CreateAnd(LHSTmp, tmp);
2601 llvm::Value *tmp5 = Builder.CreateOr(tmp3, tmp4, "cond");
2613 llvm::Value *CondV = CGF.EvaluateExprAsBool(condExpr);
2614 llvm::Value *LHS = Visit(lhsExpr);
2615 llvm::Value *RHS = Visit(rhsExpr);
2617 // If the conditional has void type, make sure we return a null Value*.
2633 Value *LHS = Visit(lhsExpr);
2641 Value *RHS = Visit(rhsExpr);
2660 Value *ScalarExprEmitter::VisitChooseExpr(ChooseExpr *E) {
2664 Value *ScalarExprEmitter::VisitVAArgExpr(VAArgExpr *VE) {
2665 llvm::Value *ArgValue = CGF.EmitVAListRef(VE->getSubExpr());
2666 llvm::Value *ArgPtr = CGF.EmitVAArg(ArgValue, VE->getType());
2676 Value *ScalarExprEmitter::VisitBlockExpr(const BlockExpr *block) {
2680 Value *ScalarExprEmitter::VisitAsTypeExpr(AsTypeExpr *E) {
2681 Value *Src = CGF.EmitScalarExpr(E->getSrcExpr());
2710 llvm::Value *UnV = llvm::UndefValue::get(Src->getType());
2729 Value *ScalarExprEmitter::VisitAtomicExpr(AtomicExpr *E) {
2739 Value *CodeGenFunction::EmitScalarExpr(const Expr *E, bool IgnoreResultAssign) {
2745 Value *V = ScalarExprEmitter(*this, IgnoreResultAssign)
2754 Value *CodeGenFunction::EmitScalarConversion(Value *Src, QualType SrcTy,
2764 Value *CodeGenFunction::EmitComplexToScalarConversion(ComplexPairTy Src,
2774 llvm::Value *CodeGenFunction::
2781 llvm::Value *V;
2790 llvm::Value *Src = EmitScalarExpr(BaseExpr);
2811 Value *Result = 0;