9 #ifndef MLIR_IR_TYPES_H 10 #define MLIR_IR_TYPES_H 13 #include "llvm/ADT/ArrayRef.h" 14 #include "llvm/ADT/DenseMapInfo.h" 25 struct FunctionTypeStorage;
26 struct OpaqueTypeStorage;
98 #define DEFINE_SYM_KIND_RANGE(Dialect) \ 99 FIRST_##Dialect##_TYPE, LAST_##Dialect##_TYPE = FIRST_##Dialect##_TYPE + 0xff, 100 #include "DialectSymbolRegistry.def" 104 template <
typename ConcreteType,
typename BaseType,
106 using TypeBase = detail::StorageUserBase<ConcreteType, BaseType, StorageType,
113 : impl(const_cast<
ImplType *>(impl)) {}
116 Type &operator=(
const Type &other) =
default;
120 explicit operator bool()
const {
return impl; }
124 template <
typename U>
bool isa()
const;
125 template <
typename U> U dyn_cast()
const;
126 template <
typename U> U dyn_cast_or_null()
const;
127 template <
typename U> U cast()
const;
133 unsigned getKind()
const;
150 bool isInteger(
unsigned width);
154 unsigned getIntOrFloatBitWidth();
159 bool isIntOrIndexOrFloat();
164 void print(raw_ostream &os);
169 unsigned getSubclassData()
const;
170 void setSubclassData(
unsigned val);
174 return static_cast<const void *
>(impl);
177 return Type(reinterpret_cast<ImplType *>(const_cast<void *>(pointer)));
191 :
public Type::TypeBase<FunctionType, Type, detail::FunctionTypeStorage> {
206 unsigned getNumResults()
const;
213 static bool kindof(
unsigned kind) {
return kind == Kind::Function; }
220 :
public Type::TypeBase<OpaqueType, Type, detail::OpaqueTypeStorage> {
238 StringRef getTypeData()
const;
255 assert(impl &&
"isa<> used on a null type.");
256 return U::classof(*
this);
259 return isa<U>() ? U(impl) : U(
nullptr);
262 return (impl && isa<U>()) ? U(impl) : U(
nullptr);
277 return mlir::Type(static_cast<mlir::Type::ImplType *>(pointer));
281 return mlir::Type(static_cast<mlir::Type::ImplType *>(pointer));
288 template <>
struct PointerLikeTypeTraits<
mlir::
Type> {
296 enum { NumLowBitsAvailable = 3 };
301 #endif // MLIR_IR_TYPES_H bool operator!() const
Definition: Types.h:122
Definition: InferTypeOpInterface.cpp:20
const void * getAsOpaquePointer() const
Methods for supporting PointerLikeTypeTraits.
Definition: Types.h:173
ImplType * impl
Definition: Types.h:181
Type getResult(unsigned i) const
Definition: Types.h:208
Definition: PassRegistry.cpp:413
Kind
Definition: Types.h:91
Definition: Attributes.h:139
static bool isEqual(mlir::Type LHS, mlir::Type RHS)
Definition: Types.h:284
Base storage class appearing in a Type.
Definition: TypeSupport.h:33
Function types map from a list of inputs to a list of results.
Definition: Types.h:190
Definition: Identifier.h:26
Type getInput(unsigned i) const
Definition: Types.h:201
Definition: Location.h:52
static bool classof(Type)
Definition: Types.h:130
static unsigned getHashValue(mlir::Type val)
Definition: Types.h:283
Definition: LogicalResult.h:18
U dyn_cast_or_null() const
Definition: Types.h:261
static mlir::Type getFromVoidPointer(void *P)
Definition: Types.h:293
static bool kindof(unsigned kind)
Definition: Types.h:246
U dyn_cast() const
Definition: Types.h:258
Type()
Definition: Types.h:111
Definition: TypeSupport.h:86
static Type getFromOpaquePointer(const void *pointer)
Definition: Types.h:176
inline ::llvm::hash_code hash_value(Type arg)
Definition: Types.h:250
unsigned getNumInputs() const
Definition: Types.h:199
void print(raw_ostream &os)
Print the current type.
Definition: AsmPrinter.cpp:2070
bool operator==(Type other) const
Definition: Types.h:118
Definition: Attributes.h:136
inline ::llvm::hash_code hash_value(AffineExpr arg)
Make AffineExpr hashable.
Definition: AffineExpr.h:201
static bool kindof(unsigned kind)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition: Types.h:213
Type(const ImplType *impl)
Definition: Types.h:112
Definition: StorageUniquerSupport.h:30
Definition: MLIRContext.h:34
void print(OpAsmPrinter &p, AffineIfOp op)
Definition: AffineOps.cpp:1671
static void * getAsVoidPointer(mlir::Type I)
Definition: Types.h:290
static mlir::Type getTombstoneKey()
Definition: Types.h:279
raw_ostream & operator<<(raw_ostream &os, SubViewOp::Range &range)
Definition: Ops.cpp:2759
bool isa() const
Definition: Types.h:254
static mlir::Type getEmptyKey()
Definition: Types.h:275
TypeStorage DefaultTypeStorage
Definition: TypeSupport.h:70
U cast() const
Definition: Types.h:264
bool operator!=(Type other) const
Definition: Types.h:119