//===- ComplexDialect.cpp - MLIR Complex Dialect --------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h" #include "mlir/Dialect/Complex/IR/Complex.h" using namespace mlir; #include "mlir/Dialect/Complex/IR/ComplexOpsDialect.cpp.inc" void complex::ComplexDialect::initialize() { addOperations< #define GET_OP_LIST #include "mlir/Dialect/Complex/IR/ComplexOps.cpp.inc" >(); } Operation *complex::ComplexDialect::materializeConstant(OpBuilder &builder, Attribute value, Type type, Location loc) { if (complex::ConstantOp::isBuildableWith(value, type)) { return builder.create(loc, type, value.cast()); } if (arith::ConstantOp::isBuildableWith(value, type)) return builder.create(loc, type, value); return nullptr; }