• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- LLVMDialect.h - MLIR LLVM IR dialect ---------------------*- C++ -*-===//
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 //
9 // This file defines the LLVM IR dialect in MLIR, containing LLVM operations and
10 // LLVM type system.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MLIR_DIALECT_LLVMIR_LLVMDIALECT_H_
15 #define MLIR_DIALECT_LLVMIR_LLVMDIALECT_H_
16 
17 #include "mlir/Dialect/LLVMIR/LLVMTypes.h"
18 #include "mlir/IR/BuiltinOps.h"
19 #include "mlir/IR/Dialect.h"
20 #include "mlir/IR/OpDefinition.h"
21 #include "mlir/IR/OpImplementation.h"
22 #include "mlir/IR/TypeSupport.h"
23 #include "mlir/IR/Types.h"
24 #include "mlir/Interfaces/ControlFlowInterfaces.h"
25 #include "mlir/Interfaces/SideEffectInterfaces.h"
26 #include "llvm/IR/DerivedTypes.h"
27 #include "llvm/IR/LLVMContext.h"
28 #include "llvm/IR/Module.h"
29 #include "llvm/IR/Type.h"
30 
31 #include "mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc"
32 
33 namespace llvm {
34 class Type;
35 class LLVMContext;
36 namespace sys {
37 template <bool mt_only>
38 class SmartMutex;
39 } // end namespace sys
40 } // end namespace llvm
41 
42 namespace mlir {
43 namespace LLVM {
44 class LLVMDialect;
45 
46 namespace detail {
47 struct LLVMTypeStorage;
48 struct LLVMDialectImpl;
49 } // namespace detail
50 
51 } // namespace LLVM
52 } // namespace mlir
53 
54 ///// Ops /////
55 #define GET_OP_CLASSES
56 #include "mlir/Dialect/LLVMIR/LLVMOps.h.inc"
57 
58 #include "mlir/Dialect/LLVMIR/LLVMOpsDialect.h.inc"
59 
60 namespace mlir {
61 namespace LLVM {
62 /// Create an LLVM global containing the string "value" at the module containing
63 /// surrounding the insertion point of builder. Obtain the address of that
64 /// global and use it to compute the address of the first character in the
65 /// string (operations inserted at the builder insertion point).
66 Value createGlobalString(Location loc, OpBuilder &builder, StringRef name,
67                          StringRef value, Linkage linkage);
68 
69 /// LLVM requires some operations to be inside of a Module operation. This
70 /// function confirms that the Operation has the desired properties.
71 bool satisfiesLLVMModule(Operation *op);
72 
73 } // end namespace LLVM
74 } // end namespace mlir
75 
76 #endif // MLIR_DIALECT_LLVMIR_LLVMDIALECT_H_
77