1//===- RegionKindInterface.cpp - 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 region kind interfaces defined in
10// `RegionKindInterface.td`.
11//
12//===----------------------------------------------------------------------===//
13
14#include "mlir/IR/RegionKindInterface.h"
15
16using namespace mlir;
17
18#include "mlir/IR/RegionKindInterface.cpp.inc"
19
20bool mlir::mayHaveSSADominance(Region &region) {
21 auto regionKindOp = dyn_cast<RegionKindInterface>(region.getParentOp());
22 if (!regionKindOp)
23 return true;
24 return regionKindOp.hasSSADominance(region.getRegionNumber());
25}
26
27bool mlir::mayBeGraphRegion(Region &region) {
28 if (!region.getParentOp()->isRegistered())
29 return true;
30 auto regionKindOp = dyn_cast<RegionKindInterface>(region.getParentOp());
31 if (!regionKindOp)
32 return false;
33 return !regionKindOp.hasSSADominance(region.getRegionNumber());
34}
35

source code of mlir/lib/IR/RegionKindInterface.cpp