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));
112 ComplexPairTy VisitGenericSelectionExpr(GenericSelectionExpr *GE) {
113 return Visit(
GE->getResultExpr());
115 ComplexPairTy VisitImaginaryLiteral(
const ImaginaryLiteral *IL);
117 VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *PE) {
130 ComplexPairTy emitConstant(
const CodeGenFunction::ConstantEmission &Constant,
132 assert(Constant &&
"not a constant");
137 llvm::Constant *pair = Constant.
getValue();
139 pair->getAggregateElement(1U));
145 return emitConstant(Constant, E);
146 return EmitLoadOfLValue(E);
149 return EmitLoadOfLValue(E);
154 ComplexPairTy VisitArraySubscriptExpr(Expr *E) {
return EmitLoadOfLValue(E); }
156 if (CodeGenFunction::ConstantEmission Constant =
159 return emitConstant(Constant, ME);
161 return EmitLoadOfLValue(ME);
181 return EmitLoadOfLValue(E);
185 if (
const auto *ECE = dyn_cast<ExplicitCastExpr>(E))
188 return EmitLoadOfLValue(E);
196 bool isInc,
bool isPre) {
201 return VisitPrePostIncDec(E,
false,
false);
204 return VisitPrePostIncDec(E,
true,
false);
207 return VisitPrePostIncDec(E,
false,
true);
210 return VisitPrePostIncDec(E,
true,
true);
212 ComplexPairTy VisitUnaryDeref(
const Expr *E) {
return EmitLoadOfLValue(E); }
215 QualType PromotionType = QualType());
216 ComplexPairTy VisitPlus(
const UnaryOperator *E, QualType PromotionType);
218 QualType PromotionType = QualType());
219 ComplexPairTy VisitMinus(
const UnaryOperator *E, QualType PromotionType);
225 ComplexPairTy VisitCXXDefaultArgExpr(CXXDefaultArgExpr *DAE) {
226 CodeGenFunction::CXXDefaultArgExprScope Scope(CGF, DAE);
229 ComplexPairTy VisitCXXDefaultInitExpr(CXXDefaultInitExpr *DIE) {
230 CodeGenFunction::CXXDefaultInitExprScope Scope(CGF, DIE);
234 CodeGenFunction::RunCleanupsScope Scope(CGF);
238 Scope.ForceCleanup({&Vals.first, &Vals.second});
241 ComplexPairTy VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
243 QualType Elem = E->
getType()->
castAs<ComplexType>()->getElementType();
244 llvm::Constant *
Null = llvm::Constant::getNullValue(CGF.
ConvertType(Elem));
247 ComplexPairTy VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
249 QualType Elem = E->
getType()->
castAs<ComplexType>()->getElementType();
250 llvm::Constant *
Null =
251 llvm::Constant::getNullValue(CGF.
ConvertType(Elem));
259 FPOptions FPFeatures;
262 BinOpInfo EmitBinOps(
const BinaryOperator *E,
263 QualType PromotionTy = QualType());
264 ComplexPairTy EmitPromoted(
const Expr *E, QualType PromotionTy);
265 ComplexPairTy EmitPromotedComplexOperand(
const Expr *E, QualType PromotionTy);
266 LValue EmitCompoundAssignLValue(
const CompoundAssignOperator *E,
270 ComplexPairTy EmitCompoundAssign(
const CompoundAssignOperator *E,
272 (
const BinOpInfo &));
278 ComplexPairTy EmitAlgebraicDiv(llvm::Value *A, llvm::Value *B, llvm::Value *
C,
280 ComplexPairTy EmitRangeReductionDiv(llvm::Value *A, llvm::Value *B,
281 llvm::Value *
C, llvm::Value *D);
284 const BinOpInfo &Op);
286 QualType HigherPrecisionTypeForComplexArithmetic(QualType ElementType) {
288 const QualType HigherElementType =
290 const llvm::fltSemantics &ElementTypeSemantics =
292 const llvm::fltSemantics &HigherElementTypeSemantics =
301 if (llvm::APFloat::semanticsMaxExponent(ElementTypeSemantics) * 2 + 1 <=
302 llvm::APFloat::semanticsMaxExponent(HigherElementTypeSemantics)) {
307 FPHasBeenPromoted =
true;
316 QualType getPromotionType(FPOptionsOverride Features, QualType Ty,
317 bool IsComplexDivisor) {
318 if (
auto *CT = Ty->
getAs<ComplexType>()) {
319 QualType ElementType = CT->getElementType().getCanonicalType();
321 bool IsComplexRangePromoted = CGF.
getLangOpts().getComplexRange() ==
322 LangOptions::ComplexRangeKind::CX_Promoted;
323 bool HasNoComplexRangeOverride = !Features.hasComplexRangeOverride();
324 bool HasMatchingComplexRange = Features.hasComplexRangeOverride() &&
325 Features.getComplexRangeOverride() ==
328 if (IsComplexDivisor && IsFloatingType && IsComplexRangePromoted &&
329 (HasNoComplexRangeOverride || HasMatchingComplexRange))
330 return HigherPrecisionTypeForComplexArithmetic(ElementType);
339#define HANDLEBINOP(OP) \
340 ComplexPairTy VisitBin##OP(const BinaryOperator *E) { \
341 QualType promotionTy = \
342 getPromotionType(E->getStoredFPFeaturesOrDefault(), E->getType(), \
343 (E->getOpcode() == BinaryOperatorKind::BO_Div && \
344 E->getRHS()->getType()->isAnyComplexType())); \
345 ComplexPairTy result = EmitBin##OP(EmitBinOps(E, promotionTy)); \
346 if (!promotionTy.isNull()) \
347 result = CGF.EmitUnPromotedValue(result, E->getType()); \
362 ComplexPairTy VisitBinAddAssign(
const CompoundAssignOperator *E) {
364 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinAdd);
366 ComplexPairTy VisitBinSubAssign(
const CompoundAssignOperator *E) {
368 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinSub);
370 ComplexPairTy VisitBinMulAssign(
const CompoundAssignOperator *E) {
372 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinMul);
374 ComplexPairTy VisitBinDivAssign(
const CompoundAssignOperator *E) {
376 return EmitCompoundAssign(E, &ComplexExprEmitter::EmitBinDiv);
384 LValue EmitBinAssignLValue(
const BinaryOperator *E,
391 VisitAbstractConditionalOperator(
const AbstractConditionalOperator *CO);
396 ComplexPairTy VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
397 return EmitLoadOfLValue(E);
418 return Builder.CreateStructGEP(addr, 0, addr.
getName() +
".realp");
423 return Builder.CreateStructGEP(addr, 1, addr.
getName() +
".imagp");
430 assert(lvalue.
isSimple() &&
"non-simple complex l-value?");
437 llvm::Value *Real =
nullptr, *Imag =
nullptr;
439 if (!IgnoreReal || isVolatile) {
441 Real = Builder.CreateLoad(RealP, isVolatile, SrcPtr.
getName() +
".real");
444 if (!IgnoreImag || isVolatile) {
446 Imag = Builder.CreateLoad(ImagP, isVolatile, SrcPtr.
getName() +
".imag");
456 if (lvalue.getType()->isAtomicType() ||
460 Address Ptr = lvalue.getAddress();
465 Builder.CreateStore(Val.first, RealPtr, lvalue.isVolatileQualified());
468 Builder.CreateStore(Val.second, ImagPtr, lvalue.isVolatileQualified());
482 llvm::Value *U = llvm::PoisonValue::get(EltTy);
487VisitImaginaryLiteral(
const ImaginaryLiteral *IL) {
489 return ComplexPairTy(llvm::Constant::getNullValue(Imag->getType()), Imag);
493ComplexPairTy ComplexExprEmitter::VisitCallExpr(
const CallExpr *E) {
495 return EmitLoadOfLValue(E);
500ComplexPairTy ComplexExprEmitter::VisitStmtExpr(
const StmtExpr *E) {
503 assert(RetAlloca.
isValid() &&
"Expected complex return value");
512 SourceLocation Loc) {
514 SrcType = SrcType->
castAs<ComplexType>()->getElementType();
515 DestType = DestType->
castAs<ComplexType>()->getElementType();
527ComplexPairTy ComplexExprEmitter::EmitScalarToComplexCast(llvm::Value *Val,
530 SourceLocation Loc) {
532 DestType = DestType->
castAs<ComplexType>()->getElementType();
536 return ComplexPairTy(Val, llvm::Constant::getNullValue(Val->getType()));
542 case CK_Dependent: llvm_unreachable(
"dependent cast kind in IR gen!");
546 case CK_AtomicToNonAtomic:
547 case CK_NonAtomicToAtomic:
549 case CK_LValueToRValue:
550 case CK_UserDefinedConversion:
553 case CK_LValueBitCast: {
559 case CK_LValueToRValueBitCast: {
565 return EmitLoadOfLValue(DestLV, Op->
getExprLoc());
569 case CK_BaseToDerived:
570 case CK_DerivedToBase:
571 case CK_UncheckedDerivedToBase:
574 case CK_ArrayToPointerDecay:
575 case CK_FunctionToPointerDecay:
576 case CK_NullToPointer:
577 case CK_NullToMemberPointer:
578 case CK_BaseToDerivedMemberPointer:
579 case CK_DerivedToBaseMemberPointer:
580 case CK_MemberPointerToBoolean:
581 case CK_ReinterpretMemberPointer:
582 case CK_ConstructorConversion:
583 case CK_IntegralToPointer:
584 case CK_PointerToIntegral:
585 case CK_PointerToBoolean:
588 case CK_IntegralCast:
589 case CK_BooleanToSignedIntegral:
590 case CK_IntegralToBoolean:
591 case CK_IntegralToFloating:
592 case CK_FloatingToIntegral:
593 case CK_FloatingToBoolean:
594 case CK_FloatingCast:
595 case CK_CPointerToObjCPointerCast:
596 case CK_BlockPointerToObjCPointerCast:
597 case CK_AnyPointerToBlockPointerCast:
598 case CK_ObjCObjectLValueCast:
599 case CK_FloatingComplexToReal:
600 case CK_FloatingComplexToBoolean:
601 case CK_IntegralComplexToReal:
602 case CK_IntegralComplexToBoolean:
603 case CK_ARCProduceObject:
604 case CK_ARCConsumeObject:
605 case CK_ARCReclaimReturnedObject:
606 case CK_ARCExtendBlockObject:
607 case CK_CopyAndAutoreleaseBlockObject:
608 case CK_BuiltinFnToFnPtr:
609 case CK_ZeroToOCLOpaqueType:
610 case CK_AddressSpaceConversion:
611 case CK_IntToOCLSampler:
612 case CK_FloatingToFixedPoint:
613 case CK_FixedPointToFloating:
614 case CK_FixedPointCast:
615 case CK_FixedPointToBoolean:
616 case CK_FixedPointToIntegral:
617 case CK_IntegralToFixedPoint:
619 case CK_HLSLVectorTruncation:
620 case CK_HLSLMatrixTruncation:
621 case CK_HLSLArrayRValue:
622 case CK_HLSLElementwiseCast:
623 case CK_HLSLAggregateSplatCast:
624 llvm_unreachable(
"invalid cast kind for complex value");
626 case CK_FloatingRealToComplex:
627 case CK_IntegralRealToComplex: {
633 case CK_FloatingComplexCast:
634 case CK_FloatingComplexToIntegralComplex:
635 case CK_IntegralComplexCast:
636 case CK_IntegralComplexToFloatingComplex: {
638 return EmitComplexToComplexCast(Visit(Op), Op->
getType(), DestTy,
643 llvm_unreachable(
"unknown cast resulting in complex value");
646ComplexPairTy ComplexExprEmitter::VisitUnaryPlus(
const UnaryOperator *E,
647 QualType PromotionType) {
648 QualType promotionTy =
655 if (!promotionTy.
isNull())
660ComplexPairTy ComplexExprEmitter::VisitPlus(
const UnaryOperator *E,
661 QualType PromotionType) {
662 TestAndClearIgnoreReal();
663 TestAndClearIgnoreImag();
664 if (!PromotionType.
isNull())
669ComplexPairTy ComplexExprEmitter::VisitUnaryMinus(
const UnaryOperator *E,
670 QualType PromotionType) {
671 QualType promotionTy =
678 if (!promotionTy.
isNull())
682ComplexPairTy ComplexExprEmitter::VisitMinus(
const UnaryOperator *E,
683 QualType PromotionType) {
684 TestAndClearIgnoreReal();
685 TestAndClearIgnoreImag();
687 if (!PromotionType.
isNull())
692 llvm::Value *ResR, *ResI;
693 if (Op.first->getType()->isFloatingPointTy()) {
694 ResR = Builder.CreateFNeg(Op.first,
"neg.r");
695 ResI = Builder.CreateFNeg(Op.second,
"neg.i");
697 ResR = Builder.CreateNeg(Op.first,
"neg.r");
698 ResI = Builder.CreateNeg(Op.second,
"neg.i");
703ComplexPairTy ComplexExprEmitter::VisitUnaryNot(
const UnaryOperator *E) {
704 TestAndClearIgnoreReal();
705 TestAndClearIgnoreImag();
709 if (Op.second->getType()->isFloatingPointTy())
710 ResI = Builder.CreateFNeg(Op.second,
"conj.i");
712 ResI = Builder.CreateNeg(Op.second,
"conj.i");
717ComplexPairTy ComplexExprEmitter::EmitBinAdd(
const BinOpInfo &Op) {
718 llvm::Value *ResR, *ResI;
720 if (Op.LHS.first->getType()->isFloatingPointTy()) {
722 ResR = Builder.CreateFAdd(Op.LHS.first, Op.RHS.first,
"add.r");
723 if (Op.LHS.second && Op.RHS.second)
724 ResI = Builder.CreateFAdd(Op.LHS.second, Op.RHS.second,
"add.i");
726 ResI = Op.LHS.second ? Op.LHS.second : Op.RHS.second;
727 assert(ResI &&
"Only one operand may be real!");
729 ResR = Builder.CreateAdd(Op.LHS.first, Op.RHS.first,
"add.r");
730 assert(Op.LHS.second && Op.RHS.second &&
731 "Both operands of integer complex operators must be complex!");
732 ResI = Builder.CreateAdd(Op.LHS.second, Op.RHS.second,
"add.i");
737ComplexPairTy ComplexExprEmitter::EmitBinSub(
const BinOpInfo &Op) {
738 llvm::Value *ResR, *ResI;
739 if (Op.LHS.first->getType()->isFloatingPointTy()) {
741 ResR = Builder.CreateFSub(Op.LHS.first, Op.RHS.first,
"sub.r");
742 if (Op.LHS.second && Op.RHS.second)
743 ResI = Builder.CreateFSub(Op.LHS.second, Op.RHS.second,
"sub.i");
745 ResI = Op.LHS.second ? Op.LHS.second
746 : Builder.CreateFNeg(Op.RHS.second,
"sub.i");
747 assert(ResI &&
"Only one operand may be real!");
749 ResR = Builder.CreateSub(Op.LHS.first, Op.RHS.first,
"sub.r");
750 assert(Op.LHS.second && Op.RHS.second &&
751 "Both operands of integer complex operators must be complex!");
752 ResI = Builder.CreateSub(Op.LHS.second, Op.RHS.second,
"sub.i");
758ComplexPairTy ComplexExprEmitter::EmitComplexBinOpLibCall(StringRef LibCallName,
759 const BinOpInfo &Op) {
762 Op.Ty->castAs<ComplexType>()->getElementType());
764 Op.Ty->castAs<ComplexType>()->getElementType());
766 Op.Ty->castAs<ComplexType>()->getElementType());
768 Op.Ty->castAs<ComplexType>()->getElementType());
776 FunctionProtoType::ExtProtoInfo EPI;
779 SmallVector<QualType, 4> ArgsQTys(
780 4, Op.Ty->castAs<ComplexType>()->getElementType());
787 FTy, LibCallName, llvm::AttributeList(),
true);
790 llvm::CallBase *
Call;
799 switch (Ty->getTypeID()) {
801 llvm_unreachable(
"Unsupported floating point type!");
802 case llvm::Type::HalfTyID:
804 case llvm::Type::FloatTyID:
806 case llvm::Type::DoubleTyID:
808 case llvm::Type::PPC_FP128TyID:
810 case llvm::Type::X86_FP80TyID:
812 case llvm::Type::FP128TyID:
819ComplexPairTy ComplexExprEmitter::EmitBinMul(
const BinOpInfo &Op) {
824 if (Op.LHS.first->getType()->isFloatingPointTy()) {
832 if (Op.LHS.second && Op.RHS.second) {
843 Value *AC = Builder.CreateFMul(Op.LHS.first, Op.RHS.first,
"mul_ac");
844 Value *BD = Builder.CreateFMul(Op.LHS.second, Op.RHS.second,
"mul_bd");
845 Value *AD = Builder.CreateFMul(Op.LHS.first, Op.RHS.second,
"mul_ad");
846 Value *BC = Builder.CreateFMul(Op.LHS.second, Op.RHS.first,
"mul_bc");
850 ResR = Builder.CreateFSub(AC, BD,
"mul_r");
851 ResI = Builder.CreateFAdd(AD, BC,
"mul_i");
860 Value *IsRNaN = Builder.CreateFCmpUNO(ResR, ResR,
"isnan_cmp");
863 llvm::Instruction *Branch = Builder.CreateCondBr(IsRNaN, INaNBB, ContBB);
864 llvm::BasicBlock *OrigBB = Branch->getParent();
867 llvm::MDNode *BrWeight = MDHelper.createUnlikelyBranchWeights();
868 Branch->setMetadata(llvm::LLVMContext::MD_prof, BrWeight);
872 Value *IsINaN = Builder.CreateFCmpUNO(ResI, ResI,
"isnan_cmp");
874 Branch = Builder.CreateCondBr(IsINaN, LibCallBB, ContBB);
875 Branch->setMetadata(llvm::LLVMContext::MD_prof, BrWeight);
879 Value *LibCallR, *LibCallI;
880 std::tie(LibCallR, LibCallI) = EmitComplexBinOpLibCall(
882 Builder.CreateBr(ContBB);
887 llvm::PHINode *RealPHI = Builder.CreatePHI(ResR->
getType(), 3,
"real_mul_phi");
888 RealPHI->addIncoming(ResR, OrigBB);
889 RealPHI->addIncoming(ResR, INaNBB);
890 RealPHI->addIncoming(LibCallR, LibCallBB);
891 llvm::PHINode *ImagPHI = Builder.CreatePHI(ResI->
getType(), 3,
"imag_mul_phi");
892 ImagPHI->addIncoming(ResI, OrigBB);
893 ImagPHI->addIncoming(ResI, INaNBB);
894 ImagPHI->addIncoming(LibCallI, LibCallBB);
897 assert((Op.LHS.second || Op.RHS.second) &&
898 "At least one operand must be complex!");
903 ResR = Builder.CreateFMul(Op.LHS.first, Op.RHS.first,
"mul.rl");
906 ? Builder.CreateFMul(Op.LHS.second, Op.RHS.first,
"mul.il")
907 : Builder.CreateFMul(Op.LHS.first, Op.RHS.second,
"mul.ir");
909 assert(Op.LHS.second && Op.RHS.second &&
910 "Both operands of integer complex operators must be complex!");
911 Value *ResRl = Builder.CreateMul(Op.LHS.first, Op.RHS.first,
"mul.rl");
912 Value *ResRr = Builder.CreateMul(Op.LHS.second, Op.RHS.second,
"mul.rr");
913 ResR = Builder.CreateSub(ResRl, ResRr,
"mul.r");
915 Value *ResIl = Builder.CreateMul(Op.LHS.second, Op.RHS.first,
"mul.il");
916 Value *ResIr = Builder.CreateMul(Op.LHS.first, Op.RHS.second,
"mul.ir");
917 ResI = Builder.CreateAdd(ResIl, ResIr,
"mul.i");
922ComplexPairTy ComplexExprEmitter::EmitAlgebraicDiv(llvm::Value *LHSr,
927 llvm::Value *DSTr, *DSTi;
929 llvm::Value *AC = Builder.CreateFMul(LHSr, RHSr);
930 llvm::Value *BD = Builder.CreateFMul(LHSi, RHSi);
931 llvm::Value *ACpBD = Builder.CreateFAdd(AC, BD);
933 llvm::Value *CC = Builder.CreateFMul(RHSr, RHSr);
934 llvm::Value *DD = Builder.CreateFMul(RHSi, RHSi);
935 llvm::Value *CCpDD = Builder.CreateFAdd(CC, DD);
937 llvm::Value *BC = Builder.CreateFMul(LHSi, RHSr);
938 llvm::Value *AD = Builder.CreateFMul(LHSr, RHSi);
939 llvm::Value *BCmAD = Builder.CreateFSub(BC, AD);
941 DSTr = Builder.CreateFDiv(ACpBD, CCpDD);
942 DSTi = Builder.CreateFDiv(BCmAD, CCpDD);
948 llvm::Function *
Func =
956ComplexPairTy ComplexExprEmitter::EmitRangeReductionDiv(llvm::Value *LHSr,
967 llvm::Value *IsR = Builder.CreateFCmpUGT(FAbsRHSr, FAbsRHSi,
"abs_cmp");
969 llvm::BasicBlock *TrueBB =
971 llvm::BasicBlock *FalseBB =
974 Builder.CreateCondBr(IsR, TrueBB, FalseBB);
982 llvm::Value *DdC = Builder.CreateFDiv(RHSi, RHSr);
984 llvm::Value *RD = Builder.CreateFMul(DdC, RHSi);
985 llvm::Value *CpRD = Builder.CreateFAdd(RHSr, RD);
987 llvm::Value *T3 = Builder.CreateFMul(LHSi, DdC);
988 llvm::Value *T4 = Builder.CreateFAdd(LHSr, T3);
989 llvm::Value *DSTTr = Builder.CreateFDiv(T4, CpRD);
991 llvm::Value *T5 = Builder.CreateFMul(LHSr, DdC);
992 llvm::Value *T6 = Builder.CreateFSub(LHSi, T5);
993 llvm::Value *DSTTi = Builder.CreateFDiv(T6, CpRD);
994 Builder.CreateBr(ContBB);
1002 llvm::Value *CdD = Builder.CreateFDiv(RHSr, RHSi);
1004 llvm::Value *RC = Builder.CreateFMul(CdD, RHSr);
1005 llvm::Value *DpRC = Builder.CreateFAdd(RHSi, RC);
1007 llvm::Value *T7 = Builder.CreateFMul(LHSr, CdD);
1008 llvm::Value *T8 = Builder.CreateFAdd(T7, LHSi);
1009 llvm::Value *DSTFr = Builder.CreateFDiv(T8, DpRC);
1011 llvm::Value *T9 = Builder.CreateFMul(LHSi, CdD);
1012 llvm::Value *T10 = Builder.CreateFSub(T9, LHSr);
1013 llvm::Value *DSTFi = Builder.CreateFDiv(T10, DpRC);
1014 Builder.CreateBr(ContBB);
1018 llvm::PHINode *VALr = Builder.CreatePHI(DSTTr->getType(), 2);
1019 VALr->addIncoming(DSTTr, TrueBB);
1020 VALr->addIncoming(DSTFr, FalseBB);
1021 llvm::PHINode *VALi = Builder.CreatePHI(DSTTi->getType(), 2);
1022 VALi->addIncoming(DSTTi, TrueBB);
1023 VALi->addIncoming(DSTFi, FalseBB);
1029ComplexPairTy ComplexExprEmitter::EmitBinDiv(
const BinOpInfo &Op) {
1030 llvm::Value *LHSr = Op.LHS.first, *LHSi = Op.LHS.second;
1031 llvm::Value *RHSr = Op.RHS.first, *RHSi = Op.RHS.second;
1032 llvm::Value *DSTr, *DSTi;
1033 if (LHSr->getType()->isFloatingPointTy()) {
1036 assert(LHSi &&
"Can have at most one non-complex operand!");
1038 DSTr = Builder.CreateFDiv(LHSr, RHSr);
1039 DSTi = Builder.CreateFDiv(LHSi, RHSr);
1042 llvm::Value *OrigLHSi = LHSi;
1044 LHSi = llvm::Constant::getNullValue(RHSi->getType());
1047 !FPHasBeenPromoted))
1048 return EmitRangeReductionDiv(LHSr, LHSi, RHSr, RHSi);
1051 return EmitAlgebraicDiv(LHSr, LHSi, RHSr, RHSi);
1060 BinOpInfo LibCallOp = Op;
1063 LibCallOp.LHS.second = llvm::Constant::getNullValue(LHSr->getType());
1065 switch (LHSr->getType()->getTypeID()) {
1067 llvm_unreachable(
"Unsupported floating point type!");
1068 case llvm::Type::HalfTyID:
1069 return EmitComplexBinOpLibCall(
"__divhc3", LibCallOp);
1070 case llvm::Type::FloatTyID:
1071 return EmitComplexBinOpLibCall(
"__divsc3", LibCallOp);
1072 case llvm::Type::DoubleTyID:
1073 return EmitComplexBinOpLibCall(
"__divdc3", LibCallOp);
1074 case llvm::Type::PPC_FP128TyID:
1075 return EmitComplexBinOpLibCall(
"__divtc3", LibCallOp);
1076 case llvm::Type::X86_FP80TyID:
1077 return EmitComplexBinOpLibCall(
"__divxc3", LibCallOp);
1078 case llvm::Type::FP128TyID:
1079 return EmitComplexBinOpLibCall(
"__divtc3", LibCallOp);
1082 return EmitAlgebraicDiv(LHSr, LHSi, RHSr, RHSi);
1085 assert(Op.LHS.second && Op.RHS.second &&
1086 "Both operands of integer complex operators must be complex!");
1088 llvm::Value *Tmp1 = Builder.CreateMul(LHSr, RHSr);
1089 llvm::Value *Tmp2 = Builder.CreateMul(LHSi, RHSi);
1090 llvm::Value *Tmp3 = Builder.CreateAdd(Tmp1, Tmp2);
1092 llvm::Value *Tmp4 = Builder.CreateMul(RHSr, RHSr);
1093 llvm::Value *Tmp5 = Builder.CreateMul(RHSi, RHSi);
1094 llvm::Value *Tmp6 = Builder.CreateAdd(Tmp4, Tmp5);
1096 llvm::Value *Tmp7 = Builder.CreateMul(LHSi, RHSr);
1097 llvm::Value *Tmp8 = Builder.CreateMul(LHSr, RHSi);
1098 llvm::Value *Tmp9 = Builder.CreateSub(Tmp7, Tmp8);
1100 if (Op.Ty->castAs<ComplexType>()->getElementType()->isUnsignedIntegerType()) {
1101 DSTr = Builder.CreateUDiv(Tmp3, Tmp6);
1102 DSTi = Builder.CreateUDiv(Tmp9, Tmp6);
1104 DSTr = Builder.CreateSDiv(Tmp3, Tmp6);
1105 DSTi = Builder.CreateSDiv(Tmp9, Tmp6);
1114 llvm::Type *ComplexElementTy =
1118 Builder.CreateFPTrunc(result.first, ComplexElementTy,
"unpromotion");
1121 Builder.CreateFPTrunc(result.second, ComplexElementTy,
"unpromotion");
1127 llvm::Type *ComplexElementTy =
1130 result.first =
Builder.CreateFPExt(result.first, ComplexElementTy,
"ext");
1132 result.second =
Builder.CreateFPExt(result.second, ComplexElementTy,
"ext");
1140 if (
auto BO = dyn_cast<BinaryOperator>(E)) {
1141 switch (BO->getOpcode()) {
1142#define HANDLE_BINOP(OP) \
1144 return EmitBin##OP(EmitBinOps(BO, PromotionType));
1153 }
else if (
auto UO = dyn_cast<UnaryOperator>(E)) {
1154 switch (UO->getOpcode()) {
1156 return VisitMinus(UO, PromotionType);
1158 return VisitPlus(UO, PromotionType);
1163 auto result = Visit(
const_cast<Expr *
>(E));
1164 if (!PromotionType.
isNull())
1172 return ComplexExprEmitter(*this).EmitPromoted(E, DstTy);
1176ComplexExprEmitter::EmitPromotedComplexOperand(
const Expr *E,
1179 if (!OverallPromotionType.
isNull())
1182 return Visit(
const_cast<Expr *
>(E));
1184 if (!OverallPromotionType.
isNull()) {
1195ComplexExprEmitter::BinOpInfo
1196ComplexExprEmitter::EmitBinOps(
const BinaryOperator *E,
1197 QualType PromotionType) {
1198 TestAndClearIgnoreReal();
1199 TestAndClearIgnoreImag();
1202 Ops.LHS = EmitPromotedComplexOperand(E->
getLHS(), PromotionType);
1203 Ops.RHS = EmitPromotedComplexOperand(E->
getRHS(), PromotionType);
1204 if (!PromotionType.
isNull())
1205 Ops.Ty = PromotionType;
1213LValue ComplexExprEmitter::
1214EmitCompoundAssignLValue(
const CompoundAssignOperator *E,
1217 TestAndClearIgnoreReal();
1218 TestAndClearIgnoreImag();
1220 if (
const AtomicType *AT = LHSTy->
getAs<AtomicType>())
1221 LHSTy = AT->getValueType();
1227 const bool IsComplexDivisor = E->
getOpcode() == BO_DivAssign &&
1233 QualType PromotionTypeCR;
1237 if (PromotionTypeCR.
isNull())
1239 OpInfo.Ty = PromotionTypeCR;
1240 QualType ComplexElementTy =
1241 OpInfo.Ty->castAs<ComplexType>()->getElementType();
1242 QualType PromotionTypeRHS =
1248 if (!PromotionTypeRHS.
isNull())
1258 if (!PromotionTypeRHS.
isNull()) {
1264 OpInfo.RHS = Visit(E->
getRHS());
1272 QualType PromotionTypeLHS =
1277 if (!PromotionTypeLHS.
isNull())
1279 EmitComplexToComplexCast(LHSVal, LHSTy, PromotionTypeLHS, Loc);
1281 OpInfo.LHS = EmitComplexToComplexCast(LHSVal, LHSTy, OpInfo.Ty, Loc);
1287 QualType PromotedComplexElementTy;
1288 if (!PromotionTypeLHS.
isNull()) {
1289 PromotedComplexElementTy =
1294 PromotedComplexElementTy, Loc);
1302 OpInfo.LHS = EmitScalarToComplexCast(LHSVal, LHSTy, OpInfo.Ty, Loc);
1312 EmitComplexToComplexCast(
Result, OpInfo.Ty, LHSTy, Loc);
1313 EmitStoreOfComplex(ResVal, LHS,
false);
1316 llvm::Value *ResVal =
1327EmitCompoundAssign(
const CompoundAssignOperator *E,
1330 LValue LV = EmitCompoundAssignLValue(E,
Func, Val);
1337 if (!LV.isVolatileQualified())
1340 return EmitLoadOfLValue(LV, E->
getExprLoc());
1343LValue ComplexExprEmitter::EmitBinAssignLValue(
const BinaryOperator *E,
1347 "Invalid assignment");
1348 TestAndClearIgnoreReal();
1349 TestAndClearIgnoreImag();
1352 Val = Visit(E->
getRHS());
1358 EmitStoreOfComplex(Val, LHS,
false);
1363ComplexPairTy ComplexExprEmitter::VisitBinAssign(
const BinaryOperator *E) {
1366 LValue LV = EmitBinAssignLValue(E, Val);
1373 if (!LV.isVolatileQualified())
1376 return EmitLoadOfLValue(LV, E->
getExprLoc());
1379ComplexPairTy ComplexExprEmitter::VisitBinComma(
const BinaryOperator *E) {
1381 return Visit(E->
getRHS());
1385VisitAbstractConditionalOperator(
const AbstractConditionalOperator *E) {
1386 TestAndClearIgnoreReal();
1387 TestAndClearIgnoreImag();
1404 LHSBlock = Builder.GetInsertBlock();
1412 RHSBlock = Builder.GetInsertBlock();
1417 llvm::PHINode *RealPN = Builder.CreatePHI(LHS.first->getType(), 2,
"cond.r");
1418 RealPN->addIncoming(LHS.first, LHSBlock);
1419 RealPN->addIncoming(RHS.first, RHSBlock);
1422 llvm::PHINode *ImagPN = Builder.CreatePHI(LHS.first->getType(), 2,
"cond.i");
1423 ImagPN->addIncoming(LHS.second, LHSBlock);
1424 ImagPN->addIncoming(RHS.second, RHSBlock);
1429ComplexPairTy ComplexExprEmitter::VisitChooseExpr(ChooseExpr *E) {
1433ComplexPairTy ComplexExprEmitter::VisitInitListExpr(InitListExpr *E) {
1434 bool Ignore = TestAndClearIgnoreReal();
1436 assert (Ignore ==
false &&
"init list ignored");
1437 Ignore = TestAndClearIgnoreImag();
1439 assert (Ignore ==
false &&
"init list ignored");
1450 assert(E->
getNumInits() == 0 &&
"Unexpected number of inits");
1451 QualType Ty = E->
getType()->
castAs<ComplexType>()->getElementType();
1453 llvm::Value* zeroConstant = llvm::Constant::getNullValue(LTy);
1457ComplexPairTy ComplexExprEmitter::VisitVAArgExpr(VAArgExpr *E) {
1465 llvm::Value *U = llvm::PoisonValue::get(EltTy);
1481 "Invalid complex expression to emit");
1483 return ComplexExprEmitter(*
this, IgnoreReal, IgnoreImag)
1484 .Visit(
const_cast<Expr *
>(E));
1490 "Invalid complex expression to emit");
1491 ComplexExprEmitter
Emitter(*
this);
1493 Emitter.EmitStoreOfComplex(Val, dest, isInit);
1499 ComplexExprEmitter(*this).EmitStoreOfComplex(
V, dest, isInit);
1505 return ComplexExprEmitter(*this).EmitLoadOfLValue(src, loc);
1511 LValue LVal = ComplexExprEmitter(*this).EmitBinAssignLValue(E, Val);
1513 CGM.getOpenMPRuntime().checkAndEmitLastprivateConditional(*
this,
1519 const ComplexExprEmitter::BinOpInfo &);
1523 case BO_MulAssign:
return &ComplexExprEmitter::EmitBinMul;
1524 case BO_DivAssign:
return &ComplexExprEmitter::EmitBinDiv;
1525 case BO_SubAssign:
return &ComplexExprEmitter::EmitBinSub;
1526 case BO_AddAssign:
return &ComplexExprEmitter::EmitBinAdd;
1528 llvm_unreachable(
"unexpected complex compound assignment");
1537 return ComplexExprEmitter(*this).EmitCompoundAssignLValue(E, Op, Val);
1547 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)