Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 169 additions & 1 deletion clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
return {};
}

mlir::Value VisitConstantExpr(ConstantExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: constant expr");
return {};
}

mlir::Value VisitPackIndexingExpr(PackIndexingExpr *e) {
return Visit(e->getSelectedExpr());
}
Expand All @@ -159,6 +164,14 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
mlir::Value VisitCoawaitExpr(CoawaitExpr *s) {
return cgf.emitCoawaitExpr(*s).getValue();
}
mlir::Value VisitCoyieldExpr(CoyieldExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: coyield");
return {};
}
mlir::Value VisitUnaryCoawait(const UnaryOperator *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: unary coawait");
return {};
}

mlir::Value emitLoadOfLValue(LValue lv, SourceLocation loc) {
return cgf.emitLoadOfLValue(lv, loc).getValue();
Expand Down Expand Up @@ -198,6 +211,12 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
cir::IntAttr::get(type, e->getValue()));
}

mlir::Value VisitFixedPointLiteral(const FixedPointLiteral *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: fixed point literal");
return {};
}

mlir::Value VisitFloatingLiteral(const FloatingLiteral *e) {
mlir::Type type = cgf.convertType(e->getType());
assert(mlir::isa<cir::FPTypeInterface>(type) &&
Expand Down Expand Up @@ -229,6 +248,23 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {

mlir::Value VisitOffsetOfExpr(OffsetOfExpr *e);

mlir::Value VisitSizeOfPackExpr(SizeOfPackExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: size of pack");
return {};
}
mlir::Value VisitPseudoObjectExpr(PseudoObjectExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: pseudo object");
return {};
}
mlir::Value VisitSYCLUniqueStableNameExpr(SYCLUniqueStableNameExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: sycl unique stable name");
return {};
}
mlir::Value VisitEmbedExpr(EmbedExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: embed");
return {};
}
mlir::Value VisitOpaqueValueExpr(OpaqueValueExpr *e) {
if (e->isGLValue())
return emitLoadOfLValue(cgf.getOrCreateOpaqueLValueMapping(e),
Expand All @@ -238,6 +274,38 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
return cgf.getOrCreateOpaqueRValueMapping(e).getValue();
}

mlir::Value VisitObjCSelectorExpr(ObjCSelectorExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: objc selector");
return {};
}
mlir::Value VisitObjCProtocolExpr(ObjCProtocolExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: objc protocol");
return {};
}
mlir::Value VisitObjCIVarRefExpr(ObjCIvarRefExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: objc ivar ref");
return {};
}
mlir::Value VisitObjCMessageExpr(ObjCMessageExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: objc message");
return {};
}
mlir::Value VisitObjCIsaExpr(ObjCIsaExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: objc isa");
return {};
}
mlir::Value VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: objc availability check");
return {};
}

mlir::Value VisitMatrixSubscriptExpr(MatrixSubscriptExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: matrix subscript");
return {};
}

mlir::Value VisitCastExpr(CastExpr *e);
mlir::Value VisitCallExpr(const CallExpr *e);

Expand Down Expand Up @@ -319,6 +387,18 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {

mlir::Value VisitInitListExpr(InitListExpr *e);

mlir::Value VisitArrayInitIndexExpr(ArrayInitIndexExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: array init index");
return {};
}

mlir::Value VisitImplicitValueInitExpr(const ImplicitValueInitExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: implicit value init");
return {};
}

mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) {
return VisitCastExpr(e);
}
Expand Down Expand Up @@ -726,6 +806,16 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
return Visit(e->getSubExpr());
}

// C++
mlir::Value VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: materialize temporary");
return {};
}
mlir::Value VisitSourceLocExpr(SourceLocExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: source loc");
return {};
}
mlir::Value VisitCXXDefaultArgExpr(CXXDefaultArgExpr *dae) {
CIRGenFunction::CXXDefaultArgExprScope scope(cgf, dae);
return Visit(dae->getExpr());
Expand All @@ -745,11 +835,43 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
cgf.emitCXXDeleteExpr(e);
return {};
}

mlir::Value VisitTypeTraitExpr(const TypeTraitExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: type trait");
return {};
}
mlir::Value
VisitConceptSpecializationExpr(const ConceptSpecializationExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: concept specialization");
return {};
}
mlir::Value VisitRequiresExpr(const RequiresExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: requires");
return {};
}
mlir::Value VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: array type trait");
return {};
}
mlir::Value VisitExpressionTraitExpr(const ExpressionTraitExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: expression trait");
return {};
}
mlir::Value VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: cxx pseudo destructor");
return {};
}
mlir::Value VisitCXXThrowExpr(const CXXThrowExpr *e) {
cgf.emitCXXThrowExpr(e);
return {};
}
mlir::Value VisitCXXNoexceptExpr(CXXNoexceptExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: cxx noexcept");
return {};
}

/// Emit a conversion from the specified type to the specified destination
/// type, both of which are CIR scalar types.
Expand Down Expand Up @@ -1213,6 +1335,52 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
return maybePromoteBoolResult(resOp.getResult(), resTy);
}

mlir::Value VisitBinPtrMemD(const BinaryOperator *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: ptr mem d");
return {};
}

mlir::Value VisitBinPtrMemI(const BinaryOperator *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: ptr mem i");
return {};
}

// Other Operators.
mlir::Value VisitBlockExpr(const BlockExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: block");
return {};
}

mlir::Value VisitChooseExpr(ChooseExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: choose");
return {};
}

mlir::Value VisitObjCStringLiteral(const ObjCStringLiteral *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: objc string literal");
return {};
}
mlir::Value VisitObjCBoxedExpr(ObjCBoxedExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: objc boxed");
return {};
}
mlir::Value VisitObjCArrayLiteral(ObjCArrayLiteral *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: objc array literal");
return {};
}
mlir::Value VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *e) {
cgf.cgm.errorNYI(e->getSourceRange(),
"ScalarExprEmitter: objc dictionary literal");
return {};
}

mlir::Value VisitAsTypeExpr(AsTypeExpr *e) {
cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: as type");
return {};
}

mlir::Value VisitAtomicExpr(AtomicExpr *e) {
return cgf.emitAtomicExpr(e).getValue();
}
Expand Down