@@ -58,18 +58,24 @@ bool isa_std_type(mlir::Type t);
58
58
bool isa_fir_or_std_type (mlir::Type t);
59
59
60
60
// / Is `t` a FIR dialect type that implies a memory (de)reference?
61
- bool isa_ref_type (mlir::Type t);
62
-
63
- // / Is `t` a type that is always trivially pass-by-reference? Specifically, this
64
- // / is testing if `t` is a ReferenceType or any box type. Compare this to
65
- // / conformsWithPassByRef(), which includes pointers and allocatables.
66
- bool isa_passbyref_type (mlir::Type t);
61
+ inline bool isa_ref_type (mlir::Type t) {
62
+ return t.isa <ReferenceType>() || t.isa <PointerType>() || t.isa <HeapType>() ||
63
+ t.isa <fir::LLVMPointerType>();
64
+ }
67
65
68
66
// / Is `t` a boxed type?
69
67
inline bool isa_box_type (mlir::Type t) {
70
68
return t.isa <BoxType>() || t.isa <BoxCharType>() || t.isa <BoxProcType>();
71
69
}
72
70
71
+ // / Is `t` a type that is always trivially pass-by-reference? Specifically, this
72
+ // / is testing if `t` is a ReferenceType or any box type. Compare this to
73
+ // / conformsWithPassByRef(), which includes pointers and allocatables.
74
+ inline bool isa_passbyref_type (mlir::Type t) {
75
+ return t.isa <ReferenceType>() || isa_box_type (t) ||
76
+ t.isa <mlir::FunctionType>();
77
+ }
78
+
73
79
// / Is `t` a type that can conform to be pass-by-reference? Depending on the
74
80
// / context, these types may simply demote to pass-by-reference or a reference
75
81
// / to them may have to be passed instead.
0 commit comments