MLIR  16.0.0git
RegionKindInterface.h
Go to the documentation of this file.
1 //===- RegionKindInterface.h - Region Kind 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 contains the definitions of the infer op interfaces defined in
10 // `RegionKindInterface.td`.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MLIR_IR_REGIONKINDINTERFACE_H_
15 #define MLIR_IR_REGIONKINDINTERFACE_H_
16 
17 #include "mlir/IR/OpDefinition.h"
18 
19 namespace mlir {
20 
21 /// The kinds of regions contained in an operation. SSACFG regions
22 /// require the SSA-Dominance property to hold. Graph regions do not
23 /// require SSA-Dominance. If a registered operation does not implement
24 /// RegionKindInterface, then any regions it contains are assumed to be
25 /// SSACFG regions.
26 enum class RegionKind {
27  SSACFG,
28  Graph,
29 };
30 
31 namespace OpTrait {
32 /// A trait that specifies that an operation only defines graph regions.
33 template <typename ConcreteType>
34 class HasOnlyGraphRegion : public TraitBase<ConcreteType, HasOnlyGraphRegion> {
35 public:
36  static RegionKind getRegionKind(unsigned index) { return RegionKind::Graph; }
37  static bool hasSSADominance(unsigned index) { return false; }
38 };
39 } // namespace OpTrait
40 
41 } // namespace mlir
42 
43 #include "mlir/IR/RegionKindInterface.h.inc"
44 
45 #endif // MLIR_IR_REGIONKINDINTERFACE_H_
Include the generated interface declarations.
RegionKind
The kinds of regions contained in an operation.
static bool hasSSADominance(unsigned index)
Helper class for implementing traits.
Definition: OpDefinition.h:312
A trait that specifies that an operation only defines graph regions.
static RegionKind getRegionKind(unsigned index)