@@ -58,11 +58,6 @@ TYPE parseTypeSingleton(mlir::DialectAsmParser &parser, mlir::Location) {
58
58
return TYPE::get (ty);
59
59
}
60
60
61
- // `boxproc` `<` return-type `>`
62
- BoxProcType parseBoxProc (mlir::DialectAsmParser &parser, mlir::Location loc) {
63
- return parseTypeSingleton<BoxProcType>(parser, loc);
64
- }
65
-
66
61
// `complex` `<` kind `>`
67
62
fir::ComplexType parseComplex (mlir::DialectAsmParser &parser) {
68
63
return parseKindSingleton<fir::ComplexType>(parser);
@@ -310,7 +305,7 @@ mlir::Type fir::parseFirType(FIROpsDialect *dialect,
310
305
if (typeNameLit == " boxchar" )
311
306
return generatedTypeParser (dialect->getContext (), parser, typeNameLit);
312
307
if (typeNameLit == " boxproc" )
313
- return parseBoxProc ( parser, loc );
308
+ return generatedTypeParser (dialect-> getContext (), parser, typeNameLit );
314
309
if (typeNameLit == " char" )
315
310
return generatedTypeParser (dialect->getContext (), parser, typeNameLit);
316
311
if (typeNameLit == " complex" )
@@ -493,31 +488,6 @@ struct RealTypeStorage : public mlir::TypeStorage {
493
488
explicit RealTypeStorage (KindTy kind) : kind{kind} {}
494
489
};
495
490
496
- // / Boxed PROCEDURE POINTER object type
497
- struct BoxProcTypeStorage : public mlir ::TypeStorage {
498
- using KeyTy = mlir::Type;
499
-
500
- static unsigned hashKey (const KeyTy &key) { return llvm::hash_combine (key); }
501
-
502
- bool operator ==(const KeyTy &key) const { return key == getElementType (); }
503
-
504
- static BoxProcTypeStorage *construct (mlir::TypeStorageAllocator &allocator,
505
- mlir::Type eleTy) {
506
- assert (eleTy && " element type is null" );
507
- auto *storage = allocator.allocate <BoxProcTypeStorage>();
508
- return new (storage) BoxProcTypeStorage{eleTy};
509
- }
510
-
511
- mlir::Type getElementType () const { return eleTy; }
512
-
513
- protected:
514
- mlir::Type eleTy;
515
-
516
- private:
517
- BoxProcTypeStorage () = delete ;
518
- explicit BoxProcTypeStorage (mlir::Type eleTy) : eleTy{eleTy} {}
519
- };
520
-
521
491
// / Pointer-like object storage
522
492
struct ReferenceTypeStorage : public mlir ::TypeStorage {
523
493
using KeyTy = mlir::Type;
@@ -836,27 +806,6 @@ fir::BoxType::verifyConstructionInvariants(mlir::Location, mlir::Type eleTy,
836
806
return mlir::success ();
837
807
}
838
808
839
- // BoxProc<T>
840
-
841
- BoxProcType fir::BoxProcType::get (mlir::Type elementType) {
842
- return Base::get (elementType.getContext (), elementType);
843
- }
844
-
845
- mlir::Type fir::BoxProcType::getEleTy () const {
846
- return getImpl ()->getElementType ();
847
- }
848
-
849
- mlir::LogicalResult
850
- fir::BoxProcType::verifyConstructionInvariants (mlir::Location loc,
851
- mlir::Type eleTy) {
852
- if (eleTy.isa <mlir::FunctionType>())
853
- return mlir::success ();
854
- if (auto refTy = eleTy.dyn_cast <ReferenceType>())
855
- if (refTy.isa <mlir::FunctionType>())
856
- return mlir::success ();
857
- return mlir::emitError (loc, " invalid type for boxproc" ) << eleTy << ' \n ' ;
858
- }
859
-
860
809
// Reference<T>
861
810
862
811
ReferenceType fir::ReferenceType::get (mlir::Type elementType) {
@@ -1132,12 +1081,6 @@ void fir::verifyIntegralType(mlir::Type type) {
1132
1081
void fir::printFirType (FIROpsDialect *, mlir::Type ty,
1133
1082
mlir::DialectAsmPrinter &p) {
1134
1083
auto &os = p.getStream ();
1135
- if (auto type = ty.dyn_cast <BoxProcType>()) {
1136
- os << " boxproc<" ;
1137
- p.printType (type.getEleTy ());
1138
- os << ' >' ;
1139
- return ;
1140
- }
1141
1084
if (auto type = ty.dyn_cast <fir::ComplexType>()) {
1142
1085
// Fortran intrinsic type COMPLEX
1143
1086
os << " complex<" << type.getFKind () << ' >' ;
@@ -1260,6 +1203,32 @@ bool fir::isa_unknown_size_box(mlir::Type t) {
1260
1203
return false ;
1261
1204
}
1262
1205
1206
+ // ===----------------------------------------------------------------------===//
1207
+ // BoxProcType
1208
+ // ===----------------------------------------------------------------------===//
1209
+
1210
+ // `boxproc` `<` return-type `>`
1211
+ mlir::Type BoxProcType::parse (mlir::MLIRContext *context,
1212
+ mlir::DialectAsmParser &parser) {
1213
+ mlir::Type ty;
1214
+ if (parser.parseLess () || parser.parseType (ty) || parser.parseGreater ()) {
1215
+ parser.emitError (parser.getCurrentLocation (), " type expected" );
1216
+ return Type ();
1217
+ }
1218
+ return get (context, ty);
1219
+ }
1220
+
1221
+ mlir::LogicalResult
1222
+ BoxProcType::verifyConstructionInvariants (mlir::Location loc,
1223
+ mlir::Type eleTy) {
1224
+ if (eleTy.isa <mlir::FunctionType>())
1225
+ return mlir::success ();
1226
+ if (auto refTy = eleTy.dyn_cast <ReferenceType>())
1227
+ if (refTy.isa <mlir::FunctionType>())
1228
+ return mlir::success ();
1229
+ return mlir::emitError (loc, " invalid type for boxproc" ) << eleTy << ' \n ' ;
1230
+ }
1231
+
1263
1232
// ===----------------------------------------------------------------------===//
1264
1233
// BoxType
1265
1234
// ===----------------------------------------------------------------------===//
0 commit comments