MLIR  20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
mlir::FloatType Class Reference

#include "mlir/IR/BuiltinTypes.h"

+ Inheritance diagram for mlir::FloatType:

Public Member Functions

unsigned getWidth ()
 Return the bitwidth of this float type. More...
 
unsigned getFPMantissaWidth ()
 Return the width of the mantissa of this type. More...
 
FloatType scaleElementBitwidth (unsigned scale)
 Get or create a new FloatType with bitwidth scaled by scale. More...
 
const llvm::fltSemantics & getFloatSemantics ()
 Return the floating semantics of this float type. More...
 
constexpr Type ()=default
 
 Type (const ImplType *impl)
 
 Type (const Type &other)=default
 
- Public Member Functions inherited from mlir::Type
constexpr Type ()=default
 
 Type (const ImplType *impl)
 
 Type (const Type &other)=default
 
Typeoperator= (const Type &other)=default
 
bool operator== (Type other) const
 
bool operator!= (Type other) const
 
 operator bool () const
 
bool operator! () const
 
template<typename... Tys>
bool isa () const
 
template<typename... Tys>
bool isa_and_nonnull () const
 
template<typename U >
dyn_cast () const
 
template<typename U >
dyn_cast_or_null () const
 
template<typename U >
cast () const
 
TypeID getTypeID ()
 Return a unique identifier for the concrete type. More...
 
MLIRContextgetContext () const
 Return the MLIRContext in which this type was uniqued. More...
 
DialectgetDialect () const
 Get the dialect this type is registered to. More...
 
bool isIndex () const
 
bool isFloat4E2M1FN () const
 
bool isFloat6E2M3FN () const
 
bool isFloat6E3M2FN () const
 
bool isFloat8E5M2 () const
 
bool isFloat8E4M3 () const
 
bool isFloat8E4M3FN () const
 
bool isFloat8E5M2FNUZ () const
 
bool isFloat8E4M3FNUZ () const
 
bool isFloat8E4M3B11FNUZ () const
 
bool isFloat8E3M4 () const
 
bool isFloat8E8M0FNU () const
 
bool isBF16 () const
 
bool isF16 () const
 
bool isTF32 () const
 
bool isF32 () const
 
bool isF64 () const
 
bool isF80 () const
 
bool isF128 () const
 
bool isInteger () const
 Return true if this is an integer type (with the specified width). More...
 
bool isInteger (unsigned width) const
 Return true if this is an integer type with the specified width. More...
 
bool isSignlessInteger () const
 Return true if this is a signless integer type (with the specified width). More...
 
bool isSignlessInteger (unsigned width) const
 
bool isSignedInteger () const
 Return true if this is a signed integer type (with the specified width). More...
 
bool isSignedInteger (unsigned width) const
 
bool isUnsignedInteger () const
 Return true if this is an unsigned integer type (with the specified width). More...
 
bool isUnsignedInteger (unsigned width) const
 
unsigned getIntOrFloatBitWidth () const
 Return the bit width of an integer or a float type, assert failure on other types. More...
 
bool isSignlessIntOrIndex () const
 Return true if this is a signless integer or index type. More...
 
bool isSignlessIntOrIndexOrFloat () const
 Return true if this is a signless integer, index, or float type. More...
 
bool isSignlessIntOrFloat () const
 Return true of this is a signless integer or a float type. More...
 
bool isIntOrIndex () const
 Return true if this is an integer (of any signedness) or an index type. More...
 
bool isIntOrFloat () const
 Return true if this is an integer (of any signedness) or a float type. More...
 
bool isIntOrIndexOrFloat () const
 Return true if this is an integer (of any signedness), index, or float type. More...
 
void print (raw_ostream &os) const
 Print the current type. More...
 
void print (raw_ostream &os, AsmState &state) const
 
void dump () const
 
const void * getAsOpaquePointer () const
 Methods for supporting PointerLikeTypeTraits. More...
 
template<typename InterfaceT >
bool hasPromiseOrImplementsInterface ()
 Returns true if InterfaceT has been promised by the dialect or implemented. More...
 
template<template< typename T > class Trait>
bool hasTrait ()
 Returns true if the type was registered with a particular trait. More...
 
const AbstractTygetAbstractType () const
 Return the abstract type descriptor for this type. More...
 
ImplTypegetImpl () const
 Return the Type implementation. More...
 
