Skip to content

Commit 6f2557d

Browse files
authored
[fir][NFC] inline trivial isa_<types> functions
1 parent 5c45615 commit 6f2557d

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

flang/include/flang/Optimizer/Dialect/FIRType.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,24 @@ bool isa_std_type(mlir::Type t);
5858
bool isa_fir_or_std_type(mlir::Type t);
5959

6060
/// 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+
}
6765

6866
/// Is `t` a boxed type?
6967
inline bool isa_box_type(mlir::Type t) {
7068
return t.isa<BoxType>() || t.isa<BoxCharType>() || t.isa<BoxProcType>();
7169
}
7270

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+
7379
/// Is `t` a type that can conform to be pass-by-reference? Depending on the
7480
/// context, these types may simply demote to pass-by-reference or a reference
7581
/// to them may have to be passed instead.

flang/lib/Optimizer/Dialect/FIRType.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,6 @@ bool isa_fir_or_std_type(mlir::Type t) {
198198
return isa_fir_type(t) || isa_std_type(t);
199199
}
200200

201-
bool isa_ref_type(mlir::Type t) {
202-
return t.isa<ReferenceType>() || t.isa<PointerType>() || t.isa<HeapType>() ||
203-
t.isa<fir::LLVMPointerType>();
204-
}
205-
206-
bool isa_passbyref_type(mlir::Type t) {
207-
return t.isa<ReferenceType>() || isa_box_type(t) ||
208-
t.isa<mlir::FunctionType>();
209-
}
210-
211201
mlir::Type dyn_cast_ptrEleTy(mlir::Type t) {
212202
return llvm::TypeSwitch<mlir::Type, mlir::Type>(t)
213203
.Case<fir::ReferenceType, fir::PointerType, fir::HeapType,

0 commit comments

Comments
 (0)