| 1 | //===- CIRDialect.h - CIR 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 declares the CIR dialect. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_CLANG_CIR_DIALECT_IR_CIRDIALECT_H |
| 14 | #define LLVM_CLANG_CIR_DIALECT_IR_CIRDIALECT_H |
| 15 | |
| 16 | #include "mlir/IR/Builders.h" |
| 17 | #include "mlir/IR/BuiltinOps.h" |
| 18 | #include "mlir/IR/BuiltinTypes.h" |
| 19 | #include "mlir/IR/Dialect.h" |
| 20 | #include "mlir/IR/OpDefinition.h" |
| 21 | #include "mlir/Interfaces/CallInterfaces.h" |
| 22 | #include "mlir/Interfaces/ControlFlowInterfaces.h" |
| 23 | #include "mlir/Interfaces/FunctionInterfaces.h" |
| 24 | #include "mlir/Interfaces/InferTypeOpInterface.h" |
| 25 | #include "mlir/Interfaces/LoopLikeInterface.h" |
| 26 | #include "mlir/Interfaces/MemorySlotInterfaces.h" |
| 27 | #include "mlir/Interfaces/SideEffectInterfaces.h" |
| 28 | |
| 29 | #include "clang/CIR/Dialect/IR/CIRAttrs.h" |
| 30 | #include "clang/CIR/Dialect/IR/CIROpsDialect.h.inc" |
| 31 | #include "clang/CIR/Dialect/IR/CIROpsEnums.h" |
| 32 | #include "clang/CIR/Interfaces/CIRLoopOpInterface.h" |
| 33 | #include "clang/CIR/Interfaces/CIROpInterfaces.h" |
| 34 | #include "clang/CIR/MissingFeatures.h" |
| 35 | |
| 36 | namespace mlir { |
| 37 | namespace OpTrait { |
| 38 | |
| 39 | namespace impl { |
| 40 | // These functions are out-of-line implementations of the methods in the |
| 41 | // corresponding trait classes. This avoids them being template |
| 42 | // instantiated/duplicated. |
| 43 | LogicalResult verifySameFirstOperandAndResultType(Operation *op); |
| 44 | } // namespace impl |
| 45 | |
| 46 | /// This class provides verification for ops that are known to have the same |
| 47 | /// first operand and result type. |
| 48 | /// |
| 49 | template <typename ConcreteType> |
| 50 | class SameFirstOperandAndResultType |
| 51 | : public TraitBase<ConcreteType, SameFirstOperandAndResultType> { |
| 52 | public: |
| 53 | static llvm::LogicalResult verifyTrait(Operation *op) { |
| 54 | return impl::verifySameFirstOperandAndResultType(op); |
| 55 | } |
| 56 | }; |
| 57 | |
| 58 | } // namespace OpTrait |
| 59 | } // namespace mlir |
| 60 | |
| 61 | using BuilderCallbackRef = |
| 62 | llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)>; |
| 63 | using BuilderOpStateCallbackRef = llvm::function_ref<void( |
| 64 | mlir::OpBuilder &, mlir::Location, mlir::OperationState &)>; |
| 65 | |
| 66 | namespace cir { |
| 67 | void buildTerminatedBody(mlir::OpBuilder &builder, mlir::Location loc); |
| 68 | } // namespace cir |
| 69 | |
| 70 | // TableGen'erated files for MLIR dialects require that a macro be defined when |
| 71 | // they are included. GET_OP_CLASSES tells the file to define the classes for |
| 72 | // the operations of that dialect. |
| 73 | #define GET_OP_CLASSES |
| 74 | #include "clang/CIR/Dialect/IR/CIROps.h.inc" |
| 75 | |
| 76 | #endif // LLVM_CLANG_CIR_DIALECT_IR_CIRDIALECT_H |
| 77 | |