For example, I have a parametrized type !dialect.anytype<...> which can contain 0 or more FunctionTypes. I access this type with mlir::Type object and I don’t know exactly what type this is.
Is there a way to find all occurrences of the FunctionTypes? !dialect.anytype can possibly be parametrized with types of dialects other than the dialect.
Basically, I’d be happy enough if I just could get type parameters list from mlir::Type object, but I didn’t find a way to get it. Probably, I wasn’t looking hard enough.
I still do not understand the question
So, let me clarify what I want to do.
I need to implement the traversal to find FunctionType occurrence(s).
I need the FunctionType to check its return type for some properties - already implemented.
To find the FunctionType inside a type, I need to get its parameters, but mlir::Type object doesn’t have member functions to get them.
In any case, there is no generalized storage for “type type parameters”, or for type parameters in general, that one would be able to inspect generically. You can either dyn_cast / TypeSwitch to a subset of types you need to handle, or introduce a type interface and have the relevant types implement it.