18 #include "llvm/ADT/STLExtras.h"
19 #include "llvm/ADT/SmallString.h"
20 #include "llvm/IR/Constants.h"
21 #include "llvm/IR/Function.h"
22 #include "llvm/IR/Instructions.h"
23 #include "llvm/IR/MDBuilder.h"
24 #include "llvm/IR/Metadata.h"
26 using namespace clang;
27 using namespace CodeGen;
38 if (
const ComplexType *comp = dyn_cast<ComplexType>(type)) {
41 return cast<ComplexType>(cast<AtomicType>(
type)->getValueType());
46 class ComplexExprEmitter
47 :
public StmtVisitor<ComplexExprEmitter, ComplexPairTy> {
62 bool TestAndClearIgnoreReal() {
67 bool TestAndClearIgnoreImag() {
77 return EmitLoadOfLValue(CGF.EmitLValue(E), E->
getExprLoc());
103 S->dump(CGF.getContext().getSourceManager());
104 llvm_unreachable(
"Stmt can't have complex result type!");
120 if (result.isReference())
121 return EmitLoadOfLValue(result.getReferenceLValue(CGF, E),
124 llvm::Constant *pair = result.getValue();
126 pair->getAggregateElement(1U));
128 return EmitLoadOfLValue(E);
131 return EmitLoadOfLValue(E);
134 return CGF.EmitObjCMessageExpr(E).getComplexVal();
140 return EmitLoadOfLValue(CGF.getOpaqueLValueMapping(E), E->
getExprLoc());
141 return CGF.getOpaqueRValueMapping(E).getComplexVal();
145 return CGF.EmitPseudoObjectRValue(E).getComplexVal();
157 if (
const auto *ECE = dyn_cast<ExplicitCastExpr>(E))
158 CGF.CGM.EmitExplicitCastExprType(ECE, &CGF);
166 bool isInc,
bool isPre) {
168 return CGF.EmitComplexPrePostIncDec(E, LV, isInc, isPre);
171 return VisitPrePostIncDec(E,
false,
false);
174 return VisitPrePostIncDec(E,
true,
false);
177 return VisitPrePostIncDec(E,
false,
true);
180 return VisitPrePostIncDec(E,
true,
true);
184 TestAndClearIgnoreReal();
185 TestAndClearIgnoreImag();
202 CGF.enterFullExpression(E);
209 llvm::Constant *Null = llvm::Constant::getNullValue(CGF.ConvertType(Elem));
215 llvm::Constant *Null =
216 llvm::Constant::getNullValue(CGF.ConvertType(Elem));
233 (
const BinOpInfo &));
241 const BinOpInfo &Op);
244 return EmitBinAdd(EmitBinOps(E));
247 return EmitBinSub(EmitBinOps(E));
250 return EmitBinMul(EmitBinOps(E));
253 return EmitBinDiv(EmitBinOps(E));
258 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinAdd);
261 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinSub);
264 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinMul);
267 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinDiv);
288 return EmitLoadOfLValue(E);
294 return CGF.EmitAtomicExpr(E).getComplexVal();
320 assert(lvalue.
isSimple() &&
"non-simple complex l-value?");
322 return CGF.EmitAtomicLoad(lvalue, loc).getComplexVal();
329 if (!IgnoreReal || isVolatile) {
330 Address RealP = CGF.emitAddrOfRealComponent(SrcPtr, lvalue.
getType());
331 Real =
Builder.CreateLoad(RealP, isVolatile, SrcPtr.
getName() +
".real");
334 if (!IgnoreImag || isVolatile) {
335 Address ImagP = CGF.emitAddrOfImagComponent(SrcPtr, lvalue.
getType());
336 Imag =
Builder.CreateLoad(ImagP, isVolatile, SrcPtr.
getName() +
".imag");
347 (!isInit && CGF.LValueIsSuitableForInlineAtomic(lvalue)))
351 Address RealPtr = CGF.emitAddrOfRealComponent(Ptr, lvalue.
getType());
352 Address ImagPtr = CGF.emitAddrOfImagComponent(Ptr, lvalue.
getType());
365 CGF.ErrorUnsupported(E,
"complex expression");
375 return ComplexPairTy(llvm::Constant::getNullValue(Imag->getType()), Imag);
381 return EmitLoadOfLValue(E);
383 return CGF.EmitCallExpr(E).getComplexVal();
389 assert(RetAlloca.
isValid() &&
"Expected complex return value");
390 return EmitLoadOfLValue(CGF.MakeAddrLValue(RetAlloca, E->
getType()),
406 Val.first = CGF.EmitScalarConversion(Val.first, SrcType, DestType, Loc);
407 Val.second = CGF.EmitScalarConversion(Val.second, SrcType, DestType, Loc);
417 Val = CGF.EmitScalarConversion(Val, SrcType, DestType, Loc);
420 return ComplexPairTy(Val, llvm::Constant::getNullValue(Val->getType()));
426 case CK_Dependent: llvm_unreachable(
"dependent cast kind in IR gen!");
438 LValue origLV = CGF.EmitLValue(Op);
440 V =
Builder.CreateElementBitCast(V, CGF.ConvertType(DestTy));
441 return EmitLoadOfLValue(CGF.MakeAddrLValue(V, DestTy), Op->
getExprLoc());
487 llvm_unreachable(
"invalid cast kind for complex value");
491 return EmitScalarToComplexCast(CGF.EmitScalarExpr(Op), Op->
getType(),
498 return EmitComplexToComplexCast(Visit(Op), Op->
getType(), DestTy,
502 llvm_unreachable(
"unknown cast resulting in complex value");
506 TestAndClearIgnoreReal();
507 TestAndClearIgnoreImag();
511 if (Op.first->getType()->isFloatingPointTy()) {
512 ResR =
Builder.CreateFNeg(Op.first,
"neg.r");
513 ResI =
Builder.CreateFNeg(Op.second,
"neg.i");
515 ResR =
Builder.CreateNeg(Op.first,
"neg.r");
516 ResI =
Builder.CreateNeg(Op.second,
"neg.i");
522 TestAndClearIgnoreReal();
523 TestAndClearIgnoreImag();
527 if (Op.second->getType()->isFloatingPointTy())
528 ResI =
Builder.CreateFNeg(Op.second,
"conj.i");
530 ResI =
Builder.CreateNeg(Op.second,
"conj.i");
535 ComplexPairTy ComplexExprEmitter::EmitBinAdd(
const BinOpInfo &Op) {
538 if (Op.LHS.first->getType()->isFloatingPointTy()) {
539 ResR =
Builder.CreateFAdd(Op.LHS.first, Op.RHS.first,
"add.r");
540 if (Op.LHS.second && Op.RHS.second)
541 ResI =
Builder.CreateFAdd(Op.LHS.second, Op.RHS.second,
"add.i");
543 ResI = Op.LHS.second ? Op.LHS.second : Op.RHS.second;
544 assert(ResI &&
"Only one operand may be real!");
546 ResR =
Builder.CreateAdd(Op.LHS.first, Op.RHS.first,
"add.r");
547 assert(Op.LHS.second && Op.RHS.second &&
548 "Both operands of integer complex operators must be complex!");
549 ResI =
Builder.CreateAdd(Op.LHS.second, Op.RHS.second,
"add.i");
554 ComplexPairTy ComplexExprEmitter::EmitBinSub(
const BinOpInfo &Op) {
556 if (Op.LHS.first->getType()->isFloatingPointTy()) {
557 ResR =
Builder.CreateFSub(Op.LHS.first, Op.RHS.first,
"sub.r");
558 if (Op.LHS.second && Op.RHS.second)
559 ResI =
Builder.CreateFSub(Op.LHS.second, Op.RHS.second,
"sub.i");
561 ResI = Op.LHS.second ? Op.LHS.second
562 :
Builder.CreateFNeg(Op.RHS.second,
"sub.i");
563 assert(ResI &&
"Only one operand may be real!");
565 ResR =
Builder.CreateSub(Op.LHS.first, Op.RHS.first,
"sub.r");
566 assert(Op.LHS.second && Op.RHS.second &&
567 "Both operands of integer complex operators must be complex!");
568 ResI =
Builder.CreateSub(Op.LHS.second, Op.RHS.second,
"sub.i");
574 ComplexPairTy ComplexExprEmitter::EmitComplexBinOpLibCall(StringRef LibCallName,
575 const BinOpInfo &Op) {
597 QualType FQTy = CGF.getContext().getFunctionType(Op.Ty, ArgsQTys, EPI);
598 const CGFunctionInfo &FuncInfo = CGF.CGM.getTypes().arrangeFreeFunctionCall(
599 Args, cast<FunctionType>(FQTy.getTypePtr()),
false);
601 llvm::FunctionType *FTy = CGF.CGM.getTypes().GetFunctionType(FuncInfo);
602 llvm::Constant *Func = CGF.CGM.CreateBuiltinFunction(FTy, LibCallName);
603 llvm::Instruction *Call;
607 cast<llvm::CallInst>(Call)->setCallingConv(CGF.CGM.getBuiltinCC());
614 switch (Ty->getTypeID()) {
616 llvm_unreachable(
"Unsupported floating point type!");
617 case llvm::Type::HalfTyID:
619 case llvm::Type::FloatTyID:
621 case llvm::Type::DoubleTyID:
623 case llvm::Type::PPC_FP128TyID:
625 case llvm::Type::X86_FP80TyID:
627 case llvm::Type::FP128TyID:
634 ComplexPairTy ComplexExprEmitter::EmitBinMul(
const BinOpInfo &Op) {
637 llvm::MDBuilder MDHelper(CGF.getLLVMContext());
639 if (Op.LHS.first->getType()->isFloatingPointTy()) {
648 if (Op.LHS.second && Op.RHS.second) {
659 Value *AC =
Builder.CreateFMul(Op.LHS.first, Op.RHS.first,
"mul_ac");
660 Value *BD =
Builder.CreateFMul(Op.LHS.second, Op.RHS.second,
"mul_bd");
661 Value *AD =
Builder.CreateFMul(Op.LHS.first, Op.RHS.second,
"mul_ad");
662 Value *BC =
Builder.CreateFMul(Op.LHS.second, Op.RHS.first,
"mul_bc");
666 ResR =
Builder.CreateFSub(AC, BD,
"mul_r");
667 ResI =
Builder.CreateFAdd(AD, BC,
"mul_i");
671 Value *IsRNaN =
Builder.CreateFCmpUNO(ResR, ResR,
"isnan_cmp");
672 llvm::BasicBlock *ContBB = CGF.createBasicBlock(
"complex_mul_cont");
673 llvm::BasicBlock *INaNBB = CGF.createBasicBlock(
"complex_mul_imag_nan");
674 llvm::Instruction *Branch =
Builder.CreateCondBr(IsRNaN, INaNBB, ContBB);
675 llvm::BasicBlock *OrigBB = Branch->getParent();
679 llvm::MDNode *BrWeight = MDHelper.createBranchWeights(1, (1U << 20) - 1);
680 Branch->setMetadata(llvm::LLVMContext::MD_prof, BrWeight);
683 CGF.EmitBlock(INaNBB);
684 Value *IsINaN =
Builder.CreateFCmpUNO(ResI, ResI,
"isnan_cmp");
685 llvm::BasicBlock *LibCallBB = CGF.createBasicBlock(
"complex_mul_libcall");
686 Branch =
Builder.CreateCondBr(IsINaN, LibCallBB, ContBB);
687 Branch->setMetadata(llvm::LLVMContext::MD_prof, BrWeight);
690 CGF.EmitBlock(LibCallBB);
691 Value *LibCallR, *LibCallI;
692 std::tie(LibCallR, LibCallI) = EmitComplexBinOpLibCall(
698 CGF.EmitBlock(ContBB);
699 llvm::PHINode *RealPHI =
Builder.CreatePHI(ResR->getType(), 3,
"real_mul_phi");
700 RealPHI->addIncoming(ResR, OrigBB);
701 RealPHI->addIncoming(ResR, INaNBB);
702 RealPHI->addIncoming(LibCallR, LibCallBB);
703 llvm::PHINode *ImagPHI =
Builder.CreatePHI(ResI->getType(), 3,
"imag_mul_phi");
704 ImagPHI->addIncoming(ResI, OrigBB);
705 ImagPHI->addIncoming(ResI, INaNBB);
706 ImagPHI->addIncoming(LibCallI, LibCallBB);
709 assert((Op.LHS.second || Op.RHS.second) &&
710 "At least one operand must be complex!");
715 ResR =
Builder.CreateFMul(Op.LHS.first, Op.RHS.first,
"mul.rl");
718 ?
Builder.CreateFMul(Op.LHS.second, Op.RHS.first,
"mul.il")
719 :
Builder.CreateFMul(Op.LHS.first, Op.RHS.second,
"mul.ir");
721 assert(Op.LHS.second && Op.RHS.second &&
722 "Both operands of integer complex operators must be complex!");
723 Value *ResRl =
Builder.CreateMul(Op.LHS.first, Op.RHS.first,
"mul.rl");
724 Value *ResRr =
Builder.CreateMul(Op.LHS.second, Op.RHS.second,
"mul.rr");
725 ResR =
Builder.CreateSub(ResRl, ResRr,
"mul.r");
727 Value *ResIl =
Builder.CreateMul(Op.LHS.second, Op.RHS.first,
"mul.il");
728 Value *ResIr =
Builder.CreateMul(Op.LHS.first, Op.RHS.second,
"mul.ir");
729 ResI =
Builder.CreateAdd(ResIl, ResIr,
"mul.i");
736 ComplexPairTy ComplexExprEmitter::EmitBinDiv(
const BinOpInfo &Op) {
737 llvm::Value *LHSr = Op.LHS.first, *LHSi = Op.LHS.second;
738 llvm::Value *RHSr = Op.RHS.first, *RHSi = Op.RHS.second;
742 if (LHSr->getType()->isFloatingPointTy()) {
749 BinOpInfo LibCallOp = Op;
752 LibCallOp.LHS.second = llvm::Constant::getNullValue(LHSr->getType());
754 StringRef LibCallName;
755 switch (LHSr->getType()->getTypeID()) {
757 llvm_unreachable(
"Unsupported floating point type!");
758 case llvm::Type::HalfTyID:
759 return EmitComplexBinOpLibCall(
"__divhc3", LibCallOp);
760 case llvm::Type::FloatTyID:
761 return EmitComplexBinOpLibCall(
"__divsc3", LibCallOp);
762 case llvm::Type::DoubleTyID:
763 return EmitComplexBinOpLibCall(
"__divdc3", LibCallOp);
764 case llvm::Type::PPC_FP128TyID:
765 return EmitComplexBinOpLibCall(
"__divtc3", LibCallOp);
766 case llvm::Type::X86_FP80TyID:
767 return EmitComplexBinOpLibCall(
"__divxc3", LibCallOp);
768 case llvm::Type::FP128TyID:
769 return EmitComplexBinOpLibCall(
"__divtc3", LibCallOp);
772 assert(LHSi &&
"Can have at most one non-complex operand!");
774 DSTr =
Builder.CreateFDiv(LHSr, RHSr);
775 DSTi =
Builder.CreateFDiv(LHSi, RHSr);
777 assert(Op.LHS.second && Op.RHS.second &&
778 "Both operands of integer complex operators must be complex!");
793 DSTr =
Builder.CreateUDiv(Tmp3, Tmp6);
794 DSTi =
Builder.CreateUDiv(Tmp9, Tmp6);
796 DSTr =
Builder.CreateSDiv(Tmp3, Tmp6);
797 DSTi =
Builder.CreateSDiv(Tmp9, Tmp6);
804 ComplexExprEmitter::BinOpInfo
806 TestAndClearIgnoreReal();
807 TestAndClearIgnoreImag();
812 Ops.LHS = Visit(E->
getLHS());
816 Ops.RHS = Visit(E->
getRHS());
823 LValue ComplexExprEmitter::
827 TestAndClearIgnoreReal();
828 TestAndClearIgnoreImag();
831 LHSTy = AT->getValueType();
845 .hasSameUnqualifiedType(ComplexElementTy, E->
getRHS()->
getType()));
848 assert(CGF.getContext()
850 OpInfo.RHS = Visit(E->
getRHS());
859 OpInfo.LHS = EmitComplexToComplexCast(LHSVal, LHSTy, OpInfo.Ty, Loc);
861 llvm::Value *LHSVal = CGF.EmitLoadOfScalar(LHS, Loc);
865 if (!CGF.getContext().hasSameUnqualifiedType(ComplexElementTy, LHSTy))
866 LHSVal = CGF.EmitScalarConversion(LHSVal, LHSTy, ComplexElementTy, Loc);
869 OpInfo.LHS = EmitScalarToComplexCast(LHSVal, LHSTy, OpInfo.Ty, Loc);
879 EmitComplexToComplexCast(Result, OpInfo.Ty, LHSTy, Loc);
880 EmitStoreOfComplex(ResVal, LHS,
false);
884 CGF.EmitComplexToScalarConversion(Result, OpInfo.Ty, LHSTy, Loc);
885 CGF.EmitStoreOfScalar(ResVal, LHS,
false);
895 ComplexPairTy (ComplexExprEmitter::*Func)(
const BinOpInfo&)){
897 LValue LV = EmitCompoundAssignLValue(E, Func, Val);
900 if (!CGF.getLangOpts().CPlusPlus)
912 assert(CGF.getContext().hasSameUnqualifiedType(E->
getLHS()->
getType(),
914 "Invalid assignment");
915 TestAndClearIgnoreReal();
916 TestAndClearIgnoreImag();
925 EmitStoreOfComplex(Val, LHS,
false);
932 LValue LV = EmitBinAssignLValue(E, Val);
935 if (!CGF.getLangOpts().CPlusPlus)
946 CGF.EmitIgnoredExpr(E->
getLHS());
947 return Visit(E->
getRHS());
952 TestAndClearIgnoreReal();
953 TestAndClearIgnoreImag();
954 llvm::BasicBlock *LHSBlock = CGF.createBasicBlock(
"cond.true");
955 llvm::BasicBlock *RHSBlock = CGF.createBasicBlock(
"cond.false");
956 llvm::BasicBlock *ContBlock = CGF.createBasicBlock(
"cond.end");
963 CGF.EmitBranchOnBoolExpr(E->
getCond(), LHSBlock, RHSBlock,
964 CGF.getProfileCount(E));
967 CGF.EmitBlock(LHSBlock);
968 CGF.incrementProfileCounter(E);
970 LHSBlock =
Builder.GetInsertBlock();
971 CGF.EmitBranch(ContBlock);
975 CGF.EmitBlock(RHSBlock);
977 RHSBlock =
Builder.GetInsertBlock();
978 CGF.EmitBlock(ContBlock);
982 llvm::PHINode *RealPN =
Builder.CreatePHI(LHS.first->getType(), 2,
"cond.r");
983 RealPN->addIncoming(LHS.first, LHSBlock);
984 RealPN->addIncoming(RHS.first, RHSBlock);
987 llvm::PHINode *ImagPN =
Builder.CreatePHI(LHS.first->getType(), 2,
"cond.i");
988 ImagPN->addIncoming(LHS.second, LHSBlock);
989 ImagPN->addIncoming(RHS.second, RHSBlock);
999 bool Ignore = TestAndClearIgnoreReal();
1001 assert (Ignore ==
false &&
"init list ignored");
1002 Ignore = TestAndClearIgnoreImag();
1004 assert (Ignore ==
false &&
"init list ignored");
1015 assert(E->
getNumInits() == 0 &&
"Unexpected number of inits");
1018 llvm::Value* zeroConstant = llvm::Constant::getNullValue(LTy);
1024 Address ArgPtr = CGF.EmitVAArg(E, ArgValue);
1027 CGF.ErrorUnsupported(E,
"complex va_arg expression");
1034 return EmitLoadOfLValue(CGF.MakeAddrLValue(ArgPtr, E->
getType()),
1047 "Invalid complex expression to emit");
1049 return ComplexExprEmitter(*
this, IgnoreReal, IgnoreImag)
1050 .Visit(const_cast<Expr *>(E));
1056 "Invalid complex expression to emit");
1057 ComplexExprEmitter Emitter(*
this);
1059 Emitter.EmitStoreOfComplex(Val, dest, isInit);
1065 ComplexExprEmitter(*this).EmitStoreOfComplex(V, dest, isInit);
1071 return ComplexExprEmitter(*this).EmitLoadOfLValue(src, loc);
1077 return ComplexExprEmitter(*this).EmitBinAssignLValue(E, Val);
1081 const ComplexExprEmitter::BinOpInfo &);
1085 case BO_MulAssign:
return &ComplexExprEmitter::EmitBinMul;
1086 case BO_DivAssign:
return &ComplexExprEmitter::EmitBinDiv;
1087 case BO_SubAssign:
return &ComplexExprEmitter::EmitBinSub;
1088 case BO_AddAssign:
return &ComplexExprEmitter::EmitBinAdd;
1090 llvm_unreachable(
"unexpected complex compound assignment");
1098 return ComplexExprEmitter(*this).EmitCompoundAssignLValue(E, Op, Val);
1106 LValue Ret = ComplexExprEmitter(*this).EmitCompoundAssignLValue(E, Op, Val);
1107 Result = Val.getScalarVal();
ReturnValueSlot - Contains the address where the return value of a function can be stored...
Defines the clang::ASTContext interface.
unsigned getNumInits() const
CastKind getCastKind() const
CK_LValueToRValue - A conversion which causes the extraction of an r-value from the operand gl-value...
LValue EmitComplexCompoundAssignmentLValue(const CompoundAssignOperator *E)
A (possibly-)qualified type.
CompoundStmt * getSubStmt()
std::pair< llvm::Value *, llvm::Value * > getComplexVal() const
getComplexVal - Return the real/imag components of this complex value.
CK_ToUnion - The GCC cast-to-union extension.
Address getAddress() const
static StringRef getComplexMultiplyLibCallName(llvm::Type *Ty)
Lookup the libcall name for a given floating point type complex multiply.
ParenExpr - This represents a parethesized expression, e.g.
void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit)
EmitComplexExprIntoLValue - Emit the given expression of complex type and place its result into the s...
CK_BaseToDerivedMemberPointer - Member pointer in base class to member pointer in derived class...
const Expr * getResultExpr() const
The generic selection's result expression.
CK_FloatingToIntegral - Floating point to integral.
[ARC] Consumes a retainable object pointer that has just been produced, e.g.
CK_IntegralToFloating - Integral to floating point.
CK_IntegralCast - A cast between integral types (other than to boolean).
CompoundLiteralExpr - [C99 6.5.2.5].
Extra information about a function prototype.
CK_Dynamic - A C++ dynamic_cast.
LValue EmitComplexAssignmentLValue(const BinaryOperator *E)
Emit an l-value for an assignment (simple or compound) of complex type.
CK_Dependent - A conversion which cannot yet be analyzed because either the expression or target type...
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Address emitAddrOfImagComponent(Address complex, QualType complexType)
An object to manage conditionally-evaluated expressions.
LValue EmitScalarCompoundAssignWithComplex(const CompoundAssignOperator *E, llvm::Value *&Result)
bool isVolatileQualified() const
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
Converts between different integral complex types.
An RAII object to set (and then clear) a mapping for an OpaqueValueExpr.
Converting between two Objective-C object types, which can occur when performing reference binding to...
CK_FloatingCast - Casting between floating types of different size.
[ARC] Causes a value of block type to be copied to the heap, if it is not already there...
CK_VectorSplat - A conversion from an arithmetic type to a vector of that element type...
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
CK_NullToPointer - Null pointer constant to pointer, ObjC pointer, or block pointer.
CK_PointerToIntegral - Pointer to integral.
CK_IntegralToPointer - Integral to pointer.
ComplexPairTy EmitLoadOfComplex(LValue src, SourceLocation loc)
EmitLoadOfComplex - Load a complex number from the specified l-value.
Converts a floating point complex to bool by comparing against 0+0i.
Describes an C or C++ initializer list.
CK_IntegralToBoolean - Integral to boolean.
Expr * getChosenSubExpr() const
getChosenSubExpr - Return the subexpression chosen according to the condition.
Address emitAddrOfRealComponent(Address complex, QualType complexType)
Expr * getTrueExpr() const
CharUnits - This is an opaque type for sizes expressed in character units.
A builtin binary operation expression such as "x + y" or "x <= y".
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
Scope - A scope is a transient data structure that is used while parsing the program.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
detail::InMemoryDirectory::const_iterator I
A default argument (C++ [dcl.fct.default]).
CK_AnyPointerToBlockPointerCast - Casting any non-block pointer to a block pointer.
std::pair< llvm::Value *, llvm::Value * > ComplexPairTy
Represents a prototype with parameter type info, e.g.
Causes a block literal to by copied to the heap and then autoreleased.
CastKind
CastKind - The kind of operation required for a conversion.
RValue - This trivial value class is used to represent the result of an expression that is evaluated...
const Expr * getExpr() const
Get the initialization expression that will be used.
Represents a call to the builtin function __builtin_va_arg.
CK_FunctionToPointerDecay - Function to pointer decay.
Converts between different floating point complex types.
bool isRealFloatingType() const
Floating point categories.
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
Expr - This represents one expression.
CK_PointerToBoolean - Pointer to boolean conversion.
Converts an integral complex to an integral real of the source's element type by discarding the imagi...
CK_BitCast - A conversion which causes a bit pattern of one type to be reinterpreted as a bit pattern...
bool isAnyComplexType() const
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited...
bool isAtomicType() const
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &O)
void add(RValue rvalue, QualType type, bool needscopy=false)
An RAII object to record that we're evaluating a statement expression.
Expr * getSubExpr() const
CK_ConstructorConversion - Conversion by constructor.
An expression that sends a message to the given Objective-C object or class.
Converts from an integral complex to a floating complex.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
The scope of a CXXDefaultInitExpr.
The result type of a method or function.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
CK_ArrayToPointerDecay - Array to pointer decay.
QualType getComputationResultType() const
The l-value was considered opaque, so the alignment was determined from a type.
CK_CPointerToObjCPointerCast - Casting a C pointer kind to an Objective-C pointer.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
CK_UserDefinedConversion - Conversion using a user defined type conversion function.
ASTContext & getContext() const
Encodes a location in the source.
QualType getElementType() const
CK_NullToMemberPointer - Null pointer constant to member pointer.
A scoped helper to set the current debug location to the specified location or preferred location of ...
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
static const ComplexType * getComplexType(QualType type)
Return the complex type that we are meant to emit.
CK_ReinterpretMemberPointer - Reinterpret a member pointer as a different kind of member pointer...
CK_DerivedToBase - A conversion from a C++ class pointer to a base class pointer. ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>.
Converts from an integral real to an integral complex whose element type matches the source...
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
const T * castAs() const
Member-template castAs<specific type>.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
llvm::StringRef getName() const
Return the IR name of the pointer value.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
CompoundAssignOperator - For compound assignments (e.g.
Represents a C11 generic selection.
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
Converts a floating point complex to floating point real of the source's element type.
Expr * getReplacement() const
CGFunctionInfo - Class to encapsulate the information about a function definition.
SourceLocation getExprLoc() const LLVM_READONLY
static const Type * getElementType(const Expr *BaseExpr)
static CompoundFunc getComplexOp(BinaryOperatorKind Op)
const Expr * getExpr() const
static RValue getComplex(llvm::Value *V1, llvm::Value *V2)
Converts an integral complex to bool by comparing against 0+0i.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
CodeGenFunction::ComplexPairTy ComplexPairTy
Address CreateStructGEP(Address Addr, unsigned Index, CharUnits Offset, const llvm::Twine &Name="")
CK_BaseToDerived - A conversion from a C++ class pointer/reference to a derived class pointer/referen...
CK_BlockPointerToObjCPointerCast - Casting a block pointer to an ObjC pointer.
detail::InMemoryDirectory::const_iterator E
A conversion of a floating point real to a floating point complex of the original type...
CK_MemberPointerToBoolean - Member pointer to boolean.
[ARC] Reclaim a retainable object pointer object that may have been produced and autoreleased as part...
Complex values, per C99 6.2.5p11.
const T * getAs() const
Member-template getAs<specific type>'.
Expr * getFalseExpr() const
QualType getCanonicalType() const
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
void EmitStoreOfComplex(ComplexPairTy V, LValue dest, bool isInit)
EmitStoreOfComplex - Store a complex number into the specified l-value.
[ARC] Produces a retainable object pointer so that it may be consumed, e.g.
CK_LValueBitCast - A conversion which reinterprets the address of an l-value as an l-value of a diffe...
Converts from T to _Atomic(T).
Converts from a floating complex to an integral complex.
const Expr * getSubExpr() const
ComplexPairTy(ComplexExprEmitter::* CompoundFunc)(const ComplexExprEmitter::BinOpInfo &)
SourceLocation getExprLoc() const LLVM_READONLY
ComplexPairTy EmitComplexExpr(const Expr *E, bool IgnoreReal=false, bool IgnoreImag=false)
EmitComplexExpr - Emit the computation of the specified expression of complex type, returning the result.
CK_UncheckedDerivedToBase - A conversion from a C++ class pointer/reference to a base class that can ...
ObjCIvarRefExpr - A reference to an ObjC instance variable.
A use of a default initializer in a constructor or in aggregate initialization.
const Expr * getSubExpr() const
BoundNodesTreeBuilder *const Builder
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Converts from _Atomic(T) to T.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
CK_NoOp - A conversion which does not affect the type other than (possibly) adding qualifiers...
A reference to a declared variable, function, enum, etc.
static RValue get(llvm::Value *V)
CK_DerivedToBaseMemberPointer - Member pointer in derived class to member pointer in base class...
const Expr * getInit(unsigned Init) const
LValue - This represents an lvalue references.
CK_ToVoid - Cast to void, discarding the computed value.
CallArgList - Type for representing both the value and type of arguments in a call.
Represents an implicitly-generated value initialization of an object of a given type.
CK_FloatingToBoolean - Floating point to boolean.