llvm/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp

//===- ComplexToLLVM.cpp - conversion from Complex to LLVM 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/Conversion/ComplexToLLVM/ComplexToLLVM.h"

#include "mlir/Conversion/ArithCommon/AttrToLLVMConverter.h"
#include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Pass/Pass.h"

namespace mlir {
#define GEN_PASS_DEF_CONVERTCOMPLEXTOLLVMPASS
#include "mlir/Conversion/Passes.h.inc"
} // namespace mlir

usingnamespacemlir;
usingnamespacemlir::LLVM;
usingnamespacemlir::arith;

//===----------------------------------------------------------------------===//
// ComplexStructBuilder implementation.
//===----------------------------------------------------------------------===//

static constexpr unsigned kRealPosInComplexNumberStruct =;
static constexpr unsigned kImaginaryPosInComplexNumberStruct =;

ComplexStructBuilder ComplexStructBuilder::undef(OpBuilder &builder,
                                                 Location loc, Type type) {}

void ComplexStructBuilder::setReal(OpBuilder &builder, Location loc,
                                   Value real) {}

Value ComplexStructBuilder::real(OpBuilder &builder, Location loc) {}

void ComplexStructBuilder::setImaginary(OpBuilder &builder, Location loc,
                                        Value imaginary) {}

Value ComplexStructBuilder::imaginary(OpBuilder &builder, Location loc) {}

//===----------------------------------------------------------------------===//
// Conversion patterns.
//===----------------------------------------------------------------------===//

namespace {

struct AbsOpConversion : public ConvertOpToLLVMPattern<complex::AbsOp> {};

struct ConstantOpLowering : public ConvertOpToLLVMPattern<complex::ConstantOp> {};

struct CreateOpConversion : public ConvertOpToLLVMPattern<complex::CreateOp> {};

struct ReOpConversion : public ConvertOpToLLVMPattern<complex::ReOp> {};

struct ImOpConversion : public ConvertOpToLLVMPattern<complex::ImOp> {};

struct BinaryComplexOperands {};

template <typename OpTy>
BinaryComplexOperands
unpackBinaryComplexOperands(OpTy op, typename OpTy::Adaptor adaptor,
                            ConversionPatternRewriter &rewriter) {}

struct AddOpConversion : public ConvertOpToLLVMPattern<complex::AddOp> {};

struct DivOpConversion : public ConvertOpToLLVMPattern<complex::DivOp> {};

struct MulOpConversion : public ConvertOpToLLVMPattern<complex::MulOp> {};

struct SubOpConversion : public ConvertOpToLLVMPattern<complex::SubOp> {};
} // namespace

void mlir::populateComplexToLLVMConversionPatterns(
    LLVMTypeConverter &converter, RewritePatternSet &patterns) {}

namespace {
struct ConvertComplexToLLVMPass
    : public impl::ConvertComplexToLLVMPassBase<ConvertComplexToLLVMPass> {};
} // namespace

void ConvertComplexToLLVMPass::runOnOperation() {}

//===----------------------------------------------------------------------===//
// ConvertToLLVMPatternInterface implementation
//===----------------------------------------------------------------------===//

namespace {
/// Implement the interface to convert MemRef to LLVM.
struct ComplexToLLVMDialectInterface : public ConvertToLLVMPatternInterface {};
} // namespace

void mlir::registerConvertComplexToLLVMInterface(DialectRegistry &registry) {}