1 //===- NarrowTypeEmulationConverter.h - Type Converter for NTE -----*- C++ 2 //-*-===// 3 // 4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 // See https://llvm.org/LICENSE.txt for license information. 6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef MLIR_DIALECT_ARITH_NARROW_TYPE_EMULATION_CONVERTER_H_ 11 #define MLIR_DIALECT_ARITH_NARROW_TYPE_EMULATION_CONVERTER_H_ 12 13 #include "mlir/Transforms/DialectConversion.h" 14 15 namespace mlir::arith { 16 /// Converts narrow integer or float types that are not supported 17 /// by the target hardware to wider types. Currently, we only 18 /// handle power-of-two integer types and convert them to wider 19 /// integers that are equal or larger than 8 bits. 20 class NarrowTypeEmulationConverter : public TypeConverter { 21 public: 22 explicit NarrowTypeEmulationConverter(unsigned targetBitwidth); 23 getLoadStoreBitwidth()24 unsigned getLoadStoreBitwidth() const { return loadStoreBitwidth; } 25 26 private: 27 unsigned loadStoreBitwidth; 28 }; 29 } // namespace mlir::arith 30 31 #endif // MLIR_DIALECT_ARITH_NARROW_TYPE_EMULATION_CONVERTER_H_ 32