#include "mlir/Conversion/TosaToArith/TosaToArith.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
usingnamespacemlir;
usingnamespacetosa;
namespace {
class ConstOpConverter : public OpRewritePattern<tosa::ConstOp> { … };
Type matchContainerType(Type element, Type container) { … }
TypedAttr getConstantAttr(Type type, int64_t value, PatternRewriter &rewriter) { … }
Value getConstantValue(Location loc, Type type, int64_t value,
PatternRewriter &rewriter) { … }
class ApplyScaleGenericOpConverter
: public OpRewritePattern<tosa::ApplyScaleOp> { … };
class ApplyScale32BitOpConverter : public OpRewritePattern<tosa::ApplyScaleOp> { … };
}
void mlir::tosa::populateTosaToArithConversionPatterns(
RewritePatternSet *patterns) { … }
void mlir::tosa::populateTosaRescaleToArithConversionPatterns(
RewritePatternSet *patterns, bool include32Bit) { … }