19 #include "llvm/ADT/APInt.h"
20 #include "llvm/Support/FormatVariadic.h"
21 #include "llvm/Support/MathExtras.h"
31 unsigned targetBitwidth)
32 : loadStoreBitwidth(targetBitwidth) {
33 assert(llvm::isPowerOf2_32(targetBitwidth) &&
34 "Only power-of-two integers are supported");
40 addConversion([
this](FunctionType ty) -> std::optional<Type> {
57 populateFunctionOpInterfaceTypeConversionPattern<func::FuncOp>(
patterns,
void addConversion(FnT &&callback)
Register a conversion function.
LogicalResult convertTypes(TypeRange types, SmallVectorImpl< Type > &results) const
Convert the given set of types, filling 'results' as necessary.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
MLIRContext * getContext() const
Return the MLIRContext in which this type was uniqued.
Converts narrow integer or float types that are not supported by the target hardware to wider types.
NarrowTypeEmulationConverter(unsigned targetBitwidth)
void populateArithNarrowTypeEmulationPatterns(const NarrowTypeEmulationConverter &typeConverter, RewritePatternSet &patterns)
Adds patterns to emulate narrow Arith and Function ops into wide supported types.
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns
void populateCallOpTypeConversionPattern(RewritePatternSet &patterns, const TypeConverter &converter)
Add a pattern to the given pattern list to convert the operand and result types of a CallOp with the ...
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
void populateReturnOpTypeConversionPattern(RewritePatternSet &patterns, const TypeConverter &converter)
Add a pattern to the given pattern list to rewrite return ops to use operands that have been legalize...