1//===- RegionKindInterface.td - Region kind interfaces -----*- tablegen -*-===//
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 a set of interfaces to query the properties of regions
10// in an operation.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_IR_REGIONKINDINTERFACE
15#define MLIR_IR_REGIONKINDINTERFACE
16
17include "mlir/IR/OpBase.td"
18
19// OpInterface to query the properties of regions in an operation
20def RegionKindInterface : OpInterface<"RegionKindInterface"> {
21  let description = [{
22    Interface for operations to describe the abstract semantics of
23    their regions. Currently, two kinds of regions are
24    supported. RegionKind::Graph represents a graph region without
25    control flow semantics. RegionKind::SSACFG represents an
26    [SSA-style control flow](LangRef.md#modeling-control-flow) region
27    with basic blocks, sequential semantics, and reachability.
28  }];
29  let cppNamespace = "::mlir";
30
31  let methods = [
32    StaticInterfaceMethod<
33      /*desc=*/[{
34        Return the kind of the region with the given index inside this operation.
35      }],
36      /*retTy=*/"RegionKind",
37      /*methodName=*/"getRegionKind",
38      /*args=*/(ins "unsigned":$index)
39    >,
40    StaticInterfaceMethod<
41      /*desc=*/"Return true if the kind of the given region requires the "
42               "SSA-Dominance property",
43      /*retTy=*/"bool",
44      /*methodName=*/"hasSSADominance",
45      /*args=*/(ins "unsigned":$index),
46      /*methodBody=*/[{
47        return getRegionKind(index) == RegionKind::SSACFG;
48      }]
49    >,
50  ];
51}
52
53#endif // MLIR_IR_REGIONKINDINTERFACE
54