void walkImmediateSubElements (function_ref< void(Attribute)> walkAttrsFn, function_ref< void(Type)> walkTypesFn) const
 Walk all of the immediately nested sub-attributes and sub-types. More...
 
auto replaceImmediateSubElements (ArrayRef< Attribute > replAttrs, ArrayRef< Type > replTypes) const
 Replace the immediately nested sub-attributes and sub-types with those provided. More...
 
template<WalkOrder Order = WalkOrder::PostOrder, typename... WalkFns>
auto walk (WalkFns &&...walkFns)
 Walk this type and all attibutes/types nested within using the provided walk functions. More...
 
template<typename... ReplacementFns>
auto replace (ReplacementFns &&...replacementFns)
 Recursively replace all of the nested sub-attributes and sub-types using the provided map functions. More...
 

Static Public Member Functions

static FloatType getBF16 (MLIRContext *ctx)
 
static FloatType getF16 (MLIRContext *ctx)
 
static FloatType getF32 (MLIRContext *ctx)
 
static FloatType getTF32 (MLIRContext *ctx)
 
static FloatType getF64 (MLIRContext *ctx)
 
static FloatType getF80 (MLIRContext *ctx)
 
static FloatType getF128 (MLIRContext *ctx)
 
static FloatType getFloat8E5M2 (MLIRContext *ctx)
 
static FloatType getFloat8E4M3 (MLIRContext *ctx)
 
static FloatType getFloat8E4M3FN (MLIRContext *ctx)
 
static FloatType getFloat8E5M2FNUZ (MLIRContext *ctx)
 
static FloatType getFloat8E4M3FNUZ (MLIRContext *ctx)
 
static FloatType getFloat8E4M3B11FNUZ (MLIRContext *ctx)
 
static FloatType getFloat8E3M4 (MLIRContext *ctx)
 
static FloatType getFloat4E2M1FN (MLIRContext *ctx)
 
static FloatType getFloat6E2M3FN (MLIRContext *ctx)
 
static FloatType getFloat6E3M2FN (MLIRContext *ctx)
 
static FloatType getFloat8E8M0FNU (MLIRContext *ctx)
 
static bool classof (Type type)
 Methods for support type inquiry through isa, cast, and dyn_cast. More...
 
- Static Public Member Functions inherited from mlir::Type
static Type getFromOpaquePointer (const void *pointer)
 

Additional Inherited Members

- Public Types inherited from mlir::Type
template<typename ConcreteType , typename BaseType , typename StorageType , template< typename T > class... Traits>
using TypeBase = detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... >
 Utility class for implementing types. More...
 
using ImplType = TypeStorage
 
using AbstractTy = AbstractType
 
- Protected Attributes inherited from mlir::Type
ImplTypeimpl {nullptr}
 

Detailed Description

Definition at line 51 of file BuiltinTypes.h.

Member Function Documentation

◆ classof()

bool mlir::FloatType::classof ( Type  type)
inlinestatic

Methods for support type inquiry through isa, cast, and dyn_cast.

Definition at line 451 of file BuiltinTypes.h.

◆ getBF16()

FloatType mlir::FloatType::getBF16 ( MLIRContext ctx)
inlinestatic

Definition at line 504 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getBF16Type(), getScalarConstantAsAttr(), and mlirBF16TypeGet().

◆ getF128()

FloatType mlir::FloatType::getF128 ( MLIRContext ctx)
inlinestatic

Definition at line 528 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getF128Type(), and mlir::LLVM::detail::getFloatType().

◆ getF16()

FloatType mlir::FloatType::getF16 ( MLIRContext ctx)
inlinestatic

◆ getF32()

FloatType mlir::FloatType::getF32 ( MLIRContext ctx)
inlinestatic

◆ getF64()

FloatType mlir::FloatType::getF64 ( MLIRContext ctx)
inlinestatic

◆ getF80()

FloatType mlir::FloatType::getF80 ( MLIRContext ctx)
inlinestatic

Definition at line 524 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getF80Type(), and mlir::LLVM::detail::getFloatType().

◆ getFloat4E2M1FN()

FloatType mlir::FloatType::getFloat4E2M1FN ( MLIRContext ctx)
inlinestatic

Definition at line 460 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getFloat4E2M1FNType(), and mlirFloat4E2M1FNTypeGet().

◆ getFloat6E2M3FN()

FloatType mlir::FloatType::getFloat6E2M3FN ( MLIRContext ctx)
inlinestatic

