MLIR  20.0.0git
ComplexToLLVM.h
Go to the documentation of this file.
1 //===- ComplexToLLVM.h - Utils to convert from the complex dialect --------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef MLIR_CONVERSION_COMPLEXTOLLVM_COMPLEXTOLLVM_H_
9 #define MLIR_CONVERSION_COMPLEXTOLLVM_COMPLEXTOLLVM_H_
10 
12 
13 namespace mlir {
14 class DialectRegistry;
15 class LLVMTypeConverter;
16 class Pass;
17 class RewritePatternSet;
18 
19 #define GEN_PASS_DECL_CONVERTCOMPLEXTOLLVMPASS
20 #include "mlir/Conversion/Passes.h.inc"
21 
23 public:
24  /// Construct a helper for the given complex number value.
26  /// Build IR creating an `undef` value of the complex number type.
27  static ComplexStructBuilder undef(OpBuilder &builder, Location loc,
28  Type type);
29 
30  // Build IR extracting the real value from the complex number struct.
31  Value real(OpBuilder &builder, Location loc);
32  // Build IR inserting the real value into the complex number struct.
33  void setReal(OpBuilder &builder, Location loc, Value real);
34 
35  // Build IR extracting the imaginary value from the complex number struct.
36  Value imaginary(OpBuilder &builder, Location loc);
37  // Build IR inserting the imaginary value into the complex number struct.
38  void setImaginary(OpBuilder &builder, Location loc, Value imaginary);
39 };
40 
41 /// Populate the given list with patterns that convert from Complex to LLVM.
43  RewritePatternSet &patterns);
44 
46 
47 } // namespace mlir
48 
49 #endif // MLIR_CONVERSION_COMPLEXTOLLVM_COMPLEXTOLLVM_H_
static ComplexStructBuilder undef(OpBuilder &builder, Location loc, Type type)
Build IR creating an undef value of the complex number type.
Value imaginary(OpBuilder &builder, Location loc)
void setImaginary(OpBuilder &builder, Location loc, Value imaginary)
void setReal(OpBuilder &builder, Location loc, Value real)
Value real(OpBuilder &builder, Location loc)
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
Conversion from types to the LLVM IR dialect.
Definition: TypeConverter.h:35
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Definition: Location.h:66
This class helps build Operations.
Definition: Builders.h:215
Helper class to produce LLVM dialect operations extracting or inserting values to a struct.
Definition: StructBuilder.h:26
StructBuilder(Value v)
Construct a helper for the given value.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition: Types.h:74
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Definition: Value.h:96
Include the generated interface declarations.
void registerConvertComplexToLLVMInterface(DialectRegistry &registry)
void populateComplexToLLVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns)
Populate the given list with patterns that convert from Complex to LLVM.