@@ -58,11 +58,6 @@ TYPE parseTypeSingleton(mlir::DialectAsmParser &parser, mlir::Location) {
58
58
return TYPE::get (ty);
59
59
}
60
60
61
- // `complex` `<` kind `>`
62
- fir::ComplexType parseComplex (mlir::DialectAsmParser &parser) {
63
- return parseKindSingleton<fir::ComplexType>(parser);
64
- }
65
-
66
61
// `slice` `<` rank `>`
67
62
SliceType parseSlice (mlir::DialectAsmParser &parser) {
68
63
return parseRankSingleton<SliceType>(parser);
@@ -309,7 +304,7 @@ mlir::Type fir::parseFirType(FIROpsDialect *dialect,
309
304
if (typeNameLit == " char" )
310
305
return generatedTypeParser (dialect->getContext (), parser, typeNameLit);
311
306
if (typeNameLit == " complex" )
312
- return parseComplex ( parser);
307
+ return generatedTypeParser (dialect-> getContext (), parser, typeNameLit );
313
308
if (typeNameLit == " field" )
314
309
return generatedTypeParser (dialect->getContext (), parser, typeNameLit);
315
310
if (typeNameLit == " heap" )
@@ -440,30 +435,6 @@ struct IntegerTypeStorage : public mlir::TypeStorage {
440
435
explicit IntegerTypeStorage (KindTy kind) : kind{kind} {}
441
436
};
442
437
443
- // / `COMPLEX` storage
444
- struct ComplexTypeStorage : public mlir ::TypeStorage {
445
- using KeyTy = KindTy;
446
-
447
- static unsigned hashKey (const KeyTy &key) { return llvm::hash_combine (key); }
448
-
449
- bool operator ==(const KeyTy &key) const { return key == getFKind (); }
450
-
451
- static ComplexTypeStorage *construct (mlir::TypeStorageAllocator &allocator,
452
- KindTy kind) {
453
- auto *storage = allocator.allocate <ComplexTypeStorage>();
454
- return new (storage) ComplexTypeStorage{kind};
455
- }
456
-
457
- KindTy getFKind () const { return kind; }
458
-
459
- protected:
460
- KindTy kind;
461
-
462
- private:
463
- ComplexTypeStorage () = delete ;
464
- explicit ComplexTypeStorage (KindTy kind) : kind{kind} {}
465
- };
466
-
467
438
// / `REAL` storage (for reals of unsupported sizes)
468
439
struct RealTypeStorage : public mlir ::TypeStorage {
469
440
using KeyTy = KindTy;
@@ -779,18 +750,6 @@ fir::IntegerType fir::IntegerType::get(mlir::MLIRContext *ctxt, KindTy kind) {
779
750
780
751
KindTy fir::IntegerType::getFKind () const { return getImpl ()->getFKind (); }
781
752
782
- // COMPLEX
783
-
784
- fir::ComplexType fir::ComplexType::get (mlir::MLIRContext *ctxt, KindTy kind) {
785
- return Base::get (ctxt, kind);
786
- }
787
-
788
- mlir::Type fir::ComplexType::getElementType () const {
789
- return fir::RealType::get (getContext (), getFKind ());
790
- }
791
-
792
- KindTy fir::ComplexType::getFKind () const { return getImpl ()->getFKind (); }
793
-
794
753
// REAL
795
754
796
755
RealType fir::RealType::get (mlir::MLIRContext *ctxt, KindTy kind) {
@@ -1081,11 +1040,6 @@ void fir::verifyIntegralType(mlir::Type type) {
1081
1040
void fir::printFirType (FIROpsDialect *, mlir::Type ty,
1082
1041
mlir::DialectAsmPrinter &p) {
1083
1042
auto &os = p.getStream ();
1084
- if (auto type = ty.dyn_cast <fir::ComplexType>()) {
1085
- // Fortran intrinsic type COMPLEX
1086
- os << " complex<" << type.getFKind () << ' >' ;
1087
- return ;
1088
- }
1089
1043
if (auto type = ty.dyn_cast <RecordType>()) {
1090
1044
// Fortran derived type
1091
1045
os << " type<" << type.getName ();
@@ -1328,3 +1282,16 @@ void fir::CharacterType::print(::mlir::DialectAsmPrinter &printer) const {
1328
1282
}
1329
1283
printer << ' >' ;
1330
1284
}
1285
+
1286
+ // ===----------------------------------------------------------------------===//
1287
+ // ComplexType
1288
+ // ===----------------------------------------------------------------------===//
1289
+
1290
+ mlir::Type fir::ComplexType::parse (mlir::MLIRContext *context,
1291
+ mlir::DialectAsmParser &parser) {
1292
+ return parseKindSingleton<fir::ComplexType>(parser);
1293
+ }
1294
+
1295
+ mlir::Type fir::ComplexType::getElementType () const {
1296
+ return fir::RealType::get (getContext (), getFKind ());
1297
+ }
0 commit comments