MLIR 23.0.0git
BuiltinTypeInterfaces.h
Go to the documentation of this file.
1//===- BuiltinTypeInterfaces.h - Builtin Type Interfaces --------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef MLIR_IR_BUILTINTYPEINTERFACES_H
10#define MLIR_IR_BUILTINTYPEINTERFACES_H
11
13#include "mlir/IR/Types.h"
14
15namespace llvm {
16struct fltSemantics;
17} // namespace llvm
18
19namespace mlir {
20class FloatType;
21class MLIRContext;
22
23namespace detail {
24/// Float type implementation of
25/// DenseElementTypeInterface::getDenseElementBitSize.
26size_t getFloatTypeDenseElementBitSize(Type type);
27
28/// Float type implementation of DenseElementTypeInterface::convertToAttribute.
29Attribute convertFloatTypeToAttribute(Type type, llvm::ArrayRef<char> rawData);
30
31/// Float type implementation of
32/// DenseElementTypeInterface::convertFromAttribute.
33LogicalResult
34convertFloatTypeFromAttribute(Type type, Attribute attr,
35 llvm::SmallVectorImpl<char> &result);
36
37/// Read `bitWidth` bits from byte-aligned position in `rawData` and return as
38/// an APInt. Handles endianness correctly.
39llvm::APInt readBits(const char *rawData, size_t bitPos, size_t bitWidth);
40
41/// Write `value` to byte-aligned position `bitPos` in `rawData`. Handles
42/// endianness correctly.
43void writeBits(char *rawData, size_t bitPos, llvm::APInt value);
44} // namespace detail
45} // namespace mlir
46
47#include "mlir/IR/BuiltinTypeInterfaces.h.inc"
48#include "mlir/IR/OpAsmTypeInterface.h.inc"
49
50#endif // MLIR_IR_BUILTINTYPEINTERFACES_H
MLIRContext is the top-level object for a collection of MLIR operations.
Definition MLIRContext.h:63
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition CallGraph.h:229
AttrTypeReplacer.
llvm::APInt readBits(const char *rawData, size_t bitPos, size_t bitWidth)
Read bitWidth bits from byte-aligned position in rawData and return as an APInt.
LogicalResult convertFloatTypeFromAttribute(Type type, Attribute attr, llvm::SmallVectorImpl< char > &result)
Float type implementation of DenseElementTypeInterface::convertFromAttribute.
size_t getFloatTypeDenseElementBitSize(Type type)
Float type implementation of DenseElementTypeInterface::getDenseElementBitSize.
Attribute convertFloatTypeToAttribute(Type type, llvm::ArrayRef< char > rawData)
Float type implementation of DenseElementTypeInterface::convertToAttribute.
void writeBits(char *rawData, size_t bitPos, llvm::APInt value)
Write value to byte-aligned position bitPos in rawData.
Include the generated interface declarations.