From d0eed3480b1d7852f8b1293f1cee0ad318a6a469 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Tue, 16 Apr 2024 22:11:47 -0700 Subject: [PATCH] [CIR][Rebase] Add new enum type handling --- clang/lib/CIR/CodeGen/CIRGenExpr.cpp | 2 ++ clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp | 2 ++ clang/lib/CIR/CodeGen/CIRGenExprConst.cpp | 1 + clang/lib/CIR/CodeGen/CIRGenFunction.cpp | 4 ++++ clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp | 4 ++++ clang/lib/CIR/CodeGen/CIRGenTypes.cpp | 2 ++ 6 files changed, 15 insertions(+) diff --git a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp index 2945ab084641..b79c5ed26151 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp @@ -21,6 +21,7 @@ #include "clang/AST/ExprCXX.h" #include "clang/AST/GlobalDecl.h" +#include "clang/AST/OperationKinds.h" #include "clang/Basic/Builtins.h" #include "clang/CIR/Dialect/IR/CIRDialect.h" #include "clang/CIR/Dialect/IR/CIROpsEnums.h" @@ -1601,6 +1602,7 @@ LValue CIRGenFunction::buildStringLiteralLValue(const StringLiteral *E) { /// result, including noop aggregate casts, and cast from scalar to union. LValue CIRGenFunction::buildCastLValue(const CastExpr *E) { switch (E->getCastKind()) { + case CK_HLSLArrayRValue: case CK_HLSLVectorTruncation: case CK_ToVoid: case CK_BitCast: diff --git a/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp b/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp index ae627ef50d59..06139f66c017 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp @@ -599,6 +599,8 @@ bool AggExprEmitter::TypeRequiresGCollection(QualType T) { /// TODO(cir): this can be shared with LLVM codegen. static bool castPreservesZero(const CastExpr *CE) { switch (CE->getCastKind()) { + case CK_HLSLArrayRValue: + llvm_unreachable("NYI"); case CK_HLSLVectorTruncation: llvm_unreachable("NYI"); // No-ops. diff --git a/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp b/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp index 0d4bbd35d3c2..8c527c2072bd 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp @@ -877,6 +877,7 @@ class ConstExprEmitter Expr *subExpr = E->getSubExpr(); switch (E->getCastKind()) { + case CK_HLSLArrayRValue: case CK_HLSLVectorTruncation: case CK_ToUnion: llvm_unreachable("not implemented"); diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp index 6aa98084ba28..9a4698681fad 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp @@ -56,6 +56,8 @@ TypeEvaluationKind CIRGenFunction::getEvaluationKind(QualType type) { type = type.getCanonicalType(); while (true) { switch (type->getTypeClass()) { + case Type::ArrayParameter: + llvm_unreachable("NYI"); #define TYPE(name, parent) #define ABSTRACT_TYPE(name, parent) #define NON_CANONICAL_TYPE(name, parent) case Type::name: @@ -1554,6 +1556,8 @@ void CIRGenFunction::buildVariablyModifiedType(QualType type) { const Type *ty = type.getTypePtr(); switch (ty->getTypeClass()) { + case Type::ArrayParameter: + llvm_unreachable("NYI"); case clang::Type::CountAttributed: case clang::Type::PackIndexing: llvm_unreachable("NYI"); diff --git a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp index c8a374faa41e..a14cbb03d98b 100644 --- a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp @@ -1467,6 +1467,8 @@ void CIRGenItaniumRTTIBuilder::BuildVTablePointer(mlir::Location loc, const char *VTableName = nullptr; switch (Ty->getTypeClass()) { + case Type::ArrayParameter: + llvm_unreachable("NYI"); #define TYPE(Class, Base) #define ABSTRACT_TYPE(Class, Base) #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: @@ -1838,6 +1840,8 @@ mlir::Attribute CIRGenItaniumRTTIBuilder::BuildTypeInfo( Fields.push_back(TypeNameField); switch (Ty->getTypeClass()) { + case Type::ArrayParameter: + llvm_unreachable("NYI"); #define TYPE(Class, Base) #define ABSTRACT_TYPE(Class, Base) #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp index a5bbf40c238b..f3e73df675ce 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp @@ -374,6 +374,8 @@ mlir::Type CIRGenTypes::ConvertType(QualType T) { // If we don't have it in the cache, convert it now. mlir::Type ResultType = nullptr; switch (Ty->getTypeClass()) { + case Type::ArrayParameter: + llvm_unreachable("NYI"); case Type::Record: // Handled above. #define TYPE(Class, Base) #define ABSTRACT_TYPE(Class, Base)