Index: flang/include/flang/Optimizer/Dialect/FIROps.td =================================================================== --- flang/include/flang/Optimizer/Dialect/FIROps.td +++ flang/include/flang/Optimizer/Dialect/FIROps.td @@ -32,7 +32,7 @@ // Fortran intrinsic types def fir_CharacterType : Type()">, "FIR character type">; -def fir_ComplexType : Type()">, +def fir_ComplexType : Type()">, "FIR complex type">; def fir_IntegerType : Type()">, "FIR integer type">; @@ -2427,7 +2427,7 @@ }]; let verifier = [{ - if (!getType().isa()) + if (!getType().isa()) return emitOpError("must be a !fir.complex type"); return mlir::success(); }]; @@ -2563,7 +2563,7 @@ def FortranTypeAttr : Attr()">, Or<[CPred<"$_self.cast().getValue().isa()">, - CPred<"$_self.cast().getValue().isa()">, + CPred<"$_self.cast().getValue().isa()">, CPred<"$_self.cast().getValue().isa()">, CPred<"$_self.cast().getValue().isa()">, CPred<"$_self.cast().getValue().isa()">, Index: flang/include/flang/Optimizer/Dialect/FIRType.h =================================================================== --- flang/include/flang/Optimizer/Dialect/FIRType.h +++ flang/include/flang/Optimizer/Dialect/FIRType.h @@ -39,7 +39,7 @@ struct BoxCharTypeStorage; struct BoxProcTypeStorage; struct CharacterTypeStorage; -struct CplxTypeStorage; +struct ComplexTypeStorage; struct DimsTypeStorage; struct FieldTypeStorage; struct HeapTypeStorage; @@ -105,11 +105,11 @@ /// Model of a Fortran COMPLEX intrinsic type, including the KIND type /// parameter. COMPLEX is a floating point type with a real and imaginary /// member. -class CplxType : public mlir::Type::TypeBase { +class ComplexType : public mlir::Type::TypeBase { public: using Base::Base; - static CplxType get(mlir::MLIRContext *ctxt, KindTy kind); + static fir::ComplexType get(mlir::MLIRContext *ctxt, KindTy kind); /// Get the corresponding fir.real type. mlir::Type getElementType() const; @@ -129,9 +129,8 @@ /// Model of a Fortran LOGICAL intrinsic type, including the KIND type /// parameter. -class LogicalType - : public mlir::Type::TypeBase { +class LogicalType : public mlir::Type::TypeBase { public: using Base::Base; static LogicalType get(mlir::MLIRContext *ctxt, KindTy kind); @@ -394,7 +393,7 @@ /// Is `t` a FIR or MLIR Complex type? inline bool isa_complex(mlir::Type t) { - return t.isa() || t.isa(); + return t.isa() || t.isa(); } } // namespace fir Index: flang/lib/Lower/ComplexExpr.cpp =================================================================== --- flang/lib/Lower/ComplexExpr.cpp +++ flang/lib/Lower/ComplexExpr.cpp @@ -16,7 +16,7 @@ mlir::Type Fortran::lower::ComplexExprHelper::getComplexPartType(mlir::Type complexType) { return Fortran::lower::convertReal( - builder.getContext(), complexType.cast().getFKind()); + builder.getContext(), complexType.cast().getFKind()); } mlir::Type @@ -27,7 +27,7 @@ mlir::Value Fortran::lower::ComplexExprHelper::createComplex(fir::KindTy kind, mlir::Value real, mlir::Value imag) { - auto complexTy = fir::CplxType::get(builder.getContext(), kind); + auto complexTy = fir::ComplexType::get(builder.getContext(), kind); mlir::Value und = builder.create(loc, complexTy); return insert(insert(und, real), imag); } Index: flang/lib/Lower/ConvertType.cpp =================================================================== --- flang/lib/Lower/ConvertType.cpp +++ flang/lib/Lower/ConvertType.cpp @@ -167,7 +167,7 @@ int KIND) { if (Fortran::evaluate::IsValidKindOfIntrinsicType( Fortran::common::TypeCategory::Complex, KIND)) - return fir::CplxType::get(context, KIND); + return fir::ComplexType::get(context, KIND); return {}; } Index: flang/lib/Lower/FIRBuilder.cpp =================================================================== --- flang/lib/Lower/FIRBuilder.cpp +++ flang/lib/Lower/FIRBuilder.cpp @@ -149,7 +149,7 @@ auto eleTy = helper.getComplexPartType(toTy); auto cast = createConvert(loc, eleTy, val); llvm::APFloat zero{ - kindMap.getFloatSemantics(toTy.cast().getFKind()), 0}; + kindMap.getFloatSemantics(toTy.cast().getFKind()), 0}; auto imag = createRealConstant(loc, eleTy, zero); return helper.createComplex(toTy, cast, imag); } Index: flang/lib/Lower/IO.cpp =================================================================== --- flang/lib/Lower/IO.cpp +++ flang/lib/Lower/IO.cpp @@ -202,7 +202,7 @@ return ty.getWidth() <= 32 ? getIORuntimeFunc(loc, builder) : getIORuntimeFunc(loc, builder); - if (auto ty = type.dyn_cast()) + if (auto ty = type.dyn_cast()) return ty.getFKind() <= 4 ? getIORuntimeFunc(loc, builder) : getIORuntimeFunc(loc, builder); @@ -274,7 +274,7 @@ return ty.getWidth() <= 32 ? getIORuntimeFunc(loc, builder) : getIORuntimeFunc(loc, builder); - if (auto ty = type.dyn_cast()) + if (auto ty = type.dyn_cast()) return ty.getFKind() <= 4 ? getIORuntimeFunc(loc, builder) : getIORuntimeFunc(loc, builder); @@ -314,7 +314,7 @@ auto argType = inputFunc.getType().getInput(1); auto originalItemAddr = itemAddr; mlir::Type complexPartType; - if (itemType.isa()) + if (itemType.isa()) complexPartType = builder.getRefType( Fortran::lower::ComplexExprHelper{builder, loc}.getComplexPartType( itemType)); Index: flang/lib/Lower/IntrinsicCall.cpp =================================================================== --- flang/lib/Lower/IntrinsicCall.cpp +++ flang/lib/Lower/IntrinsicCall.cpp @@ -439,7 +439,7 @@ // - or use evaluate/type.h if (auto r{t.dyn_cast()}) return r.getFKind() * 4; - if (auto cplx{t.dyn_cast()}) + if (auto cplx{t.dyn_cast()}) return cplx.getFKind() * 4; llvm_unreachable("not a floating-point type"); } @@ -459,8 +459,8 @@ ? Conversion::Narrow : Conversion::Extend; } - if (auto fromCplxTy{from.dyn_cast()}) { - if (auto toCplxTy{to.dyn_cast()}) { + if (auto fromCplxTy{from.dyn_cast()}) { + if (auto toCplxTy{to.dyn_cast()}) { return getFloatingPointWidth(fromCplxTy) > getFloatingPointWidth(toCplxTy) ? Conversion::Narrow Index: flang/lib/Lower/Mangler.cpp =================================================================== --- flang/lib/Lower/Mangler.cpp +++ flang/lib/Lower/Mangler.cpp @@ -134,7 +134,7 @@ if (auto i{t.dyn_cast()}) { return "i" + std::to_string(i.getWidth()); } - if (auto cplx{t.dyn_cast()}) { + if (auto cplx{t.dyn_cast()}) { return "z" + std::to_string(cplx.getFKind()); } if (auto real{t.dyn_cast()}) { Index: flang/lib/Optimizer/Dialect/FIRDialect.cpp =================================================================== --- flang/lib/Optimizer/Dialect/FIRDialect.cpp +++ flang/lib/Optimizer/Dialect/FIRDialect.cpp @@ -15,9 +15,10 @@ fir::FIROpsDialect::FIROpsDialect(mlir::MLIRContext *ctx) : mlir::Dialect("fir", ctx, mlir::TypeID::get()) { - addTypes(); + addTypes(); addAttributes(); addOperations< Index: flang/lib/Optimizer/Dialect/FIRType.cpp =================================================================== --- flang/lib/Optimizer/Dialect/FIRType.cpp +++ flang/lib/Optimizer/Dialect/FIRType.cpp @@ -87,8 +87,8 @@ } // `complex` `<` kind `>` -CplxType parseComplex(mlir::DialectAsmParser &parser) { - return parseKindSingleton(parser); +fir::ComplexType parseComplex(mlir::DialectAsmParser &parser) { + return parseKindSingleton(parser); } // `dims` `<` rank `>` @@ -493,17 +493,17 @@ }; /// `COMPLEX` storage -struct CplxTypeStorage : public mlir::TypeStorage { +struct ComplexTypeStorage : public mlir::TypeStorage { using KeyTy = KindTy; static unsigned hashKey(const KeyTy &key) { return llvm::hash_combine(key); } bool operator==(const KeyTy &key) const { return key == getFKind(); } - static CplxTypeStorage *construct(mlir::TypeStorageAllocator &allocator, - KindTy kind) { - auto *storage = allocator.allocate(); - return new (storage) CplxTypeStorage{kind}; + static ComplexTypeStorage *construct(mlir::TypeStorageAllocator &allocator, + KindTy kind) { + auto *storage = allocator.allocate(); + return new (storage) ComplexTypeStorage{kind}; } KindTy getFKind() const { return kind; } @@ -512,8 +512,8 @@ KindTy kind; private: - CplxTypeStorage() = delete; - explicit CplxTypeStorage(KindTy kind) : kind{kind} {} + ComplexTypeStorage() = delete; + explicit ComplexTypeStorage(KindTy kind) : kind{kind} {} }; /// `REAL` storage (for reals of unsupported sizes) @@ -833,8 +833,8 @@ bool isa_fir_or_std_type(mlir::Type t) { if (auto funcType = t.dyn_cast()) - return llvm::all_of(funcType.getInputs(), isa_fir_or_std_type) && - llvm::all_of(funcType.getResults(), isa_fir_or_std_type); + return llvm::all_of(funcType.getInputs(), isa_fir_or_std_type) && + llvm::all_of(funcType.getResults(), isa_fir_or_std_type); return isa_fir_type(t) || isa_std_type(t); } @@ -909,15 +909,15 @@ // COMPLEX -CplxType fir::CplxType::get(mlir::MLIRContext *ctxt, KindTy kind) { +fir::ComplexType fir::ComplexType::get(mlir::MLIRContext *ctxt, KindTy kind) { return Base::get(ctxt, kind); } -mlir::Type fir::CplxType::getElementType() const { +mlir::Type fir::ComplexType::getElementType() const { return fir::RealType::get(getContext(), getFKind()); } -KindTy fir::CplxType::getFKind() const { return getImpl()->getFKind(); } +KindTy fir::ComplexType::getFKind() const { return getImpl()->getFKind(); } // REAL @@ -1245,7 +1245,7 @@ os << "char<" << type.getFKind() << '>'; return; } - if (auto type = ty.dyn_cast()) { + if (auto type = ty.dyn_cast()) { os << "complex<" << type.getFKind() << '>'; return; }