#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"
}
usingnamespacemlir;
usingnamespacemlir::LLVM;
usingnamespacemlir::arith;
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) { … }
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> { … };
}
void mlir::populateComplexToLLVMConversionPatterns(
LLVMTypeConverter &converter, RewritePatternSet &patterns) { … }
namespace {
struct ConvertComplexToLLVMPass
: public impl::ConvertComplexToLLVMPassBase<ConvertComplexToLLVMPass> { … };
}
void ConvertComplexToLLVMPass::runOnOperation() { … }
namespace {
struct ComplexToLLVMDialectInterface : public ConvertToLLVMPatternInterface { … };
}
void mlir::registerConvertComplexToLLVMInterface(DialectRegistry ®istry) { … }