15 return cast<ComplexType>(cast<AtomicType>(
type)->getValueType());
20class ComplexExprEmitter :
public StmtVisitor<ComplexExprEmitter, mlir::Value> {
26 : cgf(cgf), builder(cgf.getBuilder()) {}
35 mlir::Value emitLoadOfLValue(
const Expr *e) {
43 void emitStoreOfComplex(mlir::Location loc, mlir::Value val,
LValue lv,
47 mlir::Value emitComplexToComplexCast(mlir::Value value,
QualType srcType,
51 mlir::Value emitScalarToComplexCast(mlir::Value value,
QualType srcType,
62 mlir::Value VisitStmt(
Stmt *
s) {
63 cgf.
cgm.
errorNYI(
s->getBeginLoc(),
"ComplexExprEmitter VisitStmt");
67 mlir::Value VisitExpr(
Expr *e);
83 cgf.
cgm.
errorNYI(
s->getExprLoc(),
"ComplexExprEmitter VisitCoawaitExpr");
87 cgf.
cgm.
errorNYI(
s->getExprLoc(),
"ComplexExprEmitter VisitCoyieldExpr");
97 assert(constant &&
"not a constant");
102 mlir::TypedAttr valueAttr = constant.
getValue();
109 return emitConstant(constant, e);
110 return emitLoadOfLValue(e);
114 "ComplexExprEmitter VisitObjCIvarRefExpr");
119 "ComplexExprEmitter VisitObjCMessageExpr");
122 mlir::Value VisitArraySubscriptExpr(
Expr *e) {
return emitLoadOfLValue(e); }
126 return emitConstant(constant, me);
128 return emitLoadOfLValue(me);
132 "ComplexExprEmitter VisitOpaqueValueExpr");
138 "ComplexExprEmitter VisitPseudoObjectExpr");
147 return emitLoadOfLValue(e);
150 mlir::Value VisitCastExpr(
CastExpr *e) {
151 if (
const auto *ece = dyn_cast<ExplicitCastExpr>(e)) {
153 if (ece->getType()->isVariablyModifiedType()) {
155 "VisitCastExpr Bind VLAs in the cast type");
161 return emitLoadOfLValue(e);
165 mlir::Value VisitCallExpr(
const CallExpr *e);
166 mlir::Value VisitStmtExpr(
const StmtExpr *e);
169 mlir::Value VisitPrePostIncDec(
const UnaryOperator *e, cir::UnaryOpKind op,
175 return VisitPrePostIncDec(e, cir::UnaryOpKind::Dec,
false);
178 return VisitPrePostIncDec(e, cir::UnaryOpKind::Inc,
false);
181 return VisitPrePostIncDec(e, cir::UnaryOpKind::Dec,
true);
184 return VisitPrePostIncDec(e, cir::UnaryOpKind::Inc,
true);
186 mlir::Value VisitUnaryDeref(
const Expr *e) {
return emitLoadOfLValue(e); }
190 mlir::Value VisitPlusMinus(
const UnaryOperator *e, cir::UnaryOpKind kind,
200 "ComplexExprEmitter VisitCXXDefaultArgExpr");
205 "ComplexExprEmitter VisitCXXDefaultInitExpr");
210 "ComplexExprEmitter VisitExprWithCleanups");
220 "ComplexExprEmitter VisitImplicitValueInitExpr");
235 mlir::Value emitPromoted(
const Expr *e,
QualType promotionTy);
236 mlir::Value emitPromotedComplexOperand(
const Expr *e,
QualType promotionTy);
237 LValue emitCompoundAssignLValue(
239 mlir::Value (ComplexExprEmitter::*func)(
const BinOpInfo &),
241 mlir::Value emitCompoundAssign(
243 mlir::Value (ComplexExprEmitter::*func)(
const BinOpInfo &));
245 mlir::Value emitBinAdd(
const BinOpInfo &op);
246 mlir::Value emitBinSub(
const BinOpInfo &op);
247 mlir::Value emitBinMul(
const BinOpInfo &op);
248 mlir::Value emitBinDiv(
const BinOpInfo &op);
252 QualType elementTy = complexTy->getElementType();
262#define HANDLEBINOP(OP) \
263 mlir::Value VisitBin##OP(const BinaryOperator *e) { \
264 QualType promotionTy = getPromotionType( \
265 e->getType(), e->getOpcode() == BinaryOperatorKind::BO_Div); \
266 mlir::Value result = emitBin##OP(emitBinOps(e, promotionTy)); \
267 if (!promotionTy.isNull()) \
268 result = cgf.emitUnPromotedValue(result, e->getType()); \
280 "ComplexExprEmitter VisitCXXRewrittenBinaryOperator");
286 return emitCompoundAssign(e, &ComplexExprEmitter::emitBinAdd);
289 return emitCompoundAssign(e, &ComplexExprEmitter::emitBinSub);
292 return emitCompoundAssign(e, &ComplexExprEmitter::emitBinMul);
295 return emitCompoundAssign(e, &ComplexExprEmitter::emitBinDiv);
314 return emitLoadOfLValue(e);
317 mlir::Value VisitVAArgExpr(
VAArgExpr *e);
326 "ComplexExprEmitter VisitPackIndexingExpr");
338mlir::Value ComplexExprEmitter::emitLoadOfLValue(
LValue lv,
340 assert(lv.
isSimple() &&
"non-simple complex l-value?");
342 cgf.
cgm.
errorNYI(loc,
"emitLoadOfLValue with Atomic LV");
350void ComplexExprEmitter::emitStoreOfComplex(mlir::Location loc, mlir::Value val,
354 cgf.
cgm.
errorNYI(loc,
"StoreOfComplex with Atomic LV");
366mlir::Value ComplexExprEmitter::VisitExpr(
Expr *e) {
374 mlir::Type elementTy = ty.getElementType();
377 mlir::TypedAttr realValueAttr;
378 mlir::TypedAttr imagValueAttr;
380 if (mlir::isa<cir::IntType>(elementTy)) {
381 llvm::APInt imagValue = cast<IntegerLiteral>(il->
getSubExpr())->getValue();
382 realValueAttr = cir::IntAttr::get(elementTy, 0);
383 imagValueAttr = cir::IntAttr::get(elementTy, imagValue);
385 assert(mlir::isa<cir::FPTypeInterface>(elementTy) &&
386 "Expected complex element type to be floating-point");
388 llvm::APFloat imagValue =
389 cast<FloatingLiteral>(il->
getSubExpr())->getValue();
390 realValueAttr = cir::FPAttr::get(
391 elementTy, llvm::APFloat::getZero(imagValue.getSemantics()));
392 imagValueAttr = cir::FPAttr::get(elementTy, imagValue);
395 auto complexAttr = cir::ConstComplexAttr::get(realValueAttr, imagValueAttr);
396 return builder.create<cir::ConstantOp>(loc, complexAttr);
399mlir::Value ComplexExprEmitter::VisitCallExpr(
const CallExpr *e) {
401 return emitLoadOfLValue(e);
405mlir::Value ComplexExprEmitter::VisitStmtExpr(
const StmtExpr *e) {
410mlir::Value ComplexExprEmitter::emitComplexToComplexCast(mlir::Value val,
414 if (srcType == destType)
421 cir::CastKind castOpKind;
423 castOpKind = cir::CastKind::float_complex;
425 castOpKind = cir::CastKind::float_complex_to_int_complex;
427 castOpKind = cir::CastKind::int_complex_to_float_complex;
429 castOpKind = cir::CastKind::int_complex;
431 llvm_unreachable(
"unexpected src type or dest type");
437mlir::Value ComplexExprEmitter::emitScalarToComplexCast(mlir::Value val,
441 cir::CastKind castOpKind;
443 castOpKind = cir::CastKind::float_to_complex;
445 castOpKind = cir::CastKind::int_to_complex;
447 llvm_unreachable(
"unexpected src type");
453mlir::Value ComplexExprEmitter::emitCast(
CastKind ck,
Expr *op,
457 llvm_unreachable(
"dependent type must be resolved before the CIR codegen");
460 case CK_LValueToRValue:
463 case CK_AtomicToNonAtomic:
464 case CK_NonAtomicToAtomic:
465 case CK_UserDefinedConversion: {
467 "ComplexExprEmitter::emitCast Atmoic & UserDefinedConversion");
471 case CK_LValueBitCast: {
476 return emitLoadOfLValue(destLV, op->
getExprLoc());
479 case CK_LValueToRValueBitCast: {
485 return emitLoadOfLValue(destLV, op->
getExprLoc());
489 case CK_BaseToDerived:
490 case CK_DerivedToBase:
491 case CK_UncheckedDerivedToBase:
494 case CK_ArrayToPointerDecay:
495 case CK_FunctionToPointerDecay:
496 case CK_NullToPointer:
497 case CK_NullToMemberPointer:
498 case CK_BaseToDerivedMemberPointer:
499 case CK_DerivedToBaseMemberPointer:
500 case CK_MemberPointerToBoolean:
501 case CK_ReinterpretMemberPointer:
502 case CK_ConstructorConversion:
503 case CK_IntegralToPointer:
504 case CK_PointerToIntegral:
505 case CK_PointerToBoolean:
508 case CK_IntegralCast:
509 case CK_BooleanToSignedIntegral:
510 case CK_IntegralToBoolean:
511 case CK_IntegralToFloating:
512 case CK_FloatingToIntegral:
513 case CK_FloatingToBoolean:
514 case CK_FloatingCast:
515 case CK_CPointerToObjCPointerCast:
516 case CK_BlockPointerToObjCPointerCast:
517 case CK_AnyPointerToBlockPointerCast:
518 case CK_ObjCObjectLValueCast:
519 case CK_FloatingComplexToReal:
520 case CK_FloatingComplexToBoolean:
521 case CK_IntegralComplexToReal:
522 case CK_IntegralComplexToBoolean:
523 case CK_ARCProduceObject:
524 case CK_ARCConsumeObject:
525 case CK_ARCReclaimReturnedObject:
526 case CK_ARCExtendBlockObject:
527 case CK_CopyAndAutoreleaseBlockObject:
528 case CK_BuiltinFnToFnPtr:
529 case CK_ZeroToOCLOpaqueType:
530 case CK_AddressSpaceConversion:
531 case CK_IntToOCLSampler:
532 case CK_FloatingToFixedPoint:
533 case CK_FixedPointToFloating:
534 case CK_FixedPointCast:
535 case CK_FixedPointToBoolean:
536 case CK_FixedPointToIntegral:
537 case CK_IntegralToFixedPoint:
539 case CK_HLSLVectorTruncation:
540 case CK_HLSLArrayRValue:
541 case CK_HLSLElementwiseCast:
542 case CK_HLSLAggregateSplatCast:
543 llvm_unreachable(
"invalid cast kind for complex value");
545 case CK_FloatingRealToComplex:
546 case CK_IntegralRealToComplex: {
552 case CK_FloatingComplexCast:
553 case CK_FloatingComplexToIntegralComplex:
554 case CK_IntegralComplexCast:
555 case CK_IntegralComplexToFloatingComplex: {
557 return emitComplexToComplexCast(Visit(op), op->
getType(), destTy,
562 llvm_unreachable(
"unknown cast resulting in complex value");
565mlir::Value ComplexExprEmitter::VisitUnaryPlus(
const UnaryOperator *e) {
567 mlir::Value result = VisitPlusMinus(e, cir::UnaryOpKind::Plus, promotionTy);
568 if (!promotionTy.
isNull())
573mlir::Value ComplexExprEmitter::VisitUnaryMinus(
const UnaryOperator *e) {
575 mlir::Value result = VisitPlusMinus(e, cir::UnaryOpKind::Minus, promotionTy);
576 if (!promotionTy.
isNull())
581mlir::Value ComplexExprEmitter::VisitPlusMinus(
const UnaryOperator *e,
582 cir::UnaryOpKind kind,
584 assert(kind == cir::UnaryOpKind::Plus ||
585 kind == cir::UnaryOpKind::Minus &&
586 "Invalid UnaryOp kind for ComplexType Plus or Minus");
589 if (!promotionType.
isNull())
596mlir::Value ComplexExprEmitter::VisitUnaryNot(
const UnaryOperator *e) {
601mlir::Value ComplexExprEmitter::emitBinAdd(
const BinOpInfo &op) {
605 if (mlir::isa<cir::ComplexType>(op.lhs.getType()) &&
606 mlir::isa<cir::ComplexType>(op.rhs.getType()))
607 return builder.create<cir::ComplexAddOp>(op.loc, op.lhs, op.rhs);
609 if (mlir::isa<cir::ComplexType>(op.lhs.getType())) {
612 mlir::Value newReal = builder.
createAdd(op.loc, real, op.rhs);
616 assert(mlir::isa<cir::ComplexType>(op.rhs.getType()));
619 mlir::Value newReal = builder.
createAdd(op.loc, op.lhs, real);
623mlir::Value ComplexExprEmitter::emitBinSub(
const BinOpInfo &op) {
627 if (mlir::isa<cir::ComplexType>(op.lhs.getType()) &&
628 mlir::isa<cir::ComplexType>(op.rhs.getType()))
629 return builder.create<cir::ComplexSubOp>(op.loc, op.lhs, op.rhs);
631 if (mlir::isa<cir::ComplexType>(op.lhs.getType())) {
634 mlir::Value newReal = builder.
createSub(op.loc, real, op.rhs);
638 assert(mlir::isa<cir::ComplexType>(op.rhs.getType()));
641 mlir::Value newReal = builder.
createSub(op.loc, op.lhs, real);
645static cir::ComplexRangeKind
648 case LangOptions::CX_Full:
649 return cir::ComplexRangeKind::Full;
650 case LangOptions::CX_Improved:
651 return cir::ComplexRangeKind::Improved;
652 case LangOptions::CX_Promoted:
653 return cir::ComplexRangeKind::Promoted;
654 case LangOptions::CX_Basic:
655 return cir::ComplexRangeKind::Basic;
656 case LangOptions::CX_None:
658 return cir::ComplexRangeKind::Full;
662mlir::Value ComplexExprEmitter::emitBinMul(
const BinOpInfo &op) {
666 if (mlir::isa<cir::ComplexType>(op.lhs.getType()) &&
667 mlir::isa<cir::ComplexType>(op.rhs.getType())) {
668 cir::ComplexRangeKind rangeKind =
670 return builder.create<cir::ComplexMulOp>(op.loc, op.lhs, op.rhs, rangeKind);
673 if (mlir::isa<cir::ComplexType>(op.lhs.getType())) {
676 mlir::Value newReal = builder.
createMul(op.loc, real, op.rhs);
677 mlir::Value newImag = builder.
createMul(op.loc, imag, op.rhs);
681 assert(mlir::isa<cir::ComplexType>(op.rhs.getType()));
684 mlir::Value newReal = builder.
createMul(op.loc, op.lhs, real);
685 mlir::Value newImag = builder.
createMul(op.loc, op.lhs, imag);
689mlir::Value ComplexExprEmitter::emitBinDiv(
const BinOpInfo &op) {
697 if (mlir::isa<cir::ComplexType>(op.lhs.getType()) &&
698 mlir::isa<cir::ComplexType>(op.rhs.getType())) {
699 cir::ComplexRangeKind rangeKind =
701 return cir::ComplexDivOp::create(builder, op.loc, op.lhs, op.rhs,
707 if (mlir::isa<cir::ComplexType>(op.lhs.getType())) {
708 assert(mlir::cast<cir::ComplexType>(op.lhs.getType()).getElementType() ==
712 mlir::Value newReal = builder.
createFDiv(op.loc, real, op.rhs);
713 mlir::Value newImag = builder.
createFDiv(op.loc, imag, op.rhs);
717 assert(mlir::isa<cir::ComplexType>(op.rhs.getType()));
718 cir::ConstantOp nullValue = builder.
getNullValue(op.lhs.getType(), op.loc);
720 cir::ComplexRangeKind rangeKind =
722 return cir::ComplexDivOp::create(builder, op.loc, lhs, op.rhs, rangeKind);
727 assert(!mlir::cast<cir::ComplexType>(result.getType()).isIntegerComplex() &&
728 "integral complex will never be promoted");
729 return builder.
createCast(cir::CastKind::float_complex, result,
735 assert(!mlir::cast<cir::ComplexType>(result.getType()).isIntegerComplex() &&
736 "integral complex will never be promoted");
737 return builder.
createCast(cir::CastKind::float_complex, result,
741mlir::Value ComplexExprEmitter::emitPromoted(
const Expr *e,
744 if (
const auto *bo = dyn_cast<BinaryOperator>(e)) {
745 switch (bo->getOpcode()) {
746#define HANDLE_BINOP(OP) \
748 return emitBin##OP(emitBinOps(bo, promotionTy));
756 }
else if (
const auto *unaryOp = dyn_cast<UnaryOperator>(e)) {
757 switch (unaryOp->getOpcode()) {
760 auto kind = unaryOp->getOpcode() == UO_Plus ? cir::UnaryOpKind::Plus
761 : cir::UnaryOpKind::Minus;
762 return VisitPlusMinus(unaryOp, kind, promotionTy);
769 mlir::Value result = Visit(
const_cast<Expr *
>(e));
770 if (!promotionTy.
isNull())
778 return ComplexExprEmitter(*this).emitPromoted(e, promotionType);
782ComplexExprEmitter::emitPromotedComplexOperand(
const Expr *e,
785 if (!promotionTy.
isNull())
787 return Visit(
const_cast<Expr *
>(e));
790 if (!promotionTy.
isNull()) {
798ComplexExprEmitter::BinOpInfo
801 binOpInfo.lhs = emitPromotedComplexOperand(e->
getLHS(), promotionTy);
802 binOpInfo.rhs = emitPromotedComplexOperand(e->
getRHS(), promotionTy);
803 binOpInfo.ty = promotionTy.
isNull() ? e->
getType() : promotionTy;
808LValue ComplexExprEmitter::emitCompoundAssignLValue(
810 mlir::Value (ComplexExprEmitter::*func)(
const BinOpInfo &),
RValue &value) {
814 mlir::Location loc = cgf.
getLoc(exprLoc);
817 cgf.
cgm.
errorNYI(
"emitCompoundAssignLValue AtmoicType");
821 BinOpInfo opInfo{loc};
835 QualType promotionTypeRHS = getPromotionType(rhsTy);
839 if (!promotionTypeRHS.
isNull()) {
846 if (!promotionTypeRHS.
isNull()) {
850 opInfo.rhs = Visit(e->
getRHS());
859 mlir::Value lhsValue = emitLoadOfLValue(lhs, exprLoc);
860 QualType destTy = promotionTypeLHS.
isNull() ? opInfo.ty : promotionTypeLHS;
861 opInfo.lhs = emitComplexToComplexCast(lhsValue, lhsTy, destTy, exprLoc);
868 if (!promotionTypeLHS.
isNull()) {
869 promotedComplexElementTy =
870 cast<ComplexType>(promotionTypeLHS)->getElementType();
874 promotedComplexElementTy, exprLoc);
882 opInfo.lhs = emitScalarToComplexCast(lhsVal, lhsTy, opInfo.ty, exprLoc);
887 mlir::Value result = (this->*func)(opInfo);
891 mlir::Value resultValue =
892 emitComplexToComplexCast(result, opInfo.ty, lhsTy, exprLoc);
893 emitStoreOfComplex(loc, resultValue, lhs,
false);
896 mlir::Value resultValue =
905mlir::Value ComplexExprEmitter::emitCompoundAssign(
907 mlir::Value (ComplexExprEmitter::*func)(
const BinOpInfo &)) {
909 LValue lv = emitCompoundAssignLValue(e, func, val);
923 mlir::Value &value) {
926 "Invalid assignment");
929 value = Visit(e->
getRHS());
940mlir::Value ComplexExprEmitter::VisitBinAssign(
const BinaryOperator *e) {
942 LValue lv = emitBinAssignLValue(e, value);
956mlir::Value ComplexExprEmitter::VisitBinComma(
const BinaryOperator *e) {
958 return Visit(e->
getRHS());
961mlir::Value ComplexExprEmitter::VisitAbstractConditionalOperator(
963 mlir::Value condValue = Visit(e->
getCond());
967 .create<cir::TernaryOp>(
970 [&](mlir::OpBuilder &
b, mlir::Location loc) {
972 b.create<cir::YieldOp>(loc, trueValue);
975 [&](mlir::OpBuilder &
b, mlir::Location loc) {
977 b.create<cir::YieldOp>(loc, falseValue);
982mlir::Value ComplexExprEmitter::VisitChooseExpr(
ChooseExpr *e) {
986mlir::Value ComplexExprEmitter::VisitInitListExpr(
InitListExpr *e) {
997 assert(e->
getNumInits() == 0 &&
"Unexpected number of inits");
1002mlir::Value ComplexExprEmitter::VisitVAArgExpr(
VAArgExpr *e) {
1014 "Invalid complex expression to emit");
1016 return ComplexExprEmitter(*this).Visit(
const_cast<Expr *
>(e));
1022 "Invalid complex expression to emit");
1023 ComplexExprEmitter emitter(*
this);
1024 mlir::Value value = emitter.Visit(
const_cast<Expr *
>(e));
1030 LValue dest,
bool isInit) {
1031 ComplexExprEmitter(*this).emitStoreOfComplex(loc, v, dest, isInit);
1035 return ComplexExprEmitter(*this).emitLoadOfLValue(src, loc);
1039 assert(e->
getOpcode() == BO_Assign &&
"Expected assign op");
1042 LValue lvalue = ComplexExprEmitter(*this).emitBinAssignLValue(e, value);
1044 cgm.
errorNYI(
"emitComplexAssignmentLValue OpenMP");
1050 mlir::Value (ComplexExprEmitter::*)(
const ComplexExprEmitter::BinOpInfo &);
1055 return &ComplexExprEmitter::emitBinMul;
1057 return &ComplexExprEmitter::emitBinDiv;
1059 return &ComplexExprEmitter::emitBinSub;
1061 return &ComplexExprEmitter::emitBinAdd;
1063 llvm_unreachable(
"unexpected complex compound assignment");
1071 return ComplexExprEmitter(*this).emitCompoundAssignLValue(e, op, val);
1076 cir::UnaryOpKind op,
1078 assert(op == cir::UnaryOpKind::Inc ||
1079 op == cir::UnaryOpKind::Dec &&
"Invalid UnaryOp kind for ComplexType");
1089 cgm.
errorNYI(loc,
"emitComplexPrePostIncDec OpenMP");
1093 return isPre ? incVal : inVal;
1102 LValue ret = ComplexExprEmitter(*this).emitCompoundAssignLValue(e, op, value);
static CompoundFunc getComplexOp(BinaryOperatorKind op)
static const ComplexType * getComplexType(QualType type)
Return the complex type that we are meant to emit.
static cir::ComplexRangeKind getComplexRangeAttr(LangOptions::ComplexRangeKind range)
mlir::Value(ComplexExprEmitter::*)(const ComplexExprEmitter::BinOpInfo &) CompoundFunc
__device__ __2f16 float __ockl_bool s
cir::ConstantOp getNullValue(mlir::Type ty, mlir::Location loc)
cir::ConstantOp getConstant(mlir::Location loc, mlir::TypedAttr attr)
mlir::Value createCast(mlir::Location loc, cir::CastKind kind, mlir::Value src, mlir::Type newTy)
mlir::Value createAdd(mlir::Location loc, mlir::Value lhs, mlir::Value rhs, OverflowBehavior ob=OverflowBehavior::None)
mlir::Value createNot(mlir::Value value)
mlir::Value createComplexImag(mlir::Location loc, mlir::Value operand)
mlir::Value createSub(mlir::Location loc, mlir::Value lhs, mlir::Value rhs, OverflowBehavior ob=OverflowBehavior::Saturated)
mlir::Value createMul(mlir::Location loc, mlir::Value lhs, mlir::Value rhs, OverflowBehavior ob=OverflowBehavior::None)
mlir::Value createComplexCreate(mlir::Location loc, mlir::Value real, mlir::Value imag)
mlir::Value createUnaryOp(mlir::Location loc, cir::UnaryOpKind kind, mlir::Value operand)
mlir::Value createComplexReal(mlir::Location loc, mlir::Value operand)
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type.
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
Expr * getCond() const
getCond - Return the expression representing the condition for the ?: operator.
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...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
A builtin binary operation expression such as "x + y" or "x <= y".
SourceLocation getExprLoc() const
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const
Get the FP features status of this operator.
Address withElementType(CIRGenBuilderTy &builder, mlir::Type ElemTy) const
Return address with different element type, a bitcast pointer, and the same alignment.
mlir::Value createFDiv(mlir::Location loc, mlir::Value lhs, mlir::Value rhs)
cir::LoadOp createLoad(mlir::Location loc, Address addr, bool isVolatile=false)
cir::StoreOp createStore(mlir::Location loc, mlir::Value val, Address dst, bool isVolatile=false, mlir::IntegerAttr align={}, cir::MemOrderAttr order={})
LValue getReferenceLValue(CIRGenFunction &cgf, Expr *refExpr) const
mlir::TypedAttr getValue() const
mlir::Value emitComplexToScalarConversion(mlir::Value src, QualType srcTy, QualType dstTy, SourceLocation loc)
Emit a conversion from the specified complex type to the specified destination type,...
mlir::Type convertType(clang::QualType t)
mlir::Value emitPromotedValue(mlir::Value result, QualType promotionType)
const clang::LangOptions & getLangOpts() const
LValue emitScalarCompoundAssignWithComplex(const CompoundAssignOperator *e, mlir::Value &result)
mlir::Value emitComplexExpr(const Expr *e)
Emit the computation of the specified expression of complex type, returning the result.
RValue emitCallExpr(const clang::CallExpr *e, ReturnValueSlot returnValue=ReturnValueSlot())
LValue emitLValue(const clang::Expr *e)
Emit code to compute a designator that specifies the location of the expression.
void emitStoreOfScalar(mlir::Value value, Address addr, bool isVolatile, clang::QualType ty, bool isInit=false, bool isNontemporal=false)
LValue emitComplexCompoundAssignmentLValue(const CompoundAssignOperator *e)
mlir::Location getLoc(clang::SourceLocation srcLoc)
Helpers to convert Clang's SourceLocation to a MLIR Location.
mlir::Value emitScalarConversion(mlir::Value src, clang::QualType srcType, clang::QualType dstType, clang::SourceLocation loc)
Emit a conversion from the specified type to the specified destination type, both of which are CIR sc...
mlir::Value emitPromotedComplexExpr(const Expr *e, QualType promotionType)
mlir::Value emitUnPromotedValue(mlir::Value result, QualType unPromotionType)
mlir::Type convertTypeForMem(QualType t)
mlir::Value emitLoadOfComplex(LValue src, SourceLocation loc)
Load a complex number from the specified l-value.
mlir::Value emitComplexPrePostIncDec(const UnaryOperator *e, LValue lv, cir::UnaryOpKind op, bool isPre)
void emitStoreOfComplex(mlir::Location loc, mlir::Value v, LValue dest, bool isInit)
EmitStoreOfComplex - Store a complex number into the specified l-value.
LValue emitComplexAssignmentLValue(const BinaryOperator *e)
mlir::Value emitScalarExpr(const clang::Expr *e)
Emit the computation of the specified expression of scalar type.
mlir::Value emitPromotedScalarExpr(const Expr *e, QualType promotionType)
mlir::Value emitLoadOfScalar(LValue lvalue, SourceLocation loc)
EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the...
void emitComplexExprIntoLValue(const Expr *e, LValue dest, bool isInit)
ConstantEmission tryEmitAsConstant(const DeclRefExpr *refExpr)
Try to emit a reference to the given value without producing it as an l-value.
LValue makeAddrLValue(Address addr, QualType ty, AlignmentSource source=AlignmentSource::Type)
clang::ASTContext & getContext() const
bool isLValueSuitableForInlineAtomic(LValue lv)
An LValue is a candidate for having its loads and stores be made atomic if we are operating under /vo...
void emitIgnoredExpr(const clang::Expr *e)
Emit code to compute the specified expression, ignoring the result.
mlir::Value emitVAArg(VAArgExpr *ve)
Generate code to get an argument from the passed in pointer and update it accordingly.
DiagnosticBuilder errorNYI(SourceLocation, llvm::StringRef)
Helpers to emit "not yet implemented" error diagnostics.
Address getAddress() const
clang::QualType getType() const
bool isVolatileQualified() const
This trivial value class is used to represent the result of an expression that is evaluated.
static RValue get(mlir::Value v)
static RValue getComplex(mlir::Value v)
mlir::Value getValue() const
Return the value of this scalar value.
mlir::Value getComplexValue() const
Return the value of this complex value.
A default argument (C++ [dcl.fct.default]).
SourceLocation getExprLoc() const
A use of a default initializer in a constructor or in aggregate initialization.
A rewritten comparison expression that was originally written using operator syntax.
SourceLocation getExprLoc() const LLVM_READONLY
An expression "T()" which creates an rvalue of a non-class type T.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
CastKind getCastKind() const
bool changesVolatileQualification() const
Return.
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Expr * getChosenSubExpr() const
getChosenSubExpr - Return the subexpression chosen according to the condition.
Represents a 'co_await' expression.
Complex values, per C99 6.2.5p11.
CompoundAssignOperator - For compound assignments (e.g.
QualType getComputationLHSType() const
QualType getComputationResultType() const
CompoundLiteralExpr - [C99 6.5.2.5].
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a 'co_yield' expression.
A reference to a declared variable, function, enum, etc.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
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...
Represents a C11 generic selection.
Expr * getResultExpr()
Return the result expression of this controlling expression.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
const Expr * getSubExpr() const
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Describes an C or C++ initializer list.
unsigned getNumInits() const
const Expr * getInit(unsigned Init) const
ComplexRangeKind
Controls the various implementations for complex multiplication and.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
SourceLocation getExprLoc() const LLVM_READONLY
ParenExpr - This represents a parenthesized expression, e.g.
const Expr * getSubExpr() const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
SourceLocation getExprLoc() const LLVM_READONLY
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool UseExcessPrecision(const ASTContext &Ctx)
Encodes a location in the source.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
RetTy Visit(PTR(Stmt) S, ParamTys... P)
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Expr * getReplacement() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
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>'.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getExprLoc() const
Expr * getSubExpr() const
Represents a call to the builtin function __builtin_va_arg.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
The JSON file list parser is used to communicate input to InstallAPI.
CastKind
CastKind - The kind of operation required for a conversion.
static bool cgFPOptionsRAII()
static bool fastMathFlags()