Definition at line 464 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getFloat6E2M3FNType(), and mlirFloat6E2M3FNTypeGet().

◆ getFloat6E3M2FN()

FloatType mlir::FloatType::getFloat6E3M2FN ( MLIRContext ctx)
inlinestatic

Definition at line 468 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getFloat6E3M2FNType(), and mlirFloat6E3M2FNTypeGet().

◆ getFloat8E3M4()

FloatType mlir::FloatType::getFloat8E3M4 ( MLIRContext ctx)
inlinestatic

Definition at line 496 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getFloat8E3M4Type(), and mlirFloat8E3M4TypeGet().

◆ getFloat8E4M3()

FloatType mlir::FloatType::getFloat8E4M3 ( MLIRContext ctx)
inlinestatic

Definition at line 476 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getFloat8E4M3Type(), and mlirFloat8E4M3TypeGet().

◆ getFloat8E4M3B11FNUZ()

FloatType mlir::FloatType::getFloat8E4M3B11FNUZ ( MLIRContext ctx)
inlinestatic

Definition at line 492 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getFloat8E4M3B11FNUZType(), and mlirFloat8E4M3B11FNUZTypeGet().

◆ getFloat8E4M3FN()

FloatType mlir::FloatType::getFloat8E4M3FN ( MLIRContext ctx)
inlinestatic

Definition at line 480 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getFloat8E4M3FNType(), and mlirFloat8E4M3FNTypeGet().

◆ getFloat8E4M3FNUZ()

FloatType mlir::FloatType::getFloat8E4M3FNUZ ( MLIRContext ctx)
inlinestatic

Definition at line 488 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getFloat8E4M3FNUZType(), and mlirFloat8E4M3FNUZTypeGet().

◆ getFloat8E5M2()

FloatType mlir::FloatType::getFloat8E5M2 ( MLIRContext ctx)
inlinestatic

Definition at line 472 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getFloat8E5M2Type(), and mlirFloat8E5M2TypeGet().

◆ getFloat8E5M2FNUZ()

FloatType mlir::FloatType::getFloat8E5M2FNUZ ( MLIRContext ctx)
inlinestatic

Definition at line 484 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getFloat8E5M2FNUZType(), and mlirFloat8E5M2FNUZTypeGet().

◆ getFloat8E8M0FNU()

FloatType mlir::FloatType::getFloat8E8M0FNU ( MLIRContext ctx)
inlinestatic

Definition at line 500 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getFloat8E8M0FNUType(), and mlirFloat8E8M0FNUTypeGet().

◆ getFloatSemantics()

const llvm::fltSemantics & FloatType::getFloatSemantics ( )

Return the floating semantics of this float type.

Returns the floating semantics for the given type.

Definition at line 98 of file BuiltinTypes.cpp.

Referenced by convertScalarToComplexDtype(), and CmpFIntToFPConst::matchAndRewrite().

◆ getFPMantissaWidth()

unsigned FloatType::getFPMantissaWidth ( )

Return the width of the mantissa of this type.

The width includes the integer bit.

Definition at line 154 of file BuiltinTypes.cpp.

Referenced by CmpFIntToFPConst::matchAndRewrite().

◆ getTF32()

FloatType mlir::FloatType::getTF32 ( MLIRContext ctx)
inlinestatic

Definition at line 512 of file BuiltinTypes.h.

References mlir::get().

Referenced by mlir::Builder::getTF32Type(), and mlirTF32TypeGet().

◆ getWidth()

unsigned FloatType::getWidth ( )

Return the bitwidth of this float type.

Definition at line 93 of file BuiltinTypes.cpp.

Referenced by convertScalarToFpDtype(), mlir::spirv::ScalarType::isValid(), and CmpFIntToFPConst::matchAndRewrite().

◆ scaleElementBitwidth()

FloatType FloatType::scaleElementBitwidth ( unsigned  scale)

Get or create a new FloatType with bitwidth scaled by scale.

Return null if the scaled element type cannot be represented.

Definition at line 138 of file BuiltinTypes.cpp.

References getContext(), getF32(), and getF64().

◆ Type() [1/3]

constexpr mlir::Type::Type
constexprdefault

◆ Type() [2/3]

mlir::Type::Type
inline

Definition at line 87 of file Types.h.

◆ Type() [3/3]

mlir::Type::Type
default

The documentation for this class was generated from the following files: