14 #ifndef MLIR_DIALECT_LLVMIR_LLVMTYPES_H_ 15 #define MLIR_DIALECT_LLVMIR_LLVMTYPES_H_ 34 struct LLVMFunctionTypeStorage;
35 struct LLVMPointerTypeStorage;
36 struct LLVMStructTypeStorage;
37 struct LLVMTypeAndSizeStorage;
42 #include "mlir/Dialect/LLVMIR/LLVMTypeInterfaces.h.inc" 52 #define DEFINE_TRIVIAL_LLVM_TYPE(ClassName) \ 53 class ClassName : public Type::TypeBase<ClassName, Type, TypeStorage> { \ 65 #undef DEFINE_TRIVIAL_LLVM_TYPE 75 :
public Type::TypeBase<LLVMArrayType, Type, detail::LLVMTypeAndSizeStorage,
76 DataLayoutTypeInterface::Trait> {
80 using Base::getChecked;
83 static bool isValidElementType(
Type type);
89 Type elementType,
unsigned numElements);
99 Type elementType,
unsigned numElements);
103 unsigned getTypeSizeInBits(
const DataLayout &dataLayout,
106 unsigned getTypeSize(
const DataLayout &dataLayout,
109 unsigned getABIAlignment(
const DataLayout &dataLayout,
112 unsigned getPreferredAlignment(
const DataLayout &dataLayout,
125 detail::LLVMFunctionTypeStorage> {
129 using Base::getChecked;
132 static bool isValidArgumentType(
Type type);
135 static bool isValidResultType(
Type type);
138 bool isVarArg()
const;
143 bool isVarArg =
false);
153 Type getReturnType();
160 unsigned getNumParams();
163 Type getParamType(
unsigned i);
183 detail::LLVMPointerTypeStorage,
184 DataLayoutTypeInterface::Trait> {
190 static bool isValidElementType(
Type type);
200 unsigned addressSpace = 0);
203 unsigned addressSpace = 0);
210 bool isOpaque()
const;
213 unsigned getAddressSpace()
const;
217 Type pointee,
unsigned);
225 unsigned getTypeSizeInBits(
const DataLayout &dataLayout,
227 unsigned getABIAlignment(
const DataLayout &dataLayout,
229 unsigned getPreferredAlignment(
const DataLayout &dataLayout,
266 :
public Type::TypeBase<LLVMStructType, Type, detail::LLVMStructTypeStorage,
267 DataLayoutTypeInterface::Trait> {
273 static bool isValidElementType(
Type type);
291 bool isPacked =
false);
296 bool isPacked =
false);
300 bool isPacked =
false);
322 bool isPacked()
const;
325 bool isIdentified()
const;
331 bool isInitialized();
347 unsigned getTypeSizeInBits(
const DataLayout &dataLayout,
350 unsigned getABIAlignment(
const DataLayout &dataLayout,
353 unsigned getPreferredAlignment(
const DataLayout &dataLayout,
371 detail::LLVMTypeAndSizeStorage> {
375 using Base::getChecked;
382 unsigned numElements);
387 static bool isValidElementType(
Type type);
397 Type elementType,
unsigned numElements);
409 detail::LLVMTypeAndSizeStorage> {
413 using Base::getChecked;
420 unsigned minNumElements);
423 static bool isValidElementType(
Type type);
431 unsigned getMinNumElements();
435 Type elementType,
unsigned minNumElements);
484 bool isScalable =
false);
503 #endif // MLIR_DIALECT_LLVMIR_LLVMTYPES_H_ Include the generated interface declarations.
bool isCompatibleFloatingPointType(Type type)
Returns true if the given type is a floating-point type compatible with the LLVM dialect.
llvm::ElementCount getVectorNumElements(Type type)
Returns the element count of any LLVM-compatible vector type.
Type getFixedVectorType(Type elementType, unsigned numElements)
Creates an LLVM dialect-compatible type with the given element type and length.
LLVM dialect scalable vector type, represents a sequence of elements of unknown length that is known ...
Explicitly register a set of "builtin" types.
bool isCompatibleOuterType(Type type)
Returns true if the given outer type is compatible with the LLVM dialect without checking its potenti...
This class represents a diagnostic that is inflight and set to be reported.
static Type getElementType(Type type, ArrayRef< int32_t > indices, function_ref< InFlightDiagnostic(StringRef)> emitErrorFn)
Walks the given type hierarchy with the given indices, potentially down to component granularity...
LLVM dialect function type.
void printType(Type type, AsmPrinter &printer)
Prints an LLVM Dialect type.
ArrayRef< Type > params()
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
This class represents an efficient way to signal success or failure.
bool isCompatibleType(Type type)
Returns true if the given type is compatible with the LLVM dialect.
This class provides an abstraction over the various different ranges of value types.
static LogicalResult verify(function_ref< InFlightDiagnostic()> emitError, MLIRContext *context, unsigned)
Type getScalableVectorType(Type elementType, unsigned numElements)
Creates an LLVM dialect-compatible type with the given element type and length.
#define DEFINE_TRIVIAL_LLVM_TYPE(ClassName)
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
Type parseType(DialectAsmParser &parser)
Parses an LLVM dialect type.
LLVM dialect structure type representing a collection of different-typed elements manipulated togethe...
static int64_t getNumElements(ShapedType type)
bool isCompatibleVectorType(Type type)
Returns true if the given type is a vector type compatible with the LLVM dialect. ...
static VectorType vectorType(CodeGen &codegen, Type etp)
Constructs vector type.
Utility class for implementing users of storage classes uniqued by a StorageUniquer.
MLIRContext is the top-level object for a collection of MLIR operations.
LLVM dialect pointer type.
llvm::TypeSize getPrimitiveTypeSizeInBits(Type type)
Returns the size of the given primitive LLVM dialect-compatible type (including vectors) in bits...
bool isScalableVectorType(Type vectorType)
Returns whether a vector type is scalable or not.
LogicalResult verify(Operation *op, bool verifyRecursively=true)
Perform (potentially expensive) checks of invariants, used to detect compiler bugs, on this operation and any nested operations.
static VectorType getVectorType(Type scalarTy, const VectorizationStrategy *strategy)
Returns the vector type resulting from applying the provided vectorization strategy on the scalar typ...
This base class exposes generic asm printer hooks, usable across the various derived printers...
LLVM dialect fixed vector type, represents a sequence of elements of known length that can be process...
Type getVectorElementType(Type type)
Returns the element type of any vector type compatible with the LLVM dialect.
The DialectAsmParser has methods for interacting with the asm parser when parsing attributes and type...
The main mechanism for performing data layout queries.