@@ -8,6 +8,7 @@ include "mlir/IR/SymbolInterfaces.td"
88include "p4mlir/Dialect/BMv2IR/BMv2IR_Dialect.td"
99include "p4mlir/Dialect/BMv2IR/BMv2IR_Types.td"
1010include "p4mlir/Dialect/BMv2IR/BMv2IR_Attrs.td"
11+ include "p4mlir/Dialect/BMv2IR/BMv2IR_OpInterfaces.td"
1112
1213//===----------------------------------------------------------------------===//
1314// Base BMv2IR operation definition.
@@ -69,6 +70,8 @@ def BMv2IR_ParserStateOp : BMv2IR_Op<"state",
6970 `\n``transitions` $transitions
7071 `\n``parser_ops` $parser_ops attr-dict
7172 }];
73+
74+ let hasVerifier = 1;
7275}
7376
7477def BMv2IR_TransitionOp : BMv2IR_Op<"transition", [HasParent<"ParserStateOp">]> {
@@ -102,7 +105,7 @@ def BMv2IR_TransitionOp : BMv2IR_Op<"transition", [HasParent<"ParserStateOp">]>
102105}
103106
104107
105- def BMv2_ExtractOp : BMv2IR_Op<"extract", [HasParent<"ParserStateOp">]> {
108+ def BMv2_ExtractOp : BMv2IR_Op<"extract", [HasParent<"ParserStateOp">, AllowedParserOp ]> {
106109 let summary = "Extract header operation";
107110 let description = [{
108111 Extracts the field of a header instance, header stack, or union stack element.
@@ -129,7 +132,7 @@ def BMv2_ExtractOp : BMv2IR_Op<"extract", [HasParent<"ParserStateOp">]> {
129132// see https://github.com/p4lang/behavioral-model/blob/main/docs/JSON_format.md#the-type-value-object
130133//===-------------------------------------------------------------------------------------------===//
131134
132- def BMv2IR_FieldOp : BMv2IR_Op<"field"> {
135+ def BMv2IR_FieldOp : BMv2IR_Op<"field", [AllowedTransitionKey] > {
133136 let summary = "BMv2 header field access";
134137 let description = [{
135138 Represents access to a field within a header instance.
@@ -144,7 +147,7 @@ def BMv2IR_FieldOp : BMv2IR_Op<"field"> {
144147 let assemblyFormat = "`<` $headerInstance `,` $fieldMember `>` attr-dict";
145148}
146149
147- def BMv2_StackFieldOp : BMv2IR_Op<"stack_field"> {
150+ def BMv2_StackFieldOp : BMv2IR_Op<"stack_field", [AllowedTransitionKey] > {
148151 let summary = "BMv2 header stack field access";
149152 let description = [{
150153 Represents access to a field in the last valid header instance in a stack.
@@ -160,7 +163,7 @@ def BMv2_StackFieldOp : BMv2IR_Op<"stack_field"> {
160163}
161164
162165
163- def BMv2IR_LookaheadOp : BMv2IR_Op<"lookahead"> {
166+ def BMv2IR_LookaheadOp : BMv2IR_Op<"lookahead", [AllowedTransitionKey] > {
164167 let summary = "BMv2 parser lookahead";
165168 let description = [{
166169 Represents a lookahead operation in a parser.
@@ -175,7 +178,7 @@ def BMv2IR_LookaheadOp : BMv2IR_Op<"lookahead"> {
175178 let assemblyFormat = "`<` $bitOffset `,` $bitwidth `>` attr-dict";
176179}
177180
178- def BMv2_UnionStackFieldOp : BMv2IR_Op<"union_stack_field"> {
181+ def BMv2_UnionStackFieldOp : BMv2IR_Op<"union_stack_field", [AllowedTransitionKey] > {
179182 let summary = "BMv2 header union stack field access";
180183 let description = [{
181184 Represents access to a field in the last valid union instance in a stack.
0 commit comments