#include "mlir/Conversion/ComplexToLibm/ComplexToLibm.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include <optional>
namespace mlir {
#define GEN_PASS_DEF_CONVERTCOMPLEXTOLIBM
#include "mlir/Conversion/Passes.h.inc"
}
usingnamespacemlir;
namespace {
struct ComplexTypeResolver { … };
struct FloatTypeResolver { … };
template <typename Op, typename TypeResolver = ComplexTypeResolver>
struct ScalarOpToLibmCall : public OpRewritePattern<Op> { … };
}
template <typename Op, typename TypeResolver>
LogicalResult ScalarOpToLibmCall<Op, TypeResolver>::matchAndRewrite(
Op op, PatternRewriter &rewriter) const { … }
void mlir::populateComplexToLibmConversionPatterns(RewritePatternSet &patterns,
PatternBenefit benefit) { … }
namespace {
struct ConvertComplexToLibmPass
: public impl::ConvertComplexToLibmBase<ConvertComplexToLibmPass> { … };
}
void ConvertComplexToLibmPass::runOnOperation() { … }
std::unique_ptr<OperationPass<ModuleOp>>
mlir::createConvertComplexToLibmPass() { … }