19#include "llvm/IR/Constants.h"
20#include "llvm/IR/Instructions.h"
21#include "llvm/IR/MDBuilder.h"
22#include "llvm/IR/Metadata.h"
43class ComplexExprEmitter
44 :
public StmtVisitor<ComplexExprEmitter, ComplexPairTy> {
49 bool FPHasBeenPromoted;
52 ComplexExprEmitter(CodeGenFunction &cgf,
bool ir =
false,
bool ii =
false)
53 : CGF(cgf), Builder(CGF.Builder), IgnoreReal(ir), IgnoreImag(ii),
54 FPHasBeenPromoted(
false) {}
60 bool TestAndClearIgnoreReal() {
65 bool TestAndClearIgnoreImag() {
78 ComplexPairTy EmitLoadOfLValue(LValue LV, SourceLocation Loc);
82 void EmitStoreOfComplex(
ComplexPairTy Val, LValue LV,
bool isInit);
86 QualType DestType, SourceLocation Loc);
88 ComplexPairTy EmitScalarToComplexCast(llvm::Value *Val, QualType SrcType,
89 QualType DestType, SourceLocation Loc);
96 ApplyDebugLocation DL(CGF, E);
97 return StmtVisitor<ComplexExprEmitter, ComplexPairTy>::Visit(E);
102 llvm_unreachable(
"Stmt can't have complex result type!");
106 if (llvm::Constant *
Result = ConstantEmitter(CGF).tryEmitConstantExpr(E))
108 Result->getAggregateElement(1U));
114 ComplexPairTy VisitGenericSelectionExpr(GenericSelectionExpr *GE) {
115 return Visit(
GE->getResultExpr());
117 ComplexPairTy VisitImaginaryLiteral(
const ImaginaryLiteral *IL);
119 VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *PE) {
132 ComplexPairTy emitConstant(
const CodeGenFunction::ConstantEmission &Constant,
134 assert(Constant &&
"not a constant");
139 llvm::Constant *pair = Constant.
getValue();
141 pair->getAggregateElement(1U));
147 return emitConstant(Constant, E);
148 return EmitLoadOfLValue(E);
151 return EmitLoadOfLValue(E);
156 ComplexPairTy VisitArraySubscriptExpr(Expr *E) {
return EmitLoadOfLValue(E); }
158 if (CodeGenFunction::ConstantEmission Constant =
161 return emitConstant(Constant, ME);
163 return EmitLoadOfLValue(ME);
183 return EmitLoadOfLValue(E);
187 if (
const auto *ECE = dyn_cast<ExplicitCastExpr>(E))
190 return EmitLoadOfLValue(E);
197 ComplexPairTy VisitPrePostIncDec(
const UnaryOperator *E,
bool isInc,
203 return VisitPrePostIncDec(E,
false,
false);
206 return VisitPrePostIncDec(E,
true,
false);
209 return VisitPrePostIncDec(E,
false,
true);
212 return VisitPrePostIncDec(E,
true,
true);
214 ComplexPairTy VisitUnaryDeref(
const Expr *E) {
return EmitLoadOfLValue(E); }
217 QualType PromotionType = QualType());
218 ComplexPairTy VisitPlus(
const UnaryOperator *E, QualType PromotionType);
220 QualType PromotionType = QualType());
221 ComplexPairTy VisitMinus(
const UnaryOperator *E, QualType PromotionType);
227 ComplexPairTy VisitCXXDefaultArgExpr(CXXDefaultArgExpr *DAE) {
228 CodeGenFunction::CXXDefaultArgExprScope Scope(CGF, DAE);
231 ComplexPairTy VisitCXXDefaultInitExpr(CXXDefaultInitExpr *DIE) {
232 CodeGenFunction::CXXDefaultInitExprScope Scope(CGF, DIE);
236 CodeGenFunction::RunCleanupsScope Scope(CGF);
240 Scope.ForceCleanup({&Vals.first, &Vals.second});
243 ComplexPairTy VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
245 QualType Elem = E->
getType()->
castAs<ComplexType>()->getElementType();
246 llvm::Constant *
Null = llvm::Constant::getNullValue(CGF.
ConvertType(Elem));
249 ComplexPairTy VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
251 QualType Elem = E->
getType()->
castAs<ComplexType>()->getElementType();
252 llvm::Constant *
Null = llvm::Constant::getNullValue(CGF.
ConvertType(Elem));
260 FPOptions FPFeatures;
263 BinOpInfo EmitBinOps(
const BinaryOperator *E,
264 QualType PromotionTy = QualType());
265 ComplexPairTy EmitPromoted(
const Expr *E, QualType PromotionTy);
266 ComplexPairTy EmitPromotedComplexOperand(
const Expr *E, QualType PromotionTy);
267 LValue EmitCompoundAssignLValue(
268 const CompoundAssignOperator *E,
272 const CompoundAssignOperator *E,
279 ComplexPairTy EmitAlgebraicDiv(llvm::Value *A, llvm::Value *B, llvm::Value *
C,
281 ComplexPairTy EmitRangeReductionDiv(llvm::Value *A, llvm::Value *B,
282 llvm::Value *
C, llvm::Value *D);
285 const BinOpInfo &Op);
287 QualType HigherPrecisionTypeForComplexArithmetic(QualType ElementType) {
289 const QualType HigherElementType =
291 const llvm::fltSemantics &ElementTypeSemantics =
293 const llvm::fltSemantics &HigherElementTypeSemantics =
302 if (llvm::APFloat::semanticsMaxExponent(ElementTypeSemantics) * 2 + 1 <=
303 llvm::APFloat::semanticsMaxExponent(HigherElementTypeSemantics)) {
308 FPHasBeenPromoted =
true;
317 QualType getPromotionType(FPOptionsOverride Features, QualType Ty,
318 bool IsComplexDivisor) {
319 if (
auto *CT = Ty->
getAs<ComplexType>()) {
320 QualType ElementType = CT->getElementType().getCanonicalType();
322 bool IsComplexRangePromoted = CGF.
getLangOpts().getComplexRange() ==
323 LangOptions::ComplexRangeKind::CX_Promoted;
324 bool HasNoComplexRangeOverride = !Features.hasComplexRangeOverride();
325 bool HasMatchingComplexRange = Features.hasComplexRangeOverride() &&
326 Features.getComplexRangeOverride() ==
329 if (IsComplexDivisor && IsFloatingType && IsComplexRangePromoted &&
330 (HasNoComplexRangeOverride || HasMatchingComplexRange))
331 return HigherPrecisionTypeForComplexArithmetic(ElementType);
340#define HANDLEBINOP(OP) \
341 ComplexPairTy VisitBin##OP(const BinaryOperator *E) { \
342 QualType promotionTy = \
343 getPromotionType(E->getStoredFPFeaturesOrDefault(), E->getType(), \
344 (E->getOpcode() == BinaryOperatorKind::BO_Div && \
345 E->getRHS()->getType()->isAnyComplexType())); \
346 ComplexPairTy result = EmitBin##OP(EmitBinOps(E, promotionTy)); \
347 if (!promotionTy.isNull()) \
348 result = CGF.EmitUnPromotedValue(result, E->getType()); \
363 ComplexPairTy VisitBinAddAssign(
const CompoundAssignOperator *E) {
365 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinAdd);
367 ComplexPairTy VisitBinSubAssign(
const CompoundAssignOperator *E) {
369 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinSub);
371 ComplexPairTy VisitBinMulAssign(
const CompoundAssignOperator *E) {
373 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinMul);
375 ComplexPairTy VisitBinDivAssign(
const CompoundAssignOperator *E) {
377 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinDiv);
385 LValue EmitBinAssignLValue(
const BinaryOperator *E,
ComplexPairTy &Val);
390 VisitAbstractConditionalOperator(
const AbstractConditionalOperator *CO);
395 ComplexPairTy VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
396 return EmitLoadOfLValue(E);
417 return Builder.CreateStructGEP(addr, 0, addr.
getName() +
".realp");
422 return Builder.CreateStructGEP(addr, 1, addr.
getName() +
".imagp");
429 assert(lvalue.
isSimple() &&
"non-simple complex l-value?");
436 llvm::Value *Real =
nullptr, *Imag =
nullptr;
438 if (!IgnoreReal || isVolatile) {
440 Real = Builder.CreateLoad(RealP, isVolatile, SrcPtr.
getName() +
".real");
443 if (!IgnoreImag || isVolatile) {
445 Imag = Builder.CreateLoad(ImagP, isVolatile, SrcPtr.
getName() +
".imag");
455 if (lvalue.getType()->isAtomicType() ||
459 Address Ptr = lvalue.getAddress();
464 Builder.CreateStore(Val.first, RealPtr, lvalue.isVolatileQualified());
467 Builder.CreateStore(Val.second, ImagPtr, lvalue.isVolatileQualified());
479 llvm::Value *U = llvm::PoisonValue::get(EltTy);
484ComplexExprEmitter::VisitImaginaryLiteral(
const ImaginaryLiteral *IL) {
486 return ComplexPairTy(llvm::Constant::getNullValue(Imag->getType()), Imag);
489ComplexPairTy ComplexExprEmitter::VisitCallExpr(
const CallExpr *E) {
491 return EmitLoadOfLValue(E);
496ComplexPairTy ComplexExprEmitter::VisitStmtExpr(
const StmtExpr *E) {
499 assert(RetAlloca.
isValid() &&
"Expected complex return value");
508 SourceLocation Loc) {
510 SrcType = SrcType->
castAs<ComplexType>()->getElementType();
511 DestType = DestType->
castAs<ComplexType>()->getElementType();
523ComplexPairTy ComplexExprEmitter::EmitScalarToComplexCast(llvm::Value *Val,
526 SourceLocation Loc) {
528 DestType = DestType->
castAs<ComplexType>()->getElementType();
532 return ComplexPairTy(Val, llvm::Constant::getNullValue(Val->getType()));
539 llvm_unreachable(
"dependent cast kind in IR gen!");
543 case CK_AtomicToNonAtomic:
544 case CK_NonAtomicToAtomic:
546 case CK_LValueToRValue:
547 case CK_UserDefinedConversion:
550 case CK_LValueBitCast: {
556 case CK_LValueToRValueBitCast: {
562 return EmitLoadOfLValue(DestLV, Op->
getExprLoc());
566 case CK_BaseToDerived:
567 case CK_DerivedToBase:
568 case CK_UncheckedDerivedToBase:
571 case CK_ArrayToPointerDecay:
572 case CK_FunctionToPointerDecay:
573 case CK_NullToPointer:
574 case CK_NullToMemberPointer:
575 case CK_BaseToDerivedMemberPointer:
576 case CK_DerivedToBaseMemberPointer:
577 case CK_MemberPointerToBoolean:
578 case CK_ReinterpretMemberPointer:
579 case CK_ConstructorConversion:
580 case CK_IntegralToPointer:
581 case CK_PointerToIntegral:
582 case CK_PointerToBoolean:
585 case CK_IntegralCast:
586 case CK_BooleanToSignedIntegral:
587 case CK_IntegralToBoolean:
588 case CK_IntegralToFloating:
589 case CK_FloatingToIntegral:
590 case CK_FloatingToBoolean:
591 case CK_FloatingCast:
592 case CK_CPointerToObjCPointerCast:
593 case CK_BlockPointerToObjCPointerCast:
594 case CK_AnyPointerToBlockPointerCast:
595 case CK_ObjCObjectLValueCast:
596 case CK_FloatingComplexToReal:
597 case CK_FloatingComplexToBoolean:
598 case CK_IntegralComplexToReal:
599 case CK_IntegralComplexToBoolean:
600 case CK_ARCProduceObject:
601 case CK_ARCConsumeObject:
602 case CK_ARCReclaimReturnedObject:
603 case CK_ARCExtendBlockObject:
604 case CK_CopyAndAutoreleaseBlockObject:
605 case CK_BuiltinFnToFnPtr:
606 case CK_ZeroToOCLOpaqueType:
607 case CK_AddressSpaceConversion:
608 case CK_IntToOCLSampler:
609 case CK_FloatingToFixedPoint:
610 case CK_FixedPointToFloating:
611 case CK_FixedPointCast:
612 case CK_FixedPointToBoolean:
613 case CK_FixedPointToIntegral:
614 case CK_IntegralToFixedPoint:
616 case CK_HLSLVectorTruncation:
617 case CK_HLSLMatrixTruncation:
618 case CK_HLSLArrayRValue:
619 case CK_HLSLElementwiseCast:
620 case CK_HLSLAggregateSplatCast:
621 llvm_unreachable(
"invalid cast kind for complex value");
623 case CK_FloatingRealToComplex:
624 case CK_IntegralRealToComplex: {
630 case CK_FloatingComplexCast:
631 case CK_FloatingComplexToIntegralComplex:
632 case CK_IntegralComplexCast:
633 case CK_IntegralComplexToFloatingComplex: {
635 return EmitComplexToComplexCast(Visit(Op), Op->
getType(), DestTy,
640 llvm_unreachable(
"unknown cast resulting in complex value");
643ComplexPairTy ComplexExprEmitter::VisitUnaryPlus(
const UnaryOperator *E,
644 QualType PromotionType) {
645 QualType promotionTy =
652 if (!promotionTy.
isNull())
657ComplexPairTy ComplexExprEmitter::VisitPlus(
const UnaryOperator *E,
658 QualType PromotionType) {
659 TestAndClearIgnoreReal();
660 TestAndClearIgnoreImag();
661 if (!PromotionType.
isNull())
666ComplexPairTy ComplexExprEmitter::VisitUnaryMinus(
const UnaryOperator *E,
667 QualType PromotionType) {
668 QualType promotionTy =
675 if (!promotionTy.
isNull())
679ComplexPairTy ComplexExprEmitter::VisitMinus(
const UnaryOperator *E,
680 QualType PromotionType) {
681 TestAndClearIgnoreReal();
682 TestAndClearIgnoreImag();
684 if (!PromotionType.
isNull())
689 llvm::Value *ResR, *ResI;
690 if (Op.first->getType()->isFloatingPointTy()) {
691 ResR = Builder.CreateFNeg(Op.first,
"neg.r");
692 ResI = Builder.CreateFNeg(Op.second,
"neg.i");
694 ResR = Builder.CreateNeg(Op.first,
"neg.r");
695 ResI = Builder.CreateNeg(Op.second,
"neg.i");
700ComplexPairTy ComplexExprEmitter::VisitUnaryNot(
const UnaryOperator *E) {
701 TestAndClearIgnoreReal();
702 TestAndClearIgnoreImag();
706 if (Op.second->getType()->isFloatingPointTy())
707 ResI = Builder.CreateFNeg(Op.second,
"conj.i");
709 ResI = Builder.CreateNeg(Op.second,
"conj.i");
714ComplexPairTy ComplexExprEmitter::EmitBinAdd(
const BinOpInfo &Op) {
715 llvm::Value *ResR, *ResI;
717 if (Op.LHS.first->getType()->isFloatingPointTy()) {
719 ResR = Builder.CreateFAdd(Op.LHS.first, Op.RHS.first,
"add.r");
720 if (Op.LHS.second && Op.RHS.second)
721 ResI = Builder.CreateFAdd(Op.LHS.second, Op.RHS.second,
"add.i");
723 ResI = Op.LHS.second ? Op.LHS.second : Op.RHS.second;
724 assert(ResI &&
"Only one operand may be real!");
726 ResR = Builder.CreateAdd(Op.LHS.first, Op.RHS.first,
"add.r");
727 assert(Op.LHS.second && Op.RHS.second &&
728 "Both operands of integer complex operators must be complex!");
729 ResI = Builder.CreateAdd(Op.LHS.second, Op.RHS.second,
"add.i");
734ComplexPairTy ComplexExprEmitter::EmitBinSub(
const BinOpInfo &Op) {
735 llvm::Value *ResR, *ResI;
736 if (Op.LHS.first->getType()->isFloatingPointTy()) {
738 ResR = Builder.CreateFSub(Op.LHS.first, Op.RHS.first,
"sub.r");
739 if (Op.LHS.second && Op.RHS.second)
740 ResI = Builder.CreateFSub(Op.LHS.second, Op.RHS.second,
"sub.i");
742 ResI = Op.LHS.second ? Op.LHS.second
743 : Builder.CreateFNeg(Op.RHS.second,
"sub.i");
744 assert(ResI &&
"Only one operand may be real!");
746 ResR = Builder.CreateSub(Op.LHS.first, Op.RHS.first,
"sub.r");
747 assert(Op.LHS.second && Op.RHS.second &&
748 "Both operands of integer complex operators must be complex!");
749 ResI = Builder.CreateSub(Op.LHS.second, Op.RHS.second,
"sub.i");
755ComplexPairTy ComplexExprEmitter::EmitComplexBinOpLibCall(StringRef LibCallName,
756 const BinOpInfo &Op) {
759 Op.Ty->castAs<ComplexType>()->getElementType());
761 Op.Ty->castAs<ComplexType>()->getElementType());
763 Op.Ty->castAs<ComplexType>()->getElementType());
765 Op.Ty->castAs<ComplexType>()->getElementType());
773 FunctionProtoType::ExtProtoInfo EPI;
776 SmallVector<QualType, 4> ArgsQTys(
777 4, Op.Ty->castAs<ComplexType>()->getElementType());
784 FTy, LibCallName, llvm::AttributeList(),
true);
787 llvm::CallBase *
Call;
796 switch (Ty->getTypeID()) {
798 llvm_unreachable(
"Unsupported floating point type!");
799 case llvm::Type::HalfTyID:
801 case llvm::Type::FloatTyID:
803 case llvm::Type::DoubleTyID:
805 case llvm::Type::PPC_FP128TyID:
807 case llvm::Type::X86_FP80TyID:
809 case llvm::Type::FP128TyID:
816ComplexPairTy ComplexExprEmitter::EmitBinMul(
const BinOpInfo &Op) {
821 if (Op.LHS.first->getType()->isFloatingPointTy()) {
829 if (Op.LHS.second && Op.RHS.second) {
840 Value *AC = Builder.CreateFMul(Op.LHS.first, Op.RHS.first,
"mul_ac");
841 Value *BD = Builder.CreateFMul(Op.LHS.second, Op.RHS.second,
"mul_bd");
842 Value *AD = Builder.CreateFMul(Op.LHS.first, Op.RHS.second,
"mul_ad");
843 Value *BC = Builder.CreateFMul(Op.LHS.second, Op.RHS.first,
"mul_bc");
847 ResR = Builder.CreateFSub(AC, BD,
"mul_r");
848 ResI = Builder.CreateFAdd(AD, BC,
"mul_i");
857 Value *IsRNaN = Builder.CreateFCmpUNO(ResR, ResR,
"isnan_cmp");
860 llvm::Instruction *Branch = Builder.CreateCondBr(IsRNaN, INaNBB, ContBB);
861 llvm::BasicBlock *OrigBB = Branch->getParent();
864 llvm::MDNode *BrWeight = MDHelper.createUnlikelyBranchWeights();
865 Branch->setMetadata(llvm::LLVMContext::MD_prof, BrWeight);
869 Value *IsINaN = Builder.CreateFCmpUNO(ResI, ResI,
"isnan_cmp");
871 Branch = Builder.CreateCondBr(IsINaN, LibCallBB, ContBB);
872 Branch->setMetadata(llvm::LLVMContext::MD_prof, BrWeight);
876 Value *LibCallR, *LibCallI;
877 std::tie(LibCallR, LibCallI) = EmitComplexBinOpLibCall(
879 Builder.CreateBr(ContBB);
884 llvm::PHINode *RealPHI =
885 Builder.CreatePHI(ResR->
getType(), 3,
"real_mul_phi");
886 RealPHI->addIncoming(ResR, OrigBB);
887 RealPHI->addIncoming(ResR, INaNBB);
888 RealPHI->addIncoming(LibCallR, LibCallBB);
889 llvm::PHINode *ImagPHI =
890 Builder.CreatePHI(ResI->
getType(), 3,
"imag_mul_phi");
891 ImagPHI->addIncoming(ResI, OrigBB);
892 ImagPHI->addIncoming(ResI, INaNBB);
893 ImagPHI->addIncoming(LibCallI, LibCallBB);
896 assert((Op.LHS.second || Op.RHS.second) &&
897 "At least one operand must be complex!");
902 ResR = Builder.CreateFMul(Op.LHS.first, Op.RHS.first,
"mul.rl");
905 ? Builder.CreateFMul(Op.LHS.second, Op.RHS.first,
"mul.il")
906 : Builder.CreateFMul(Op.LHS.first, Op.RHS.second,
"mul.ir");
908 assert(Op.LHS.second && Op.RHS.second &&
909 "Both operands of integer complex operators must be complex!");
910 Value *ResRl = Builder.CreateMul(Op.LHS.first, Op.RHS.first,
"mul.rl");
911 Value *ResRr = Builder.CreateMul(Op.LHS.second, Op.RHS.second,
"mul.rr");
912 ResR = Builder.CreateSub(ResRl, ResRr,
"mul.r");
914 Value *ResIl = Builder.CreateMul(Op.LHS.second, Op.RHS.first,
"mul.il");
915 Value *ResIr = Builder.CreateMul(Op.LHS.first, Op.RHS.second,
"mul.ir");
916 ResI = Builder.CreateAdd(ResIl, ResIr,
"mul.i");
921ComplexPairTy ComplexExprEmitter::EmitAlgebraicDiv(llvm::Value *LHSr,
926 llvm::Value *DSTr, *DSTi;
928 llvm::Value *AC = Builder.CreateFMul(LHSr, RHSr);
929 llvm::Value *BD = Builder.CreateFMul(LHSi, RHSi);
930 llvm::Value *ACpBD = Builder.CreateFAdd(AC, BD);
932 llvm::Value *CC = Builder.CreateFMul(RHSr, RHSr);
933 llvm::Value *DD = Builder.CreateFMul(RHSi, RHSi);
934 llvm::Value *CCpDD = Builder.CreateFAdd(CC, DD);
936 llvm::Value *BC = Builder.CreateFMul(LHSi, RHSr);
937 llvm::Value *AD = Builder.CreateFMul(LHSr, RHSi);
938 llvm::Value *BCmAD = Builder.CreateFSub(BC, AD);
940 DSTr = Builder.CreateFDiv(ACpBD, CCpDD);
941 DSTi = Builder.CreateFDiv(BCmAD, CCpDD);
947 llvm::Function *
Func =
955ComplexPairTy ComplexExprEmitter::EmitRangeReductionDiv(llvm::Value *LHSr,
966 llvm::Value *IsR = Builder.CreateFCmpUGT(FAbsRHSr, FAbsRHSi,
"abs_cmp");
968 llvm::BasicBlock *TrueBB =
970 llvm::BasicBlock *FalseBB =
973 Builder.CreateCondBr(IsR, TrueBB, FalseBB);
981 llvm::Value *DdC = Builder.CreateFDiv(RHSi, RHSr);
983 llvm::Value *RD = Builder.CreateFMul(DdC, RHSi);
984 llvm::Value *CpRD = Builder.CreateFAdd(RHSr, RD);
986 llvm::Value *T3 = Builder.CreateFMul(LHSi, DdC);
987 llvm::Value *T4 = Builder.CreateFAdd(LHSr, T3);
988 llvm::Value *DSTTr = Builder.CreateFDiv(T4, CpRD);
990 llvm::Value *T5 = Builder.CreateFMul(LHSr, DdC);
991 llvm::Value *T6 = Builder.CreateFSub(LHSi, T5);
992 llvm::Value *DSTTi = Builder.CreateFDiv(T6, CpRD);
993 Builder.CreateBr(ContBB);
1001 llvm::Value *CdD = Builder.CreateFDiv(RHSr, RHSi);
1003 llvm::Value *RC = Builder.CreateFMul(CdD, RHSr);
1004 llvm::Value *DpRC = Builder.CreateFAdd(RHSi, RC);
1006 llvm::Value *T7 = Builder.CreateFMul(LHSr, CdD);
1007 llvm::Value *T8 = Builder.CreateFAdd(T7, LHSi);
1008 llvm::Value *DSTFr = Builder.CreateFDiv(T8, DpRC);
1010 llvm::Value *T9 = Builder.CreateFMul(LHSi, CdD);
1011 llvm::Value *T10 = Builder.CreateFSub(T9, LHSr);
1012 llvm::Value *DSTFi = Builder.CreateFDiv(T10, DpRC);
1013 Builder.CreateBr(ContBB);
1017 llvm::PHINode *VALr = Builder.CreatePHI(DSTTr->getType(), 2);
1018 VALr->addIncoming(DSTTr, TrueBB);
1019 VALr->addIncoming(DSTFr, FalseBB);
1020 llvm::PHINode *VALi = Builder.CreatePHI(DSTTi->getType(), 2);
1021 VALi->addIncoming(DSTTi, TrueBB);
1022 VALi->addIncoming(DSTFi, FalseBB);
1028ComplexPairTy ComplexExprEmitter::EmitBinDiv(
const BinOpInfo &Op) {
1029 llvm::Value *LHSr = Op.LHS.first, *LHSi = Op.LHS.second;
1030 llvm::Value *RHSr = Op.RHS.first, *RHSi = Op.RHS.second;
1031 llvm::Value *DSTr, *DSTi;
1032 if (LHSr->getType()->isFloatingPointTy()) {
1035 assert(LHSi &&
"Can have at most one non-complex operand!");
1037 DSTr = Builder.CreateFDiv(LHSr, RHSr);
1038 DSTi = Builder.CreateFDiv(LHSi, RHSr);
1041 llvm::Value *OrigLHSi = LHSi;
1043 LHSi = llvm::Constant::getNullValue(RHSi->getType());
1046 !FPHasBeenPromoted))
1047 return EmitRangeReductionDiv(LHSr, LHSi, RHSr, RHSi);
1050 return EmitAlgebraicDiv(LHSr, LHSi, RHSr, RHSi);
1059 BinOpInfo LibCallOp = Op;
1062 LibCallOp.LHS.second = llvm::Constant::getNullValue(LHSr->getType());
1064 switch (LHSr->getType()->getTypeID()) {
1066 llvm_unreachable(
"Unsupported floating point type!");
1067 case llvm::Type::HalfTyID:
1068 return EmitComplexBinOpLibCall(
"__divhc3", LibCallOp);
1069 case llvm::Type::FloatTyID:
1070 return EmitComplexBinOpLibCall(
"__divsc3", LibCallOp);
1071 case llvm::Type::DoubleTyID:
1072 return EmitComplexBinOpLibCall(
"__divdc3", LibCallOp);
1073 case llvm::Type::PPC_FP128TyID:
1074 return EmitComplexBinOpLibCall(
"__divtc3", LibCallOp);
1075 case llvm::Type::X86_FP80TyID:
1076 return EmitComplexBinOpLibCall(
"__divxc3", LibCallOp);
1077 case llvm::Type::FP128TyID:
1078 return EmitComplexBinOpLibCall(
"__divtc3", LibCallOp);
1081 return EmitAlgebraicDiv(LHSr, LHSi, RHSr, RHSi);
1084 assert(Op.LHS.second && Op.RHS.second &&
1085 "Both operands of integer complex operators must be complex!");
1087 llvm::Value *Tmp1 = Builder.CreateMul(LHSr, RHSr);
1088 llvm::Value *Tmp2 = Builder.CreateMul(LHSi, RHSi);
1089 llvm::Value *Tmp3 = Builder.CreateAdd(Tmp1, Tmp2);
1091 llvm::Value *Tmp4 = Builder.CreateMul(RHSr, RHSr);
1092 llvm::Value *Tmp5 = Builder.CreateMul(RHSi, RHSi);
1093 llvm::Value *Tmp6 = Builder.CreateAdd(Tmp4, Tmp5);
1095 llvm::Value *Tmp7 = Builder.CreateMul(LHSi, RHSr);
1096 llvm::Value *Tmp8 = Builder.CreateMul(LHSr, RHSi);
1097 llvm::Value *Tmp9 = Builder.CreateSub(Tmp7, Tmp8);
1099 if (Op.Ty->castAs<ComplexType>()
1101 ->isUnsignedIntegerType()) {
1102 DSTr = Builder.CreateUDiv(Tmp3, Tmp6);
1103 DSTi = Builder.CreateUDiv(Tmp9, Tmp6);
1105 DSTr = Builder.CreateSDiv(Tmp3, Tmp6);
1106 DSTi = Builder.CreateSDiv(Tmp9, Tmp6);
1115 llvm::Type *ComplexElementTy =
1119 Builder.CreateFPTrunc(result.first, ComplexElementTy,
"unpromotion");
1122 Builder.CreateFPTrunc(result.second, ComplexElementTy,
"unpromotion");
1128 llvm::Type *ComplexElementTy =
1131 result.first =
Builder.CreateFPExt(result.first, ComplexElementTy,
"ext");
1133 result.second =
Builder.CreateFPExt(result.second, ComplexElementTy,
"ext");
1141 if (
auto BO = dyn_cast<BinaryOperator>(E)) {
1142 switch (BO->getOpcode()) {
1143#define HANDLE_BINOP(OP) \
1145 return EmitBin##OP(EmitBinOps(BO, PromotionType));
1154 }
else if (
auto UO = dyn_cast<UnaryOperator>(E)) {
1155 switch (UO->getOpcode()) {
1157 return VisitMinus(UO, PromotionType);
1159 return VisitPlus(UO, PromotionType);
1164 auto result = Visit(
const_cast<Expr *
>(E));
1165 if (!PromotionType.
isNull())
1173 return ComplexExprEmitter(*this).EmitPromoted(E, DstTy);
1177ComplexExprEmitter::EmitPromotedComplexOperand(
const Expr *E,
1180 if (!OverallPromotionType.
isNull())
1183 return Visit(
const_cast<Expr *
>(E));
1185 if (!OverallPromotionType.
isNull()) {
1196ComplexExprEmitter::BinOpInfo
1197ComplexExprEmitter::EmitBinOps(
const BinaryOperator *E,
1198 QualType PromotionType) {
1199 TestAndClearIgnoreReal();
1200 TestAndClearIgnoreImag();
1203 Ops.LHS = EmitPromotedComplexOperand(E->
getLHS(), PromotionType);
1204 Ops.RHS = EmitPromotedComplexOperand(E->
getRHS(), PromotionType);
1205 if (!PromotionType.
isNull())
1206 Ops.Ty = PromotionType;
1213LValue ComplexExprEmitter::EmitCompoundAssignLValue(
1214 const CompoundAssignOperator *E,
1216 TestAndClearIgnoreReal();
1217 TestAndClearIgnoreImag();
1219 if (
const AtomicType *AT = LHSTy->
getAs<AtomicType>())
1220 LHSTy = AT->getValueType();
1226 const bool IsComplexDivisor = E->
getOpcode() == BO_DivAssign &&
1232 QualType PromotionTypeCR;
1236 if (PromotionTypeCR.
isNull())
1238 OpInfo.Ty = PromotionTypeCR;
1239 QualType ComplexElementTy =
1240 OpInfo.Ty->castAs<ComplexType>()->getElementType();
1241 QualType PromotionTypeRHS =
1247 if (!PromotionTypeRHS.
isNull())
1257 if (!PromotionTypeRHS.
isNull()) {
1263 OpInfo.RHS = Visit(E->
getRHS());
1271 QualType PromotionTypeLHS =
1276 if (!PromotionTypeLHS.
isNull())
1278 EmitComplexToComplexCast(LHSVal, LHSTy, PromotionTypeLHS, Loc);
1280 OpInfo.LHS = EmitComplexToComplexCast(LHSVal, LHSTy, OpInfo.Ty, Loc);
1286 QualType PromotedComplexElementTy;
1287 if (!PromotionTypeLHS.
isNull()) {
1288 PromotedComplexElementTy =
1293 PromotedComplexElementTy, Loc);
1301 OpInfo.LHS = EmitScalarToComplexCast(LHSVal, LHSTy, OpInfo.Ty, Loc);
1311 EmitComplexToComplexCast(
Result, OpInfo.Ty, LHSTy, Loc);
1312 EmitStoreOfComplex(ResVal, LHS,
false);
1315 llvm::Value *ResVal =
1326 const CompoundAssignOperator *E,
1329 LValue LV = EmitCompoundAssignLValue(E,
Func, Val);
1336 if (!LV.isVolatileQualified())
1339 return EmitLoadOfLValue(LV, E->
getExprLoc());
1342LValue ComplexExprEmitter::EmitBinAssignLValue(
const BinaryOperator *E,
1346 "Invalid assignment");
1347 TestAndClearIgnoreReal();
1348 TestAndClearIgnoreImag();
1351 Val = Visit(E->
getRHS());
1357 EmitStoreOfComplex(Val, LHS,
false);
1362ComplexPairTy ComplexExprEmitter::VisitBinAssign(
const BinaryOperator *E) {
1365 LValue LV = EmitBinAssignLValue(E, Val);
1372 if (!LV.isVolatileQualified())
1375 return EmitLoadOfLValue(LV, E->
getExprLoc());
1378ComplexPairTy ComplexExprEmitter::VisitBinComma(
const BinaryOperator *E) {
1380 return Visit(E->
getRHS());
1383ComplexPairTy ComplexExprEmitter::VisitAbstractConditionalOperator(
1384 const AbstractConditionalOperator *E) {
1385 TestAndClearIgnoreReal();
1386 TestAndClearIgnoreImag();
1402 LHSBlock = Builder.GetInsertBlock();
1410 RHSBlock = Builder.GetInsertBlock();
1415 llvm::PHINode *RealPN = Builder.CreatePHI(LHS.first->getType(), 2,
"cond.r");
1416 RealPN->addIncoming(LHS.first, LHSBlock);
1417 RealPN->addIncoming(RHS.first, RHSBlock);
1420 llvm::PHINode *ImagPN = Builder.CreatePHI(LHS.first->getType(), 2,
"cond.i");
1421 ImagPN->addIncoming(LHS.second, LHSBlock);
1422 ImagPN->addIncoming(RHS.second, RHSBlock);
1427ComplexPairTy ComplexExprEmitter::VisitChooseExpr(ChooseExpr *E) {
1431ComplexPairTy ComplexExprEmitter::VisitInitListExpr(InitListExpr *E) {
1432 bool Ignore = TestAndClearIgnoreReal();
1434 assert(Ignore ==
false &&
"init list ignored");
1435 Ignore = TestAndClearIgnoreImag();
1437 assert(Ignore ==
false &&
"init list ignored");
1448 assert(E->
getNumInits() == 0 &&
"Unexpected number of inits");
1449 QualType Ty = E->
getType()->
castAs<ComplexType>()->getElementType();
1451 llvm::Value *zeroConstant = llvm::Constant::getNullValue(LTy);
1455ComplexPairTy ComplexExprEmitter::VisitVAArgExpr(VAArgExpr *E) {
1463 llvm::Value *U = llvm::PoisonValue::get(EltTy);
1479 "Invalid complex expression to emit");
1481 return ComplexExprEmitter(*
this, IgnoreReal, IgnoreImag)
1482 .Visit(
const_cast<Expr *
>(E));
1488 "Invalid complex expression to emit");
1489 ComplexExprEmitter
Emitter(*
this);
1491 Emitter.EmitStoreOfComplex(Val, dest, isInit);
1497 ComplexExprEmitter(*this).EmitStoreOfComplex(
V, dest, isInit);
1503 return ComplexExprEmitter(*this).EmitLoadOfLValue(src, loc);
1509 LValue LVal = ComplexExprEmitter(*this).EmitBinAssignLValue(E, Val);
1511 CGM.getOpenMPRuntime().checkAndEmitLastprivateConditional(*
this,
1517 const ComplexExprEmitter::BinOpInfo &);
1522 return &ComplexExprEmitter::EmitBinMul;
1524 return &ComplexExprEmitter::EmitBinDiv;
1526 return &ComplexExprEmitter::EmitBinSub;
1528 return &ComplexExprEmitter::EmitBinAdd;
1530 llvm_unreachable(
"unexpected complex compound assignment");
1539 return ComplexExprEmitter(*this).EmitCompoundAssignLValue(E, Op, Val);
1548 LValue Ret = ComplexExprEmitter(*this).EmitCompoundAssignLValue(E, Op, Val);
static const ComplexType * getComplexType(QualType type)
Return the complex type that we are meant to emit.
CodeGenFunction::ComplexPairTy ComplexPairTy
static llvm::Value * EmitllvmFAbs(CodeGenFunction &CGF, llvm::Value *Value)
static StringRef getComplexMultiplyLibCallName(llvm::Type *Ty)
Lookup the libcall name for a given floating point type complex multiply.
static CompoundFunc getComplexOp(BinaryOperatorKind op)
static const ComplexType * getComplexType(QualType type)
Return the complex type that we are meant to emit.
mlir::Value(ComplexExprEmitter::*)(const ComplexExprEmitter::BinOpInfo &) CompoundFunc
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
const QualType GetHigherPrecisionFPType(QualType ElementType) const
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type.
const TargetInfo & getTargetInfo() const
static bool hasSameUnqualifiedType(QualType T1, QualType T2)
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
Expr * getCond() const
getCond - Return the expression representing the condition for the ?
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression representing the value of the expression if the condition eval...
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression representing the value of the expression if the condition eva...
A builtin binary operation expression such as "x + y" or "x <= y".
FPOptionsOverride getStoredFPFeaturesOrDefault() const
Get the store FPOptionsOverride or default if not stored.
SourceLocation getExprLoc() const
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const
Get the FP features status of this operator.
Expr * getExpr()
Get the initialization expression that will be used.
A rewritten comparison expression that was originally written using operator syntax.
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
CastKind getCastKind() const
bool changesVolatileQualification() const
Return.
Expr * getChosenSubExpr() const
getChosenSubExpr - Return the subexpression chosen according to the condition.
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
llvm::StringRef getName() const
Return the IR name of the pointer value.
A scoped helper to set the current source atom group for CGDebugInfo::addInstToCurrentSourceAtom.
All available information about a concrete callee.
static CGCallee forDirect(llvm::Constant *functionPtr, const CGCalleeInfo &abstractInfo=CGCalleeInfo())
CGFunctionInfo - Class to encapsulate the information about a function definition.
CallArgList - Type for representing both the value and type of arguments in a call.
void add(RValue rvalue, QualType type)
An object to manage conditionally-evaluated expressions.
LValue getReferenceLValue(CodeGenFunction &CGF, const Expr *RefExpr) const
llvm::Constant * getValue() const
An RAII object to set (and then clear) a mapping for an OpaqueValueExpr.
An RAII object to record that we're evaluating a statement expression.
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
void EmitBranchOnBoolExpr(const Expr *Cond, llvm::BasicBlock *TrueBlock, llvm::BasicBlock *FalseBlock, uint64_t TrueCount, Stmt::Likelihood LH=Stmt::LH_None, const Expr *ConditionalOp=nullptr, const VarDecl *ConditionalDecl=nullptr)
EmitBranchOnBoolExpr - Emit a branch on a boolean condition (e.g.
RValue EmitObjCMessageExpr(const ObjCMessageExpr *E, ReturnValueSlot Return=ReturnValueSlot())
ComplexPairTy EmitComplexPrePostIncDec(const UnaryOperator *E, LValue LV, bool isInc, bool isPre)
@ UseSkipPath
Skip (false)
void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit)
EmitComplexExprIntoLValue - Emit the given expression of complex type and place its result into the s...
llvm::Type * ConvertType(QualType T)
ComplexPairTy EmitLoadOfComplex(LValue src, SourceLocation loc)
EmitLoadOfComplex - Load a complex number from the specified l-value.
RValue EmitVAArg(VAArgExpr *VE, Address &VAListAddr, AggValueSlot Slot=AggValueSlot::ignored())
Generate code to get an argument from the passed in pointer and update it accordingly.
RValue EmitPseudoObjectRValue(const PseudoObjectExpr *e, AggValueSlot slot=AggValueSlot::ignored())
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
void addInstToCurrentSourceAtom(llvm::Instruction *KeyInstruction, llvm::Value *Backup)
See CGDebugInfo::addInstToCurrentSourceAtom.
llvm::Value * EmitPromotedScalarExpr(const Expr *E, QualType PromotionType)
const LangOptions & getLangOpts() const
LValue EmitComplexCompoundAssignmentLValue(const CompoundAssignOperator *E)
ComplexPairTy EmitPromotedComplexExpr(const Expr *E, QualType PromotionType)
LValue EmitScalarCompoundAssignWithComplex(const CompoundAssignOperator *E, llvm::Value *&Result)
void EmitIgnoredExpr(const Expr *E)
EmitIgnoredExpr - Emit an expression in a context which ignores the result.
RValue EmitCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue=ReturnValueSlot(), llvm::CallBase **CallOrInvoke=nullptr)
RValue EmitLoadOfLValue(LValue V, SourceLocation Loc)
EmitLoadOfLValue - Given an expression that represents a value lvalue, this method emits the address ...
llvm::Value * EmitComplexToScalarConversion(ComplexPairTy Src, QualType SrcTy, QualType DstTy, SourceLocation Loc)
Emit a conversion from the specified complex type to the specified destination type,...
Address emitAddrOfImagComponent(Address complex, QualType complexType)
RValue EmitCoyieldExpr(const CoyieldExpr &E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
RValue getOrCreateOpaqueRValueMapping(const OpaqueValueExpr *e)
Given an opaque value expression, return its RValue mapping if it exists, otherwise create one.
RValue EmitAtomicLoad(LValue LV, SourceLocation SL, AggValueSlot Slot=AggValueSlot::ignored())
CGDebugInfo * getDebugInfo()
LValue getOrCreateOpaqueLValueMapping(const OpaqueValueExpr *e)
Given an opaque value expression, return its LValue mapping if it exists, otherwise create one.
ComplexPairTy EmitComplexExpr(const Expr *E, bool IgnoreReal=false, bool IgnoreImag=false)
EmitComplexExpr - Emit the computation of the specified expression of complex type,...
RValue EmitCall(const CGFunctionInfo &CallInfo, const CGCallee &Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, llvm::CallBase **CallOrInvoke, bool IsMustTail, SourceLocation Loc, bool IsVirtualFunctionPointerThunk=false)
EmitCall - Generate a call of the given function, expecting the given result type,...
ASTContext & getContext() const
void EmitStoreOfComplex(ComplexPairTy V, LValue dest, bool isInit)
EmitStoreOfComplex - Store a complex number into the specified l-value.
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
EmitStoreThroughLValue - Store the specified rvalue into the specified lvalue, where both are guarant...
Address EmitCompoundStmt(const CompoundStmt &S, bool GetLast=false, AggValueSlot AVS=AggValueSlot::ignored())
EmitCompoundStmt - Emit a compound statement {..} node.
LValue EmitComplexAssignmentLValue(const BinaryOperator *E)
Emit an l-value for an assignment (simple or compound) of complex type.
llvm::Type * ConvertTypeForMem(QualType T)
RValue EmitAtomicExpr(AtomicExpr *E)
RValue EmitCoawaitExpr(const CoawaitExpr &E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
void EmitBranch(llvm::BasicBlock *Block)
EmitBranch - Emit a branch to the specified basic block from the current insert block,...
bool LValueIsSuitableForInlineAtomic(LValue Src)
An LValue is a candidate for having its loads and stores be made atomic if we are operating under /vo...
Address emitAddrOfRealComponent(Address complex, QualType complexType)
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
EmitScalarExpr - Emit the computation of the specified expression of LLVM scalar type,...
ComplexPairTy EmitUnPromotedValue(ComplexPairTy result, QualType PromotionType)
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
void EmitAtomicStore(RValue rvalue, LValue lvalue, bool isInit)
uint64_t getProfileCount(const Stmt *S)
Get the profiler's count for the given statement.
void ErrorUnsupported(const Stmt *S, const char *Type)
ErrorUnsupported - Print out an error that codegen doesn't support the specified stmt yet.
std::pair< llvm::Value *, llvm::Value * > ComplexPairTy
ConstantEmission tryEmitAsConstant(const DeclRefExpr *RefExpr)
Try to emit a reference to the given value without producing it as an l-value.
LValue EmitLValue(const Expr *E, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
EmitLValue - Emit code to compute a designator that specifies the location of the expression.
llvm::LLVMContext & getLLVMContext()
ComplexPairTy EmitPromotedValue(ComplexPairTy result, QualType PromotionType)
void incrementProfileCounter(const Stmt *S, llvm::Value *StepV=nullptr)
Increment the profiler's counter for the given statement by StepV.
llvm::Value * EmitScalarConversion(llvm::Value *Src, QualType SrcTy, QualType DstTy, SourceLocation Loc)
Emit a conversion from the specified type to the specified destination type, both of which are LLVM s...
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
void EmitExplicitCastExprType(const ExplicitCastExpr *E, CodeGenFunction *CGF=nullptr)
Emit type info if type of an expression is a variably modified type.
llvm::FunctionCallee CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeList ExtraAttrs=llvm::AttributeList(), bool Local=false, bool AssumeConvergent=false)
Create or return a runtime function declaration with the specified type and name.
CodeGenTypes & getTypes()
llvm::Function * getIntrinsic(unsigned IID, ArrayRef< llvm::Type * > Tys={})
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.
const CGFunctionInfo & arrangeFreeFunctionCall(const CallArgList &Args, const FunctionType *Ty, bool ChainCall)
Figure out the rules for calling a function with the given formal type using the given arguments.
LValue - This represents an lvalue references.
bool isVolatileQualified() const
Address getAddress() const
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
static RValue get(llvm::Value *V)
static RValue getComplex(llvm::Value *V1, llvm::Value *V2)
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
std::pair< llvm::Value *, llvm::Value * > getComplexVal() const
getComplexVal - Return the real/imag components of this complex value.
ReturnValueSlot - Contains the address where the return value of a function can be stored,...
Complex values, per C99 6.2.5p11.
QualType getElementType() const
CompoundAssignOperator - For compound assignments (e.g.
QualType getComputationLHSType() const
QualType getComputationResultType() const
This represents one expression.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
const Expr * getSubExpr() const
const Expr * getSubExpr() const
unsigned getNumInits() const
const Expr * getInit(unsigned Init) const
@ CX_Full
Implementation of complex division and multiplication using a call to runtime library functions(gener...
@ CX_Basic
Implementation of complex division and multiplication using algebraic formulas at source precision.
@ CX_Promoted
Implementation of complex division using algebraic formulas at higher precision.
@ CX_Improved
Implementation of complex division offering an improved handling for overflow in intermediate calcula...
SourceLocation getExprLoc() const LLVM_READONLY
Expr * getSelectedExpr() const
const Expr * getSubExpr() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool UseExcessPrecision(const ASTContext &Ctx)
Encodes a location in the source.
CompoundStmt * getSubStmt()
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
Expr * getReplacement() const
virtual bool hasLongDoubleType() const
Determine whether the long double type is supported on this target.
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isAnyComplexType() const
bool isAtomicType() const
bool isRealFloatingType() const
Floating point categories.
bool isFloatingType() const
const T * getAs() const
Member-template getAs<specific type>'.
Expr * getSubExpr() const
FPOptionsOverride getStoredFPFeaturesOrDefault() const
Get the store FPOptionsOverride or default if not stored.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ComplexType > complexType
bool Null(InterpState &S, CodePtr OpPC, uint64_t Value, const Descriptor *Desc)
bool GE(InterpState &S, CodePtr OpPC)
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.
CastKind
CastKind - The kind of operation required for a conversion.
U cast(CodeGen::Address addr)
@ EST_BasicNoexcept
noexcept
llvm::CallingConv::ID getRuntimeCC() const
static TBAAAccessInfo getMayAliasInfo()
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &ESI)