10class ComplexExprEmitter :
public StmtVisitor<ComplexExprEmitter, mlir::Value> {
16 : cgf(cgf), builder(cgf.getBuilder()) {}
32 mlir::Value emitLoadOfLValue(
const Expr *e) {
40 void emitStoreOfComplex(mlir::Location loc, mlir::Value val,
LValue lv,
44 mlir::Value emitComplexToComplexCast(mlir::Value value,
QualType srcType,
48 mlir::Value emitScalarToComplexCast(mlir::Value value,
QualType srcType,
53 mlir::Value VisitArraySubscriptExpr(
Expr *e);
56 mlir::Value VisitCallExpr(
const CallExpr *e);
57 mlir::Value VisitCastExpr(
CastExpr *e);
68 return emitConstant(constant, me);
70 return emitLoadOfLValue(me);
74 return emitLoadOfLValue(e);
82 mlir::Value VisitPrePostIncDec(
const UnaryOperator *e, cir::UnaryOpKind op,
86 return VisitPrePostIncDec(e, cir::UnaryOpKind::Dec,
false);
90 return VisitPrePostIncDec(e, cir::UnaryOpKind::Inc,
false);
94 return VisitPrePostIncDec(e, cir::UnaryOpKind::Dec,
true);
98 return VisitPrePostIncDec(e, cir::UnaryOpKind::Inc,
true);
101 mlir::Value VisitUnaryDeref(
const Expr *e);
105 mlir::Value VisitPlusMinus(
const UnaryOperator *e, cir::UnaryOpKind kind,
123 mlir::Value emitPromoted(
const Expr *e,
QualType promotionTy);
125 mlir::Value emitPromotedComplexOperand(
const Expr *e,
QualType promotionTy);
127 LValue emitCompoundAssignLValue(
129 mlir::Value (ComplexExprEmitter::*func)(
const BinOpInfo &),
132 mlir::Value emitCompoundAssign(
134 mlir::Value (ComplexExprEmitter::*func)(
const BinOpInfo &));
136 mlir::Value emitBinAdd(
const BinOpInfo &op);
137 mlir::Value emitBinSub(
const BinOpInfo &op);
138 mlir::Value emitBinMul(
const BinOpInfo &op);
139 mlir::Value emitBinDiv(
const BinOpInfo &op);
143 QualType elementTy = complexTy->getElementType();
153#define HANDLEBINOP(OP) \
154 mlir::Value VisitBin##OP(const BinaryOperator *e) { \
155 QualType promotionTy = getPromotionType( \
156 e->getType(), e->getOpcode() == BinaryOperatorKind::BO_Div); \
157 mlir::Value result = emitBin##OP(emitBinOps(e, promotionTy)); \
158 if (!promotionTy.isNull()) \
159 result = cgf.emitUnPromotedValue(result, e->getType()); \
171 return emitCompoundAssign(e, &ComplexExprEmitter::emitBinAdd);
175 return emitCompoundAssign(e, &ComplexExprEmitter::emitBinSub);
179 return emitCompoundAssign(e, &ComplexExprEmitter::emitBinMul);
183 return emitCompoundAssign(e, &ComplexExprEmitter::emitBinDiv);
194 return cast<ComplexType>(cast<AtomicType>(
type)->getValueType());
199 mlir::Value &value) {
202 "Invalid assignment");
205 value = Visit(e->
getRHS());
215mlir::Value ComplexExprEmitter::emitCast(
CastKind ck,
Expr *op,
219 llvm_unreachable(
"dependent type must be resolved before the CIR codegen");
222 case CK_LValueToRValue:
225 case CK_AtomicToNonAtomic:
226 case CK_NonAtomicToAtomic:
227 case CK_UserDefinedConversion: {
229 "ComplexExprEmitter::emitCast Atmoic & UserDefinedConversion");
233 case CK_LValueBitCast: {
238 return emitLoadOfLValue(destLV, op->
getExprLoc());
241 case CK_LValueToRValueBitCast: {
247 return emitLoadOfLValue(destLV, op->
getExprLoc());
251 case CK_BaseToDerived:
252 case CK_DerivedToBase:
253 case CK_UncheckedDerivedToBase:
256 case CK_ArrayToPointerDecay:
257 case CK_FunctionToPointerDecay:
258 case CK_NullToPointer:
259 case CK_NullToMemberPointer:
260 case CK_BaseToDerivedMemberPointer:
261 case CK_DerivedToBaseMemberPointer:
262 case CK_MemberPointerToBoolean:
263 case CK_ReinterpretMemberPointer:
264 case CK_ConstructorConversion:
265 case CK_IntegralToPointer:
266 case CK_PointerToIntegral:
267 case CK_PointerToBoolean:
270 case CK_IntegralCast:
271 case CK_BooleanToSignedIntegral:
272 case CK_IntegralToBoolean:
273 case CK_IntegralToFloating:
274 case CK_FloatingToIntegral:
275 case CK_FloatingToBoolean:
276 case CK_FloatingCast:
277 case CK_CPointerToObjCPointerCast:
278 case CK_BlockPointerToObjCPointerCast:
279 case CK_AnyPointerToBlockPointerCast:
280 case CK_ObjCObjectLValueCast:
281 case CK_FloatingComplexToReal:
282 case CK_FloatingComplexToBoolean:
283 case CK_IntegralComplexToReal:
284 case CK_IntegralComplexToBoolean:
285 case CK_ARCProduceObject:
286 case CK_ARCConsumeObject:
287 case CK_ARCReclaimReturnedObject:
288 case CK_ARCExtendBlockObject:
289 case CK_CopyAndAutoreleaseBlockObject:
290 case CK_BuiltinFnToFnPtr:
291 case CK_ZeroToOCLOpaqueType:
292 case CK_AddressSpaceConversion:
293 case CK_IntToOCLSampler:
294 case CK_FloatingToFixedPoint:
295 case CK_FixedPointToFloating:
296 case CK_FixedPointCast:
297 case CK_FixedPointToBoolean:
298 case CK_FixedPointToIntegral:
299 case CK_IntegralToFixedPoint:
301 case CK_HLSLVectorTruncation:
302 case CK_HLSLArrayRValue:
303 case CK_HLSLElementwiseCast:
304 case CK_HLSLAggregateSplatCast:
305 llvm_unreachable(
"invalid cast kind for complex value");
307 case CK_FloatingRealToComplex:
308 case CK_IntegralRealToComplex: {
314 case CK_FloatingComplexCast:
315 case CK_FloatingComplexToIntegralComplex:
316 case CK_IntegralComplexCast:
317 case CK_IntegralComplexToFloatingComplex: {
319 return emitComplexToComplexCast(Visit(op), op->
getType(), destTy,
324 llvm_unreachable(
"unknown cast resulting in complex value");
327mlir::Value ComplexExprEmitter::VisitUnaryPlus(
const UnaryOperator *e) {
329 mlir::Value result = VisitPlusMinus(e, cir::UnaryOpKind::Plus, promotionTy);
330 if (!promotionTy.
isNull())
335mlir::Value ComplexExprEmitter::VisitPlusMinus(
const UnaryOperator *e,
336 cir::UnaryOpKind kind,
338 assert(kind == cir::UnaryOpKind::Plus ||
339 kind == cir::UnaryOpKind::Minus &&
340 "Invalid UnaryOp kind for ComplexType Plus or Minus");
343 if (!promotionType.
isNull())
350mlir::Value ComplexExprEmitter::VisitUnaryMinus(
const UnaryOperator *e) {
352 mlir::Value result = VisitPlusMinus(e, cir::UnaryOpKind::Minus, promotionTy);
353 if (!promotionTy.
isNull())
358mlir::Value ComplexExprEmitter::emitConstant(
360 assert(constant &&
"not a constant");
365 mlir::TypedAttr valueAttr = constant.
getValue();
369mlir::Value ComplexExprEmitter::emitLoadOfLValue(
LValue lv,
371 assert(lv.
isSimple() &&
"non-simple complex l-value?");
373 cgf.
cgm.
errorNYI(loc,
"emitLoadOfLValue with Atomic LV");
379void ComplexExprEmitter::emitStoreOfComplex(mlir::Location loc, mlir::Value val,
383 cgf.
cgm.
errorNYI(loc,
"StoreOfComplex with Atomic LV");
391mlir::Value ComplexExprEmitter::emitComplexToComplexCast(mlir::Value val,
395 if (srcType == destType)
402 cir::CastKind castOpKind;
404 castOpKind = cir::CastKind::float_complex;
406 castOpKind = cir::CastKind::float_complex_to_int_complex;
408 castOpKind = cir::CastKind::int_complex_to_float_complex;
410 castOpKind = cir::CastKind::int_complex;
412 llvm_unreachable(
"unexpected src type or dest type");
418mlir::Value ComplexExprEmitter::emitScalarToComplexCast(mlir::Value val,
422 cir::CastKind castOpKind;
424 castOpKind = cir::CastKind::float_to_complex;
426 castOpKind = cir::CastKind::int_to_complex;
428 llvm_unreachable(
"unexpected src type");
434mlir::Value ComplexExprEmitter::VisitAbstractConditionalOperator(
436 mlir::Value condValue = Visit(e->
getCond());
440 .create<cir::TernaryOp>(
443 [&](mlir::OpBuilder &
b, mlir::Location loc) {
445 b.create<cir::YieldOp>(loc, trueValue);
448 [&](mlir::OpBuilder &
b, mlir::Location loc) {
450 b.create<cir::YieldOp>(loc, falseValue);
455mlir::Value ComplexExprEmitter::VisitArraySubscriptExpr(
Expr *e) {
456 return emitLoadOfLValue(e);
459mlir::Value ComplexExprEmitter::VisitBinAssign(
const BinaryOperator *e) {
461 LValue lv = emitBinAssignLValue(e, value);
475mlir::Value ComplexExprEmitter::VisitBinComma(
const BinaryOperator *e) {
477 return Visit(e->
getRHS());
480mlir::Value ComplexExprEmitter::VisitCallExpr(
const CallExpr *e) {
482 return emitLoadOfLValue(e);
486mlir::Value ComplexExprEmitter::VisitCastExpr(
CastExpr *e) {
487 if (
const auto *ece = dyn_cast<ExplicitCastExpr>(e)) {
489 if (ece->getType()->isVariablyModifiedType()) {
490 cgf.
cgm.
errorNYI(
"VisitCastExpr Bind VLAs in the cast type");
496 return emitLoadOfLValue(e);
501mlir::Value ComplexExprEmitter::VisitChooseExpr(
ChooseExpr *e) {
512mlir::Value ComplexExprEmitter::VisitDeclRefExpr(
DeclRefExpr *e) {
514 return emitConstant(constant, e);
515 return emitLoadOfLValue(e);
527 return emitLoadOfLValue(e);
531mlir::Value ComplexExprEmitter::VisitInitListExpr(
InitListExpr *e) {
542 assert(e->
getNumInits() == 0 &&
"Unexpected number of inits");
550 mlir::Type elementTy = ty.getElementType();
553 mlir::TypedAttr realValueAttr;
554 mlir::TypedAttr imagValueAttr;
556 if (mlir::isa<cir::IntType>(elementTy)) {
557 llvm::APInt imagValue = cast<IntegerLiteral>(il->
getSubExpr())->getValue();
558 realValueAttr = cir::IntAttr::get(elementTy, 0);
559 imagValueAttr = cir::IntAttr::get(elementTy, imagValue);
561 assert(mlir::isa<cir::FPTypeInterface>(elementTy) &&
562 "Expected complex element type to be floating-point");
564 llvm::APFloat imagValue =
565 cast<FloatingLiteral>(il->
getSubExpr())->getValue();
566 realValueAttr = cir::FPAttr::get(
567 elementTy, llvm::APFloat::getZero(imagValue.getSemantics()));
568 imagValueAttr = cir::FPAttr::get(elementTy, imagValue);
571 auto complexAttr = cir::ConstComplexAttr::get(realValueAttr, imagValueAttr);
572 return builder.create<cir::ConstantOp>(loc, complexAttr);
575mlir::Value ComplexExprEmitter::VisitParenExpr(
ParenExpr *e) {
579mlir::Value ComplexExprEmitter::VisitSubstNonTypeTemplateParmExpr(
584mlir::Value ComplexExprEmitter::VisitPrePostIncDec(
const UnaryOperator *e,
591mlir::Value ComplexExprEmitter::VisitUnaryDeref(
const Expr *e) {
592 return emitLoadOfLValue(e);
595mlir::Value ComplexExprEmitter::VisitUnaryNot(
const UnaryOperator *e) {
600mlir::Value ComplexExprEmitter::emitPromoted(
const Expr *e,
603 if (
const auto *bo = dyn_cast<BinaryOperator>(e)) {
604 switch (bo->getOpcode()) {
605#define HANDLE_BINOP(OP) \
607 return emitBin##OP(emitBinOps(bo, promotionTy));
615 }
else if (
const auto *unaryOp = dyn_cast<UnaryOperator>(e)) {
616 switch (unaryOp->getOpcode()) {
619 auto kind = unaryOp->getOpcode() == UO_Plus ? cir::UnaryOpKind::Plus
620 : cir::UnaryOpKind::Minus;
621 return VisitPlusMinus(unaryOp, kind, promotionTy);
628 mlir::Value result = Visit(
const_cast<Expr *
>(e));
629 if (!promotionTy.
isNull())
636ComplexExprEmitter::emitPromotedComplexOperand(
const Expr *e,
639 if (!promotionTy.
isNull())
641 return Visit(
const_cast<Expr *
>(e));
644 if (!promotionTy.
isNull()) {
652ComplexExprEmitter::BinOpInfo
655 binOpInfo.lhs = emitPromotedComplexOperand(e->
getLHS(), promotionTy);
656 binOpInfo.rhs = emitPromotedComplexOperand(e->
getRHS(), promotionTy);
657 binOpInfo.ty = promotionTy.
isNull() ? e->
getType() : promotionTy;
662LValue ComplexExprEmitter::emitCompoundAssignLValue(
664 mlir::Value (ComplexExprEmitter::*func)(
const BinOpInfo &),
RValue &value) {
668 mlir::Location loc = cgf.
getLoc(exprLoc);
671 cgf.
cgm.
errorNYI(
"emitCompoundAssignLValue AtmoicType");
675 BinOpInfo opInfo{loc};
689 QualType promotionTypeRHS = getPromotionType(rhsTy);
693 if (!promotionTypeRHS.
isNull()) {
700 if (!promotionTypeRHS.
isNull()) {
704 opInfo.rhs = Visit(e->
getRHS());
713 mlir::Value lhsValue = emitLoadOfLValue(lhs, exprLoc);
714 QualType destTy = promotionTypeLHS.
isNull() ? opInfo.ty : promotionTypeLHS;
715 opInfo.lhs = emitComplexToComplexCast(lhsValue, lhsTy, destTy, exprLoc);
722 if (!promotionTypeLHS.
isNull()) {
723 promotedComplexElementTy =
724 cast<ComplexType>(promotionTypeLHS)->getElementType();
728 promotedComplexElementTy, exprLoc);
736 opInfo.lhs = emitScalarToComplexCast(lhsVal, lhsTy, opInfo.ty, exprLoc);
741 mlir::Value result = (this->*func)(opInfo);
745 mlir::Value resultValue =
746 emitComplexToComplexCast(result, opInfo.ty, lhsTy, exprLoc);
747 emitStoreOfComplex(loc, resultValue, lhs,
false);
750 mlir::Value resultValue =
759mlir::Value ComplexExprEmitter::emitCompoundAssign(
761 mlir::Value (ComplexExprEmitter::*func)(
const BinOpInfo &)) {
763 LValue lv = emitCompoundAssignLValue(e, func, val);
776mlir::Value ComplexExprEmitter::emitBinAdd(
const BinOpInfo &op) {
780 if (mlir::isa<cir::ComplexType>(op.lhs.getType()) &&
781 mlir::isa<cir::ComplexType>(op.rhs.getType()))
782 return builder.create<cir::ComplexAddOp>(op.loc, op.lhs, op.rhs);
784 if (mlir::isa<cir::ComplexType>(op.lhs.getType())) {
787 mlir::Value newReal = builder.
createAdd(op.loc, real, op.rhs);
791 assert(mlir::isa<cir::ComplexType>(op.rhs.getType()));
794 mlir::Value newReal = builder.
createAdd(op.loc, op.lhs, real);
798mlir::Value ComplexExprEmitter::emitBinSub(
const BinOpInfo &op) {
802 if (mlir::isa<cir::ComplexType>(op.lhs.getType()) &&
803 mlir::isa<cir::ComplexType>(op.rhs.getType()))
804 return builder.create<cir::ComplexSubOp>(op.loc, op.lhs, op.rhs);
806 if (mlir::isa<cir::ComplexType>(op.lhs.getType())) {
809 mlir::Value newReal = builder.
createSub(op.loc, real, op.rhs);
813 assert(mlir::isa<cir::ComplexType>(op.rhs.getType()));
816 mlir::Value newReal = builder.
createSub(op.loc, op.lhs, real);
820static cir::ComplexRangeKind
823 case LangOptions::CX_Full:
824 return cir::ComplexRangeKind::Full;
825 case LangOptions::CX_Improved:
826 return cir::ComplexRangeKind::Improved;
827 case LangOptions::CX_Promoted:
828 return cir::ComplexRangeKind::Promoted;
829 case LangOptions::CX_Basic:
830 return cir::ComplexRangeKind::Basic;
831 case LangOptions::CX_None:
833 return cir::ComplexRangeKind::Full;
837mlir::Value ComplexExprEmitter::emitBinMul(
const BinOpInfo &op) {
841 if (mlir::isa<cir::ComplexType>(op.lhs.getType()) &&
842 mlir::isa<cir::ComplexType>(op.rhs.getType())) {
843 cir::ComplexRangeKind rangeKind =
845 return builder.create<cir::ComplexMulOp>(op.loc, op.lhs, op.rhs, rangeKind);
848 if (mlir::isa<cir::ComplexType>(op.lhs.getType())) {
851 mlir::Value newReal = builder.
createMul(op.loc, real, op.rhs);
852 mlir::Value newImag = builder.
createMul(op.loc, imag, op.rhs);
856 assert(mlir::isa<cir::ComplexType>(op.rhs.getType()));
859 mlir::Value newReal = builder.
createMul(op.loc, op.lhs, real);
860 mlir::Value newImag = builder.
createMul(op.loc, op.lhs, imag);
864mlir::Value ComplexExprEmitter::emitBinDiv(
const BinOpInfo &op) {
872 if (mlir::isa<cir::ComplexType>(op.lhs.getType()) &&
873 mlir::isa<cir::ComplexType>(op.rhs.getType())) {
874 cir::ComplexRangeKind rangeKind =
876 return cir::ComplexDivOp::create(builder, op.loc, op.lhs, op.rhs,
882 if (mlir::isa<cir::ComplexType>(op.lhs.getType())) {
883 assert(mlir::cast<cir::ComplexType>(op.lhs.getType()).getElementType() ==
887 mlir::Value newReal = builder.
createFDiv(op.loc, real, op.rhs);
888 mlir::Value newImag = builder.
createFDiv(op.loc, imag, op.rhs);
892 assert(mlir::isa<cir::ComplexType>(op.rhs.getType()));
893 cir::ConstantOp nullValue = builder.
getNullValue(op.lhs.getType(), op.loc);
895 cir::ComplexRangeKind rangeKind =
897 return cir::ComplexDivOp::create(builder, op.loc, lhs, op.rhs, rangeKind);
901 assert(e->
getOpcode() == BO_Assign &&
"Expected assign op");
904 LValue lvalue = ComplexExprEmitter(*this).emitBinAssignLValue(e, value);
906 cgm.
errorNYI(
"emitComplexAssignmentLValue OpenMP");
913 "Invalid complex expression to emit");
915 return ComplexExprEmitter(*this).Visit(
const_cast<Expr *
>(e));
919 mlir::Value (ComplexExprEmitter::*)(
const ComplexExprEmitter::BinOpInfo &);
924 return &ComplexExprEmitter::emitBinMul;
926 return &ComplexExprEmitter::emitBinDiv;
928 return &ComplexExprEmitter::emitBinSub;
930 return &ComplexExprEmitter::emitBinAdd;
932 llvm_unreachable(
"unexpected complex compound assignment");
940 return ComplexExprEmitter(*this).emitCompoundAssignLValue(e, op, val);
947 assert(op == cir::UnaryOpKind::Inc ||
948 op == cir::UnaryOpKind::Dec &&
"Invalid UnaryOp kind for ComplexType");
958 cgm.
errorNYI(loc,
"emitComplexPrePostIncDec OpenMP");
962 return isPre ? incVal : inVal;
968 "Invalid complex expression to emit");
969 ComplexExprEmitter emitter(*
this);
970 mlir::Value value = emitter.Visit(
const_cast<Expr *
>(e));
975 return ComplexExprEmitter(*this).emitLoadOfLValue(src, loc);
979 LValue dest,
bool isInit) {
980 ComplexExprEmitter(*this).emitStoreOfComplex(loc, v, dest, isInit);
985 return ComplexExprEmitter(*this).emitPromoted(e, promotionType);
990 assert(!mlir::cast<cir::ComplexType>(result.getType()).isIntegerComplex() &&
991 "integral complex will never be promoted");
992 return builder.
createCast(cir::CastKind::float_complex, result,
998 assert(!mlir::cast<cir::ComplexType>(result.getType()).isIntegerComplex() &&
999 "integral complex will never be promoted");
1000 return builder.
createCast(cir::CastKind::float_complex, result,
1008 LValue ret = ComplexExprEmitter(*this).emitCompoundAssignLValue(e, op, value);
static CompoundFunc getComplexOp(BinaryOperatorKind op)
static const ComplexType * getComplexType(QualType type)
static cir::ComplexRangeKind getComplexRangeAttr(LangOptions::ComplexRangeKind range)
mlir::Value(ComplexExprEmitter::*)(const ComplexExprEmitter::BinOpInfo &) CompoundFunc
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...
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)
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.
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.
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.
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].
A reference to a declared variable, function, enum, etc.
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 ...
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.
ParenExpr - This represents a parenthesized expression, e.g.
const Expr * getSubExpr() const
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.
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
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
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
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()