CIRCT 23.0.0git
Loading...
Searching...
No Matches
ProceduralRegionTrait.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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 header file defines traits for (non-)procedural regions and operations.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef CIRCT_SUPPORT_PROCEDURALREGIONTRAIT_H
14#define CIRCT_SUPPORT_PROCEDURALREGIONTRAIT_H
15
16#include "circt/Support/LLVM.h"
17#include "mlir/IR/OpDefinition.h"
18#include "llvm/Support/LogicalResult.h"
19
20namespace circt {
21
22/// Returns `success` if the operation has no closer surrounding parent
23/// marked as procedural region than its closest parent marked as
24/// non-procedural region.
25/// Also returns `success` if no parent is marked as either procedural or
26/// non-procedural region.
27LogicalResult verifyNotInProceduralRegion(Operation *op);
28
29/// Returns `success` if the operation has no closer surrounding parent
30/// marked as non-procedural region than its closest parent marked as
31/// procedural region.
32/// Also returns `success` if no parent is marked as either procedural or
33/// non-procedural region.
34LogicalResult verifyNotInNonProceduralRegion(Operation *op);
35
36/// Signals that an operation's regions are procedural.
37template <typename ConcreteType>
39 : public mlir::OpTrait::TraitBase<ConcreteType, ProceduralRegion> {
40 static LogicalResult verifyTrait(Operation *op) {
41 return mlir::OpTrait::impl::verifyNRegions(op, 1);
42 }
43};
44
45/// Signals that an operation's regions are non-procedural.
46template <typename ConcreteType>
48 : public mlir::OpTrait::TraitBase<ConcreteType, NonProceduralRegion> {
49 static LogicalResult verifyTrait(Operation *op) {
50 return mlir::OpTrait::impl::verifyNRegions(op, 1);
51 }
52};
53
54/// Signals that an operation must not be in a non-procedural region.
55template <typename ConcreteType>
57 : public mlir::OpTrait::TraitBase<ConcreteType, ProceduralOp> {
58public:
59 static LogicalResult verifyTrait(Operation *op) {
61 }
62};
63
64/// Signals that an operation must not be in a procedural region.
65template <typename ConcreteType>
67 : public mlir::OpTrait::TraitBase<ConcreteType, NonProceduralOp> {
68public:
69 static LogicalResult verifyTrait(Operation *op) {
71 }
72};
73
74} // namespace circt
75
76#endif // CIRCT_SUPPORT_PROCEDURALREGIONTRAIT_H
Signals that an operation must not be in a procedural region.
static LogicalResult verifyTrait(Operation *op)
Signals that an operation's regions are non-procedural.
static LogicalResult verifyTrait(Operation *op)
Signals that an operation must not be in a non-procedural region.
static LogicalResult verifyTrait(Operation *op)
Signals that an operation's regions are procedural.
static LogicalResult verifyTrait(Operation *op)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
LogicalResult verifyNotInNonProceduralRegion(Operation *op)
Returns success if the operation has no closer surrounding parent marked as non-procedural region tha...
LogicalResult verifyNotInProceduralRegion(Operation *op)
Returns success if the operation has no closer surrounding parent marked as procedural region than it...