MLIR  22.0.0git
WasmSSAInterfaces.h
Go to the documentation of this file.
1 //===- WasmSSAInterfaces.h - WasmSSA Interfaces ---*- 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 op interfaces for the WasmSSA dialect in MLIR.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_DIALECT_WasmSSA_IR_WasmSSAINTERFACES_H_
14 #define MLIR_DIALECT_WasmSSA_IR_WasmSSAINTERFACES_H_
15 
17 #include "mlir/IR/OpDefinition.h"
18 
19 namespace mlir::wasmssa {
20 namespace detail {
21 /// Verify that `op` conforms to the ConstantExpressionInterface.
22 /// `op` must be initialized with valid constant expressions.
24 
25 /// Verify that `op` conforms to the LabelBranchingOpInterface
26 /// Checks that the branching is targetting something within its scope.
28 
29 /// Verify that `op` conforms to LabelLevelInterfaceIsTerminator
30 template <typename OpType>
32  static_assert(OpType::template hasTrait<::mlir::OpTrait::IsTerminator>(),
33  "LabelLevelOp should be terminator ops");
34  return success();
35 }
36 
37 /// Verify that `op` conforms to the LabelLevelInterface
38 /// `op`'s target should defined at the same scope level.
39 LogicalResult verifyLabelLevelInterface(Operation *op);
40 } // namespace detail
41 
42 /// Operations implementing this trait are considered as valid
43 /// constant expressions in any context (In contrast of
44 /// ConstantExprCheckOpInterface which are sometimes considered valid constant
45 /// expressions.
46 template <class OperationType>
48  : public OpTrait::TraitBase<OperationType, ConstantExprOpTrait> {};
49 
50 /// Trait used to verify operations that need a constant expression initializer.
51 template <typename OpType>
53  : public OpTrait::TraitBase<OpType, ConstantExpressionInitializerOpTrait> {
54  static LogicalResult verifyTrait(Operation *op) {
56  }
57 };
58 
59 } // namespace mlir::wasmssa
60 #include "mlir/Dialect/WasmSSA/IR/WasmSSAInterfaces.h.inc"
61 
62 #endif // MLIR_DIALECT_WasmSSA_IR_WasmSSAINTERFACES_H_
Helper class for implementing traits.
Definition: OpDefinition.h:378
Operation is the basic unit of execution within MLIR.
Definition: Operation.h:88
LogicalResult verifyConstantExpressionInterface(Operation *op)
Verify that op conforms to the ConstantExpressionInterface.
LogicalResult verifyLabelBranchingOpInterface(Operation *op)
Verify that op conforms to the LabelBranchingOpInterface Checks that the branching is targetting some...
LogicalResult verifyLabelLevelInterface(Operation *op)
Verify that op conforms to the LabelLevelInterface op's target should defined at the same scope level...
LogicalResult verifyLabelLevelInterfaceIsTerminator()
Verify that op conforms to LabelLevelInterfaceIsTerminator.
Operations implementing this trait are considered as valid constant expressions in any context (In co...
Trait used to verify operations that need a constant expression initializer.
static LogicalResult verifyTrait(Operation *op)